From 0257e4fee8a824dec3730bbe5b99b242c96325a8 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 23 May 2023 21:04:38 +0200 Subject: Fix Final Crisis impossible events. Fix victory check. --- rules.js | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/rules.js b/rules.js index 8e0fba5..f967449 100644 --- a/rules.js +++ b/rules.js @@ -2295,15 +2295,15 @@ states.final_crisis_events = { gen_action_card(c) }, card(c) { + push_undo() game.final_active = game.active discard_card(c) + game.what = c if (game.active === VERSAILLES && is_commune_card(c)) { - game.what = c game.active = COMMUNE game.state = "final_crisis_opponent_event" } else if (game.active === COMMUNE && is_versailles_card(c)) { - game.what = c game.active = VERSAILLES game.state = "final_crisis_opponent_event" } @@ -2313,12 +2313,23 @@ states.final_crisis_events = { if (can_play_event(c)) goto_play_event(c) else - log("Could not play.") + game.state = "final_crisis_cannot_play" } }, } -// TODO: - is this necessary? +states.final_crisis_cannot_play = { + inactive: "play an event", + prompt() { + view.prompt = card_names[game.what] + ": This event cannot be played." + view.actions.pass = 1 + }, + pass() { + log("Could not play.") + end_play_card() + }, +} + states.final_crisis_opponent_event = { inactive: "play an event", prompt() { @@ -2331,12 +2342,12 @@ states.final_crisis_opponent_event = { view.actions.pass = 1 }, event() { - log_h3(game.active + " - Event") + log_h3(enemy_player() + " - Opponent Event") logi("C" + game.what) goto_play_event(game.what) }, pass() { - log_h3(game.active + " - Pass") + log_h3(enemy_player() + " - Pass") logi("C" + game.what) end_play_card() }, @@ -2359,9 +2370,9 @@ function goto_final_victory() { log_br() - if (versailles_military_vp() > commune_military_vp()) + if (versailles_military_vp() >= commune_political_vp()) return goto_game_over(VERSAILLES, "Versailles won with Military VP!") - if (commune_political_vp() > versailles_political_vp()) + if (commune_political_vp() >= versailles_military_vp()) return goto_game_over(COMMUNE, "Commune won with Political VP!") let v = 0 @@ -2502,8 +2513,10 @@ states.vm_return = { inactive: "finish playing the event", prompt() { event_prompt("Done.") - // TODO: or end_event ? - view.actions.done = 1 + view.actions.end_event = 1 + }, + end_event() { + end_event() }, done() { end_event() -- cgit v1.2.3