summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMischa Untaga <99098079+MischaU8@users.noreply.github.com>2023-11-21 10:56:35 +0100
committerMischa Untaga <99098079+MischaU8@users.noreply.github.com>2023-11-21 10:56:35 +0100
commit8a7dc17b764e9f1fb79cc1243901608d309b4bab (patch)
tree432c21ec5b076b1042ef90335fefc640ef27adbe
parent02943b220c1a49ae8a3816814d3c3866df3d2be7 (diff)
downloadvotes-for-women-8a7dc17b764e9f1fb79cc1243901608d309b4bab.tar.gz
action: move each player campaigner for free
-rw-r--r--events.txt8
-rw-r--r--rules.js56
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 ],
]