From 7cf08432ae2084e7879a1fba0dc34834a6180c86 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 21 Aug 2024 18:04:09 +0200 Subject: End card play immediately on "Pass" during event/ops. avoid the awkward "pass -> next" dance. --- rules.js | 61 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 30 insertions(+), 31 deletions(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index 82c7a09..419060d 100644 --- a/rules.js +++ b/rules.js @@ -1535,6 +1535,11 @@ function next_strategy_card() { goto_strategy_phase(ENEMY[game.active]) } +function end_strategy_card_now() { + if (end_strategy_card()) + next_strategy_card() +} + function clear_queue() { if (game.active === P_BRITAIN) game.b_queue = 0 @@ -1574,8 +1579,7 @@ states.discard_event_pc_action = { end_strategy_card() }, pass() { - push_undo() - end_strategy_card() + end_strategy_card_now() }, } @@ -1641,19 +1645,20 @@ states.ops_pc = { else place_american_pc(s) } - if (--game.count === 0) + if (--game.count === 0) { end_ops_pc() + end_strategy_card() + } }, pass() { - push_undo() end_ops_pc() + end_strategy_card_now() }, } function end_ops_pc() { if (game.active === P_BRITAIN) gen_british_pc_ops_end() - end_strategy_card() } function gen_british_pc_ops_start() { @@ -1954,7 +1959,7 @@ states.ops_general_who = { push_undo() if (game.campaign > 0) game.campaign = 0 - end_strategy_card() + end_strategy_card_now() }, } @@ -2258,8 +2263,10 @@ function end_move(stop) { if (count_friendly_generals(where) > 1) goto_remove_general_after_move(where) else { - if (end_strategy_card() && stop) - next_strategy_card() + if (stop) + end_strategy_card_now() + else + end_strategy_card() } } @@ -3306,9 +3313,8 @@ states.remove_british_pc_from = { } }, pass() { - push_undo() delete game.where - end_strategy_card() + end_strategy_card_now() }, } @@ -3329,13 +3335,11 @@ states.remove_american_pc = { space(where) { push_undo() remove_pc(where) - if (--game.count === 0) { + if (--game.count === 0) end_strategy_card() - } }, pass() { - push_undo() - end_strategy_card() + end_strategy_card_now() }, } @@ -3364,9 +3368,8 @@ states.remove_american_pc_from = { } }, pass() { - push_undo() delete game.where - end_strategy_card() + end_strategy_card_now() }, } @@ -3400,9 +3403,8 @@ states.remove_american_pc_from_non_port = { } }, pass() { - push_undo() delete game.where - end_strategy_card() + end_strategy_card_now() }, } @@ -3446,9 +3448,8 @@ states.remove_american_pc_within_two_spaces_of_a_british_general = { } }, pass() { - push_undo() delete game.where - end_strategy_card() + end_strategy_card_now() }, } @@ -3473,8 +3474,7 @@ states.place_american_pc = { end_strategy_card() }, pass() { - push_undo() - end_strategy_card() + end_strategy_card_now() }, } @@ -3499,7 +3499,7 @@ states.place_american_pc_in = { }, pass() { delete game.where - end_strategy_card() + end_strategy_card_now() }, } @@ -3528,7 +3528,7 @@ states.lord_sandwich_coastal_raids = { } }, pass() { - end_strategy_card() + end_strategy_card_now() }, } @@ -3563,7 +3563,7 @@ states.remove_american_cu = { end_strategy_card() }, pass() { - end_strategy_card() + end_strategy_card_now() }, } @@ -3587,7 +3587,7 @@ states.remove_british_cu = { end_strategy_card() }, pass() { - end_strategy_card() + end_strategy_card_now() }, } @@ -3615,7 +3615,7 @@ states.pennsylvania_and_new_jersey_line_mutinies = { end_strategy_card() }, pass() { - end_strategy_card() + end_strategy_card_now() }, } @@ -3681,8 +3681,7 @@ function end_declaration_of_independence() { game.active = game.save delete game.save delete game.colonies - if (end_strategy_card()) - next_strategy_card() + end_strategy_card_now() } function do_event(c) { @@ -3754,8 +3753,7 @@ function end_george_washington_captured() { delete game.save if (game.active === P_AMERICA) { // skip end turn pause after britain removed washington at end of strategy card - if (end_strategy_card()) - next_strategy_card() + end_strategy_card_now() } else { end_strategy_card() } @@ -4149,6 +4147,7 @@ states.return_continental_congress = { game.state = "return_continental_congress_confirm" }, pass() { + clear_undo() goto_place_pc_markers_segment(false) }, } -- cgit v1.2.3