From 8a7dc17b764e9f1fb79cc1243901608d309b4bab Mon Sep 17 00:00:00 2001 From: Mischa Untaga <99098079+MischaU8@users.noreply.github.com> Date: Tue, 21 Nov 2023 10:56:35 +0100 Subject: action: move each player campaigner for free --- events.txt | 8 ++------ rules.js | 56 +++++++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 49 insertions(+), 15 deletions(-) diff --git a/events.txt b/events.txt index 71d96ca..ed8e01f 100644 --- a/events.txt +++ b/events.txt @@ -440,7 +440,7 @@ CARD 83 - Western Saloons Push Suffrage Veto CARD 84 - Transcontinental Railroad # Move each :red_campaigner to any region(s) without paying any :button and then take a Campaigning action. - move_each_campaigner_free RED + move_each_player_campaigner_free campaigning_action CARD 85 - White Supremacy and the Suffrage Movement @@ -601,11 +601,7 @@ CARD 113 - Eye on the Future CARD 114 - Transportation # Move all of your :purple_campaigner and :yellow_campaigner OR :red_campaigner to any region(s) without playing any :button and then take a Campaigning action. - if (game.active === SUF) - move_each_campaigner_free PURPLE_OR_YELLOW - else - move_each_campaigner_free RED - endif + move_each_player_campaigner_free campaigning_action CARD 115 - Counter Strat diff --git a/rules.js b/rules.js index 446424e..0b62940 100644 --- a/rules.js +++ b/rules.js @@ -1701,9 +1701,14 @@ function vm_roll() { goto_vm_roll_dice() } -function vm_move_each_campaigner_free() { - game.vm.campaigner = vm_operand(1) - goto_vm_move_each_campaigner_free() +function vm_move_each_player_campaigner_free() { + if (has_player_active_campaigners()) { + game.vm.moved = [] + game.state = "move_each_player_campaigner_free" + game.selected_campaigner = 0 + } else { + vm_next() + } } function vm_select_strategy_card() { @@ -2295,6 +2300,43 @@ function goto_vm_select_strategy_card() { game.state = "select_strategy_card" } +states.move_each_player_campaigner_free = { + inactive: "move a campaigner.", + prompt() { + if (!game.selected_campaigner) { + event_prompt("Select a Campaigner.") + + for_each_player_campaigner(c => { + if (!set_has(game.vm.moved, c)) + gen_action_campaigner(c) + }) + } else { + event_prompt("Select region to move the Campaigner to.") + let current_region = campaigner_region(game.selected_campaigner) + for (let r = 1; r <= region_count; r++) { + if (r !== current_region) + gen_action_region(r) + } + } + }, + campaigner(c) { + push_undo() + game.selected_campaigner = c + }, + region(r) { + push_undo() + move_campaigner(game.selected_campaigner, r) + set_add(game.vm.moved, game.selected_campaigner) + game.selected_campaigner = 0 + + if (game.vm.moved.length === count_player_active_campaigners()) { + delete game.selected_campaigner + vm_next() + } + } +} + + // #endregion // #region LOGGING @@ -3156,7 +3198,7 @@ CODE[83] = [ // Western Saloons Push Suffrage Veto ] CODE[84] = [ // Transcontinental Railroad - [ vm_move_each_campaigner_free, RED ], + [ vm_move_each_player_campaigner_free ], [ vm_campaigning_action ], [ vm_return ], ] @@ -3345,11 +3387,7 @@ CODE[113] = [ // Eye on the Future ] CODE[114] = [ // Transportation - [ vm_if, ()=>(game.active === SUF) ], - [ vm_move_each_campaigner_free, PURPLE_OR_YELLOW ], - [ vm_else ], - [ vm_move_each_campaigner_free, RED ], - [ vm_endif ], + [ vm_move_each_player_campaigner_free ], [ vm_campaigning_action ], [ vm_return ], ] -- cgit v1.2.3