diff options
author | iainp5 <iain.pearce.ip@gmail.com> | 2024-11-29 22:56:43 +0000 |
---|---|---|
committer | iainp5 <iain.pearce.ip@gmail.com> | 2024-11-29 22:56:43 +0000 |
commit | 535e5a561f54287522abde5971be8ecdfe17d351 (patch) | |
tree | 3bd1e68fb9b50fdd44a530519be33977e8b0f523 /rules.js | |
parent | 0a9f4129e132900fce0d1b83803b1495e7d09a5d (diff) | |
download | 1989-dawn-of-freedom-535e5a561f54287522abde5971be8ecdfe17d351.tar.gz |
Updates for CEH and Stasi
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 72 |
1 files changed, 39 insertions, 33 deletions
@@ -486,6 +486,7 @@ exports.view = function (state, player) { // === ACTIONS =========== function gen_action(action, argument) { + console.log('gen_action called with', action) if (argument === undefined) { view.actions[action] = 1 } else { @@ -628,23 +629,6 @@ states.play_card = { return } - // Check for Reformer Rehabilitated - if (game.played_card === C_REFORMER_REHABILITATED && game.playable_cards.includes(C_REFORMER_REHABILITATED)) { - if (game.active === DEM && (game.dem_tst_position > game.com_tst_position)) { - gen_action('event') - } - if (game.active === COM && (game.dem_tst_position < game.com_tst_position)) { - gen_action('event') - } - } - - // Check Common European Home - if (game.played_card === C_COMMON_EUROPEAN_HOME) { - if (ceh_card_check().length > 0) { - gen_action('event') - } - } - // Check for events if (event_is_playable(game.played_card)) { if ( @@ -697,6 +681,18 @@ states.play_card = { view.actions.event = 0 } } + + // Special check for Reformer Rehabilitated + if (game.played_card === C_REFORMER_REHABILITATED && game.playable_cards.includes(C_REFORMER_REHABILITATED)) { + if (game.active === DEM && (game.dem_tst_position > game.com_tst_position)) { + gen_action('event') + view.actions.event = 1 + } + if (game.active === COM && (game.dem_tst_position < game.com_tst_position)) { + gen_action('event') + view.actions.event = 1 + } + } gen_action('influence') gen_action('support_check') @@ -2087,7 +2083,7 @@ states.stasi_confirm_scoring_card = { }, continue() { push_undo() - end_stasi_choose_card() + end_stasi() }, } @@ -2110,8 +2106,7 @@ states.stasi_confirm = { gen_action('done') }, done() { - game.playable_cards = game.playable_cards.filter(n => n !== C_COMMON_EUROPEAN_HOME) - end_stasi_choose_card() + end_stasi() } } @@ -2162,6 +2157,7 @@ states.stasi_resolve_common_european_home = { gen_action('no') }, yes() { + push_undo() log(`Played C${game.played_card} with Common European Home`) silent_discard(C_COMMON_EUROPEAN_HOME) game.vm_infl_to_do = true @@ -2169,6 +2165,7 @@ states.stasi_resolve_common_european_home = { game.state = 'resolve_opponent_event' }, no() { + push_undo() game.state = 'play_card' }, } @@ -3135,17 +3132,21 @@ function end_stasi_choose_card() { if (game.stasi_card === C_COMMON_EUROPEAN_HOME) { game.state = 'stasi_confirm' } else { - game.round_player = COM - game.round ++ - log_h2(`Action Round ${game.round}`) - next_player() - game.valid_spaces = [] - if (game.persistent_events.includes(C_GENERAL_STRIKE)) { - log_h3('C' + C_GENERAL_STRIKE) - game.state = 'general_strike' - } else { - game.state = 'choose_card' - } + end_stasi() + } +} + +function end_stasi() { + game.round_player = COM + game.round ++ + log_h2(`Action Round ${game.round}`) + next_player() + game.valid_spaces = [] + if (game.persistent_events.includes(C_GENERAL_STRIKE)) { + log_h3('C' + C_GENERAL_STRIKE) + game.state = 'general_strike' + } else { + game.state = 'choose_card' } } @@ -3405,8 +3406,13 @@ function event_is_playable(card) { return false } // Check for Common European Home under Stasi - else if (game.stasi_card === C_COMMON_EUROPEAN_HOME && card === C_COMMON_EUROPEAN_HOME && game.active === DEM) { - return false + else if (card === C_COMMON_EUROPEAN_HOME && game.active === DEM) { + if (game.stasi_card === C_COMMON_EUROPEAN_HOME) { + return false + } else { + if (ceh_card_check().length > 0) + return true + } } // Check for Gorbachev Charms the West after Breakaway Baltic Republics |