summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorMischa Untaga <99098079+MischaU8@users.noreply.github.com>2023-11-28 11:14:25 +0100
committerMischa Untaga <99098079+MischaU8@users.noreply.github.com>2023-11-28 11:14:25 +0100
commit6248c5c943b46e2a7bc8cb88597921c265b2504b (patch)
tree529c2919178ca2e7621e90f002af1eddfbfe6ae0 /rules.js
parentdc084462cdb4bcecf818fb0aa47769866888e99c (diff)
downloadvotes-for-women-6248c5c943b46e2a7bc8cb88597921c265b2504b.tar.gz
campaigning when no more states to add cubes
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js33
1 files changed, 23 insertions, 10 deletions
diff --git a/rules.js b/rules.js
index d1f713c..d4fe76b 100644
--- a/rules.js
+++ b/rules.js
@@ -1511,13 +1511,22 @@ states.campaigning_add_cubes = {
}
}
- view.prompt = `Campaigning: Add a ${COLOR_NAMES[campaigner_color(game.selected_campaigner)]} cube`
- if (has_opponent_cubes)
- view.prompt += " or remove an Opponent's cube"
- if (can_move) {
- view.prompt += " or Move to another Region"
+
+ if (us_states.length) {
+ view.prompt = `Campaigning: Add a ${COLOR_NAMES[campaigner_color(game.selected_campaigner)]} cube.`
+ if (has_opponent_cubes)
+ view.prompt += " or remove an Opponent's cube"
+ if (can_move) {
+ view.prompt += " or Move to another Region"
+ }
+ view.prompt += "."
+ } else {
+ view.prompt = `Campaigning: No available States to add a ${COLOR_NAMES[campaigner_color(game.selected_campaigner)]} cube.`
+ gen_action("done")
}
- view.prompt += "."
+ },
+ done() {
+ end_campaigning_add_cube()
},
move() {
push_undo()
@@ -1555,13 +1564,17 @@ function after_campaigning_add_cube(us_state) {
game.campaigning.added += 1
if (game.campaigning.added === game.campaigning.count) {
- delete game.selected_campaigner
- if (game.campaigning.dice_idx < game.roll.length)
- game.campaigning.dice_idx += 1
- goto_campaigning_assign()
+ end_campaigning_add_cube()
}
}
+function end_campaigning_add_cube() {
+ delete game.selected_campaigner
+ if (game.campaigning.dice_idx < game.roll.length)
+ game.campaigning.dice_idx += 1
+ goto_campaigning_assign()
+}
+
states.campaigning_move = {
inactive: "do Campaigning.",
prompt() {