From e0a5203f2bbcc6c1ba0aa72c8ee4ce3e5dfe2980 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 14 May 2023 01:43:20 +0200 Subject: Click to discard failed Objective Cards. --- rules.js | 117 ++++++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 78 insertions(+), 39 deletions(-) diff --git a/rules.js b/rules.js index 5cbefd0..85238d1 100644 --- a/rules.js +++ b/rules.js @@ -1213,7 +1213,7 @@ states.play_final_discard = { }, card(c) { push_undo() - log_h3(game.active + " - Final Crisis") + log_h3(game.active + " - Operations (FC)") logi("C" + c) logi("C" + game.what) discard_final() @@ -1983,6 +1983,42 @@ function score_control(s, cf, vf, arg) { } } +function score_commune_control(s, cf, vf, arg) { + if (is_political_space(s)) { + if (cf(arg)) + add_political_vp(COMMUNE, 1) + else if (vf(arg)) + add_political_vp(COMMUNE, -1) + else + log("Nobody.") + } else { + if (cf(arg)) + add_military_vp(COMMUNE, 1) + else if (vf(arg)) + add_military_vp(COMMUNE, -1) + else + log("Nobody.") + } +} + +function score_versailles_control(s, cf, vf, arg) { + if (is_political_space(s)) { + if (cf(arg)) + add_political_vp(VERSAILLES, -1) + else if (vf(arg)) + add_political_vp(VERSAILLES, 1) + else + log("Nobody.") + } else { + if (cf(arg)) + add_military_vp(VERSAILLES, -1) + else if (vf(arg)) + add_military_vp(VERSAILLES, 1) + else + log("Nobody.") + } +} + function goto_crisis_dimension_scoring() { clear_undo() log_h2("Crisis Dimension Scoring") @@ -2023,19 +2059,11 @@ function goto_objective_card_scoring() { game.active = game.initiative game.count = 3 game.state = "objective_card_scoring" - - /* - log("Commune Objective:") - logi("C" + commune_objective_card()) - log("Versailles Objective:") - logi("C" + versailles_objective_card()) - log_br() - */ } states.objective_card_scoring = { prompt() { - view.prompt = "Objective Card Scoring!" + view.prompt = "Objective Card Scoring: Score each Objective Card space." if (game.count & 1) gen_action_space(commune_objective_space()) if (game.count & 2) @@ -2044,54 +2072,65 @@ states.objective_card_scoring = { space(s) { if (s === commune_objective_space()) { log_h3("S" + s) - logi("C" + commune_objective_card()) - score_control(s, is_commune_control, is_versailles_control, s) + score_commune_control(s, is_commune_control, is_versailles_control, s) game.count ^= 1 } if (s === versailles_objective_space()) { log_h3("S" + s) - logi("C" + versailles_objective_card()) - score_control(s, is_commune_control, is_versailles_control, s) + score_versailles_control(s, is_commune_control, is_versailles_control, s) game.count ^= 2 } if (game.count === 0) - goto_objective_card_events() + goto_objective_card_remove() }, } -function goto_objective_card_events() { - if (!is_commune_control(commune_objective_space())) { - log_br() - log_h3("Commune - Removed") - logi("C" + commune_objective_card()) - game.red_objective = 0 - } - if (!is_versailles_control(versailles_objective_space())) { - log_br() - log_h3("Versailles - Removed") - logi("C" + versailles_objective_card()) - game.blue_objective = 0 +function goto_objective_card_remove() { + game.state = "objective_card_remove" + if (game.red_objective && !is_commune_control(commune_objective_space())) + return + if (game.blue_objective && !is_versailles_control(versailles_objective_space())) + return + goto_objective_card_play() +} + +states.objective_card_remove = { + prompt() { + view.prompt = "Objective Card Scoring: Remove failed Objective Cards." + if (!is_commune_control(commune_objective_space())) + gen_action_card(commune_objective_card()) + if (!is_versailles_control(versailles_objective_space())) + gen_action_card(versailles_objective_card()) + }, + card(c) { + if (c === commune_objective_card()) { + log_h3("Commune - Failed") + logi("C" + commune_objective_card()) + game.red_objective = 0 + } + if (c === versailles_objective_card()) { + log_h3("Versailles - Failed") + logi("C" + versailles_objective_card()) + game.blue_objective = 0 + } + goto_objective_card_remove() } - resume_objective_card_events() } -function resume_objective_card_events() { +function goto_objective_card_play() { clear_undo() - log_br() - let c = commune_objective_card() - let v = versailles_objective_card() - if (c || v) { + if (commune_objective_card() || versailles_objective_card()) { game.active = game.initiative - game.state = "objective_card_events" + game.state = "objective_card_play" } else { delete game.reveal_objectives start_round() } } -states.objective_card_events = { +states.objective_card_play = { prompt() { - view.prompt = "Objective Card Events!" + view.prompt = "Objective Card Scoring: Play successful Objective Cards." let c = commune_objective_card() if (c) @@ -2106,7 +2145,7 @@ states.objective_card_events = { game.red_objective = 0 game.red_fulfilled += 1 game.active = COMMUNE - log_h3("Commune - Objective") + log_h3("Commune - Event") logi("C" + c) goto_play_event(c) } @@ -2114,7 +2153,7 @@ states.objective_card_events = { game.blue_objective = 0 game.blue_fulfilled += 1 game.active = VERSAILLES - log_h3("Versailles - Objective") + log_h3("Versailles - Event") logi("C" + c) goto_play_event(c) } @@ -2316,7 +2355,7 @@ function end_event() { } function end_crisis_breach_objective() { - resume_objective_card_events() + goto_objective_card_play() } function goto_vm(proc) { -- cgit v1.2.3