From 6248c5c943b46e2a7bc8cb88597921c265b2504b Mon Sep 17 00:00:00 2001 From: Mischa Untaga <99098079+MischaU8@users.noreply.github.com> Date: Tue, 28 Nov 2023 11:14:25 +0100 Subject: campaigning when no more states to add cubes --- rules.js | 33 +++++++++++++++++++++++---------- 1 file 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() { -- cgit v1.2.3