summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2025-02-23 13:24:48 +0100
committerTor Andersson <tor@ccxvii.net>2025-02-23 13:24:48 +0100
commit0fe8fe6853aa1340a16d95ff2483e70a2d7ee0db (patch)
tree5f0eafbcc65fb56b8d53d722949c3ef7612f0dc2
parente6fb277ad5920229486f081e4b6738f9fb72d35a (diff)
downloadplantagenet-0fe8fe6853aa1340a16d95ff2483e70a2d7ee0db.tar.gz
Use multi-active state instead of Both.
-rw-r--r--rules.js10
-rw-r--r--rules.ts12
2 files changed, 11 insertions, 11 deletions
diff --git a/rules.js b/rules.js
index eedc4b0..f938253 100644
--- a/rules.js
+++ b/rules.js
@@ -3046,7 +3046,7 @@ function goto_levy_discard_events() {
function goto_campaign_plan() {
game.turn++;
log_h1("Campaign " + current_turn_name());
- set_active(BOTH);
+ set_active([P1, P2]);
game.state = "campaign_plan";
game.plan_y = [];
game.plan_l = [];
@@ -3094,11 +3094,11 @@ states.campaign_plan = {
}
},
end_plan(_, current) {
- if (game.active === BOTH) {
+ if (game.active.length === 2) {
if (current === YORK)
- set_active(LANCASTER);
+ set_active([LANCASTER]);
else
- set_active(YORK);
+ set_active([YORK]);
}
else {
end_campaign_plan();
@@ -11415,7 +11415,7 @@ exports.view = function (state, current) {
if (game.state === "game_over") {
view.prompt = game.victory;
}
- else if (current === "Observer" || (game.active !== current && game.active !== BOTH)) {
+ else if (game.active !== current && !game.active.includes(current)) {
let inactive = states[game.state].inactive || game.state;
view.prompt = `Waiting for ${game.active} \u2014 ${inactive}.`;
}
diff --git a/rules.ts b/rules.ts
index 1fd8a33..6e2c775 100644
--- a/rules.ts
+++ b/rules.ts
@@ -8,7 +8,7 @@ declare function require(name: string): any
declare let exports: any
type Side = "York" | "Lancaster"
-type Player = "York" | "Lancaster" | "Both" | "None"
+type Player = "York" | "Lancaster" | "None" | "Both" | string[]
type Card = number & { TAG: "Card" }
type Locale = number & { TAG: "Locale" }
type Lord = number & { TAG: "Lord" }
@@ -3736,7 +3736,7 @@ function goto_campaign_plan() {
log_h1("Campaign " + current_turn_name())
- set_active(BOTH)
+ set_active([ P1, P2 ])
game.state = "campaign_plan"
game.plan_y = []
game.plan_l = []
@@ -3788,11 +3788,11 @@ states.campaign_plan = {
}
},
end_plan(_, current) {
- if (game.active === BOTH) {
+ if (game.active.length === 2) {
if (current === YORK)
- set_active(LANCASTER)
+ set_active([ LANCASTER ])
else
- set_active(YORK)
+ set_active([ YORK ])
} else {
end_campaign_plan()
}
@@ -13142,7 +13142,7 @@ exports.view = function (state, current) {
if (game.state === "game_over") {
view.prompt = game.victory
- } else if (current === "Observer" || (game.active !== current && game.active !== BOTH)) {
+ } else if (game.active !== current && !game.active.includes(current)) {
let inactive = states[game.state].inactive || game.state
view.prompt = `Waiting for ${game.active} \u2014 ${inactive}.`
} else {