From 9a894d97b62a72d42bf77b12178b1127ad67065c Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 27 Feb 2025 12:55:45 +0100 Subject: Use multi-active state instead of "Both". --- rules.js | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/rules.js b/rules.js index 45c2126..2ac9a4a 100644 --- a/rules.js +++ b/rules.js @@ -979,7 +979,7 @@ function start_round() { game.red_objective = [ game.objective_deck.pop(), game.objective_deck.pop() ] game.blue_objective = [ game.objective_deck.pop(), game.objective_deck.pop() ] - game.active = "Both" + game.active = [ COMMUNE, VERSAILLES ] game.state = "choose_objective_card" } @@ -1005,11 +1005,11 @@ states.choose_objective_card = { if (typeof game.red_objective === "number" && typeof game.blue_objective === "number") end_choose_objective_card() else if (typeof game.red_objective === "number") - game.active = VERSAILLES + game.active = [ VERSAILLES ] else if (typeof game.blue_objective === "number") - game.active = COMMUNE + game.active = [ COMMUNE ] else - game.active = "Both" + game.active = [ COMMUNE, VERSAILLES ] }, } @@ -2355,18 +2355,18 @@ function goto_final_crisis() { game.blue_final = 0 game.blue_set_aside = [] - game.active = "Both" + game.active = [ COMMUNE, VERSAILLES ] game.state = "final_crisis_discard" resume_final_crisis_discard() } function resume_final_crisis_discard() { if (game.red_hand.length > game.round && game.blue_hand.length > game.round) - game.active = "Both" + game.active = [ COMMUNE, VERSAILLES ] else if (game.red_hand.length > game.round) - game.active = COMMUNE + game.active = [ COMMUNE ] else if (game.blue_hand.length > game.round) - game.active = VERSAILLES + game.active = [ VERSAILLES ] else { clear_undo() game.round = 4 @@ -3794,12 +3794,6 @@ function draw_strategy_card() { // === VIEW === -exports.dont_snap = function(state) { - if (state.state === "choose_objective_card" && state.active !== "Both") - return true - return false -} - exports.view = function (state, player) { game = state @@ -3859,7 +3853,7 @@ exports.view = function (state, player) { if (game.state === "game_over") { view.prompt = game.victory - } else if (player === "Observer" || (game.active !== player && game.active !== "Both")) { + } else if (game.active !== player && !game.active.includes(player)) { if (states[game.state]) { let inactive = states[game.state].inactive view.prompt = `Waiting for ${game.active} to ${inactive}...` -- cgit v1.2.3