From 608e5d9744a2ec9024977895579d81a3581b9b04 Mon Sep 17 00:00:00 2001 From: iainp5 Date: Fri, 20 Dec 2024 08:18:12 +0000 Subject: Fix General Strike with no cards in hand --- rules.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index 2c6526c..63e9502 100644 --- a/rules.js +++ b/rules.js @@ -1933,10 +1933,15 @@ states.game_over = { states.general_strike = { inactive: 'discard a card', prompt() { - view.prompt = 'General Strike: You must discard a card or play a Scoring Card.' - game.communist_hand - for (let card of game.communist_hand) { - gen_action_card(card) + if (game.communist_hand.length === 0) { + view.prompt = 'General Strike: No cards remaining. You must pass.' + gen_action('pass') + } else { + view.prompt = 'General Strike: You must discard a card or play a Scoring Card.' + game.communist_hand + for (let card of game.communist_hand) { + gen_action_card(card) + } } }, card(card) { @@ -1953,6 +1958,10 @@ states.general_strike = { game.state = 'general_strike_roll' } }, + pass() { + log("No cards to discard.") + game.state = 'end_round' + } } states.general_strike_roll = { @@ -1992,11 +2001,12 @@ states.honecker = { extra() { push_undo() game.round++ - log_gap(`Communist chooses to take an extra Action Round due to C${C_HONECKER}`) + log_gap(`Communist chooses to take an extra Action Round due to C${C_HONECKER}.`) log_round() game.round_player = COM permanently_remove(C_HONECKER) if (game.persistent_events.includes(C_GENERAL_STRIKE)) { + log('.cC' + C_GENERAL_STRIKE) game.state = 'general_strike' } else { game.state = 'choose_card' -- cgit v1.2.3