diff options
author | iainp5 <iain.pearce.ip@gmail.com> | 2024-11-01 21:09:12 +0000 |
---|---|---|
committer | iainp5 <iain.pearce.ip@gmail.com> | 2024-11-02 08:22:06 +0000 |
commit | dc3d2c0e71f8b024cc80416fe029aa1d73222d58 (patch) | |
tree | 2d33111f6b2cf018586c8a5869bf270cd188a3fe | |
parent | 1b63e91f7ce8e1f80cd69c2d8c96c85d89b1db7e (diff) | |
download | 1989-dawn-of-freedom-dc3d2c0e71f8b024cc80416fe029aa1d73222d58.tar.gz |
More tweaks to permanently remove
-rw-r--r-- | events.txt | 1 | ||||
-rw-r--r-- | rules.js | 36 |
2 files changed, 23 insertions, 14 deletions
@@ -472,7 +472,6 @@ add_limited_infl 11 1 CARD 65 - Presidential Visit* # The Communist's hand size is reduced to 7 next turn. -permanently_remove presidential_visit @@ -1803,7 +1803,7 @@ states.general_strike = { if (total > 5) { log('The strike is over.') - permanently_remove(5) + permanently_remove(C_GENERAL_STRIKE) game.persistent_events = game.persistent_events.filter(n => n !== 5) } else { log('The strike continues. Required 6 or more') @@ -2374,14 +2374,14 @@ function valid_spaces_infl() { for (let i = 0; i < game.demInfl.length; i++) { let space = spaces[i] let player_influence = game.active === COM ? game.comInfl[i] : game.demInfl[i]; - + // If the piece has the player's influence, add it and its adjacent spaces to the set if (player_influence > 0) { valid_spaces_set.add(space.space_id); let adjacent_spaces = get_adjusted_adjacency(space.space_id) for (let adj_space_id of adjacent_spaces) { - if (adj_space_id) { + if (adj_space_id >= 0) { const adj_piece = spaces[adj_space_id]; // Check if the adjacent space is controlled by the opponent @@ -2391,9 +2391,9 @@ function valid_spaces_infl() { if (game.active === DEM && adj_piece.country === 'East_Germany' && game.persistent_events.includes(C_GENSCHER)){ valid_spaces_set.add(adj_piece.space_id) } - + // 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 (ops >= 2 || !opponent_control) { valid_spaces_set.add(adj_piece.space_id) } } @@ -2867,9 +2867,9 @@ function add_to_persistent_events(card) { } function permanently_remove(card) { - if (game.strategy_removed.includes(card)) {return} + discard_from_table(card) remove_from_discard(card) - + if (game.strategy_removed.includes(card)) {return} let card_index = game.table_cards.indexOf(card) if (card_index !== -1) { game.table_cards.splice(card_index, 1) @@ -3405,7 +3405,8 @@ function new_turn() { if (game.persistent_events.includes(C_PRESIDENTIAL_VISIT)) { game.com_hand_limit = 7 log('Communist draws 7 cards due to C65') - game.persistent_events = game.persistent_events.filter(n => n !== C_PRESIDENTIAL_VISIT) + permanently_remove(C_PRESIDENTIAL_VISIT) + game.persistent_events = game.persistent_events.filter( card => card !== C_PRESIDENTIAL_VISIT) } draw_cards(game.strategy_deck, game.democrat_hand, game.communist_hand, game.dem_hand_limit, game.com_hand_limit) game.com_hand_limit = 8 @@ -3596,8 +3597,9 @@ function discard_from_table(card) { let find_card = game.table_cards.indexOf(card) if (find_card !== -1) { game.table_cards.splice(find_card, 1) - if (cards[card].remove === 1 && !game.strategy_removed.includes(card)) { - game.strategy_removed.push(card) + if (cards[card].remove === 1) { + if (!game.strategy_removed.includes(card)) { + game.strategy_removed.push(card) } } else {game.strategy_discard.push(card) } } } @@ -4031,6 +4033,16 @@ function vm_valid_spaces() { vm_next(); } +function vm_valid_spaces_com() { + let operand = vm_operand(1) + let space = spaces.find(space => space.ascii_name === operand) + if (game.comInfl[space.space_id] >0) { + game.valid_spaces.push(space.space_id) + } + check_systematization(); + vm_next(); +} + function vm_valid_spaces_opponent () { let valid_spaces = [] for (let i = 0; i < spaces.length; i++) { @@ -8232,7 +8244,6 @@ CODE[64] = [ // Legacy of 1968* ] CODE[65] = [ // Presidential Visit* - [ vm_permanently_remove ], [ vm_presidential_visit ], [ vm_return ], ] @@ -8488,7 +8499,7 @@ CODE[96] = [ // The Chinese Solution* CODE[97] = [ // The Tyrant is Gone* [ vm_if, ()=>game.persistent_events.includes(54) ], - [ vm_valid_spaces, 'Cluj-Napoca' ], + [ vm_valid_spaces_com, 'Cluj-Napoca' ], [ vm_prompt, 'the Romanian Elite Space' ], [ vm_remove_x_opp_infl, 4 ], [ vm_the_tyrant_is_gone ], @@ -8511,7 +8522,6 @@ CODE[98] = [ // Politburo Intrigue* ] CODE[99] = [ // Ligachev* - [ vm_permanently_remove ], [ vm_ligachev ], [ vm_return ], ] |