diff options
-rw-r--r-- | rules.js | 101 |
1 files changed, 67 insertions, 34 deletions
@@ -714,47 +714,60 @@ states.play_card = { check_ligachev_event(game.played_card) log_event(game.played_card) } - game.vm_infl_to_do = false - game.return = game.active - if (switch_events.includes(game.played_card)) { - change_player() + if (game.state === 'game_over') { + return + } else { + game.vm_infl_to_do = false + game.return = game.active + if (switch_events.includes(game.played_card)) { + change_player() + } + game.vm_event = game.played_card + goto_vm(game.vm_event) } - game.vm_event = game.played_card - goto_vm(game.vm_event) }, opp_event() { push_undo() log_ops_banner() check_ligachev_event(game.played_card) - log_event(game.played_card) - game.vm_infl_to_do = true - game.return = game.active - game.vm_event = game.played_card - if (is_auto_resolve(game.played_card) || switch_events.includes(game.played_card)) { - goto_vm(game.vm_event) + if (game.state === 'game_over') { + return } else { - change_player() - goto_vm(game.vm_event) + log_event(game.played_card) + game.vm_infl_to_do = true + game.return = game.active + game.vm_event = game.played_card + if (is_auto_resolve(game.played_card) || switch_events.includes(game.played_card)) { + goto_vm(game.vm_event) + } else { + change_player() + goto_vm(game.vm_event) + } } }, influence() { push_undo() log_ops_banner() check_ligachev_non_event() - log('Placed SP:') - finish_play_card() + if (game.state === 'game_over') { + return + } else { + log('Placed SP:') + finish_play_card() - // If ABHR - Set AHBR tracker to true - if (game.persistent_events.includes(C_AUSTRIA_HUNGARY_BORDER_REOPENED)) { - game.austria_hungary_border_reopened_tracker = true + // If ABHR - Set AHBR tracker to true + if (game.persistent_events.includes(C_AUSTRIA_HUNGARY_BORDER_REOPENED)) { + game.austria_hungary_border_reopened_tracker = true + } + game.state = 'add_influence' + valid_spaces_infl() } - game.state = 'add_influence' - valid_spaces_infl() }, tst() { push_undo() log_ops_banner() check_ligachev_non_event() + log('Tiananmen Square Attempt:') finish_play_card() game.state = 'tiananmen_square_attempt' @@ -763,20 +776,28 @@ states.play_card = { push_undo() log_ops_banner() check_ligachev_non_event() + if (game.state === 'game_over') { + return + } else { log('Support Checks:') finish_play_card() game.available_ops = 2 game.state = 'support_check_prep' valid_spaces_sc() + } }, tst_7() { /* Cancel opponent event */ push_undo() log_ops_banner() check_ligachev_non_event() - log(`Event cancelled using TST Award.`) - game.tst_7 = true - game.vm_infl_to_do = true - game.state = 'resolve_opponent_event' + if (game.state === 'game_over') { + return + } else { + log(`Event cancelled using TST Award.`) + game.tst_7 = true + game.vm_infl_to_do = true + game.state = 'resolve_opponent_event' + } }, tst_8() { /* Play card for ops and event */ push_undo() @@ -2218,22 +2239,30 @@ states.stasi_play_ceh = { log_ops_banner() log(`Played C${game.played_card} with C${C_COMMON_EUROPEAN_HOME}.`) check_ligachev_non_event() - log('Placed SP:') - if (game.persistent_events.includes(C_AUSTRIA_HUNGARY_BORDER_REOPENED)) { - game.austria_hungary_border_reopened_tracker = true + if (game.state === 'game_over') { + return + } else { + log('Placed SP:') + if (game.persistent_events.includes(C_AUSTRIA_HUNGARY_BORDER_REOPENED)) { + game.austria_hungary_border_reopened_tracker = true + } + game.state = 'add_influence' + valid_spaces_infl() } - game.state = 'add_influence' - valid_spaces_infl() }, support_check() { push_undo() log_ops_banner() log(`Played C${game.played_card} with C${C_COMMON_EUROPEAN_HOME}.`) check_ligachev_non_event() - log('Support Checks:') - game.available_ops = 2 - game.state = 'support_check_prep' - valid_spaces_sc() + if (game.state === 'game_over') { + return + } else { + log('Support Checks:') + game.available_ops = 2 + game.state = 'support_check_prep' + valid_spaces_sc() + } }, } @@ -8101,12 +8130,16 @@ states.vm_tst_8 = { event() { push_undo() check_ligachev_event(game.played_card) + if (game.state === 'game_over') { + return + } else { log_event(game.played_card) game.vm_event_to_do = false game.return_state = 'vm_tst_8' game.return = game.active game.vm_event = game.played_card goto_vm(game.vm_event) + } }, ops() { push_undo() |