From 9450ab67cce55cb07817a619a0151f264cd25414 Mon Sep 17 00:00:00 2001 From: iainp5 Date: Sun, 6 Oct 2024 09:11:50 +0100 Subject: Fix Foreign currency debt burden --- data.js | 2 +- rules.js | 45 ++++++++++++++++++--------------------------- 2 files changed, 19 insertions(+), 28 deletions(-) diff --git a/data.js b/data.js index 990d412..897de39 100644 --- a/data.js +++ b/data.js @@ -127,7 +127,7 @@ const cards = [ {number: 46, period: 2, side: 'D', name: 'Goodbye Lenin!*', ops: 3, remove: 1, playable: true, red: false}, {number: 47, period: 2, side: 'C', name: 'Bulgarian Turks Expelled*', ops: 3, remove: 1, playable: true, red: false}, {number: 48, period: 2, side: 'D', name: '\"We are the People!\"', ops: 3, remove: 1, playable: true, red: false}, - {number: 49, period: 2, side: 'D', name: 'Foreign Currency Debt Burden', ops: 1, remove: 0, playable: true, red: false}, + {number: 49, period: 2, side: 'D', name: 'Foreign Currency Debt Burden', ops: 1, remove: 1, playable: true, red: false}, {number: 50, period: 2, side: 'D', name: 'The Sinatra Doctrine*', ops: 3, remove: 1, playable: true, red: false}, {number: 51, period: 2, side: 'C', name: '40th Anniversary Celebration*', ops: 2, remove: 1, playable: true, red: false}, {number: 52, period: 2, side: 'C', name: 'Normalization*', ops: 3, remove: 1, playable: true, red: false}, diff --git a/rules.js b/rules.js index 8ebfe79..fa7c869 100644 --- a/rules.js +++ b/rules.js @@ -2526,12 +2526,12 @@ function valid_spaces_sc() { if (game.active === DEM) { infl = game.comInfl[i] - if (infl !== 0 ) { + //if (infl !== 0 ) { valid_spaces_set.add(space.space_id); - } + //} } else { infl = game.demInfl[i] - if (infl !== 0 ) { + //if (infl !== 0 ) { // Check Solidarity Legalised if (game.persistent_events.includes(2)) { if (space.space_id === 14) {continue} @@ -2545,18 +2545,19 @@ function valid_spaces_sc() { if (space.space_id === 9) {continue} } valid_spaces_set.add(space.space_id); - } + + //Check for Foreign Currency Debt Burden + if (game.persistent_events.includes(49)) { + for (let n of valid_spaces_set) { + if (spaces[n].country === game.foreign_currency_debt_burden) { + valid_spaces_set.delete(n); + } + } + } + //} } } - //Check for Foreign Currency Debt Burden - if (game.foreign_currency_debt_burden !== '') { - for (let n of valid_spaces_set) { - if (spaces[n].country === game.foreign_currency_debt_burden) { - valid_spaces_set.delete(n); - } - } - } // Convert the set to an array before returning game.valid_spaces = Array.from(valid_spaces_set); @@ -2632,15 +2633,9 @@ function valid_spaces_infl() { space = spaces[i] let player_influence = game.active === COM ? game.comInfl[i] : game.demInfl[i]; - if (space.country === 'Romania') { - console.log('checking piece:', space.name_unique, 'game.active', game.active, 'player infl', player_influence) - } // If the piece has the player's influence, add it and its adjacent spaces to the set if (player_influence > 0) { - if (space.country === 'Romania') { - console.log(space.name_unique, 'added to set') - } valid_spaces_set.add(space.space_id); // Check adjacency information @@ -2649,9 +2644,7 @@ function valid_spaces_infl() { for (let adj_space_id of adjacent_spaces) { //console.log('adj_space_id', adj_space_id) if (adj_space_id) { - if (space.country === 'Romania') { - console.log('checking adjacent space', spaces[adj_space_id].name_unique) - } + const adj_piece = spaces[adj_space_id]; //console.log('adjacent piece name', adj_piece.name_unique) @@ -2667,9 +2660,6 @@ function valid_spaces_infl() { // Otherwise, only add the adjacent space if the available_ops >= 2 or the space is not controlled by the opponent if (ops >= 2 || !opponent_control) { - if (space.country === 'Romania') { - console.log('space added normally') - } valid_spaces_set.add(adj_piece.space_id) } } @@ -4489,8 +4479,9 @@ function vm_valid_spaces_country_sc () { } game.valid_spaces = valid_spaces - if (!game.is_pwr_struggle && game.foreign_currency_debt_burden && game.foreign_currency_debt_burden !== '') { - game.valid_spaces = game.valid_spaces.filter(n => spaces[n].country !== game.foreign_currency_debt_burden) + //Check for Foreign Currency Debt Burden + if (game.persistent_events.includes(49) && game.active === DEM) { + game.valid_spaces = game.valid_spaces.filter(n => spaces[n].country !== game.foreign_currency_debt_burden) } vm_next() } @@ -9242,7 +9233,7 @@ CODE[208] = [//Tiananmen Square space 8 event CODE[349] = [//Scare Tactics [vm_scare_tactics], - [vm_valid_spaces_country_sc], + [vm_valid_spaces_country_opp], [vm_prompt, ()=>` from ${country_name(game.vm_active_country)}`], [vm_remove_opp_infl, 1], [vm_return] -- cgit v1.2.3