summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2025-04-30 00:37:27 +0200
committerTor Andersson <tor@ccxvii.net>2025-04-30 00:37:27 +0200
commit304f73f0b7b84168000b26fb87bceeb958bf8ad5 (patch)
treeb761a7407c298db0cd1013b311011e46a0fdc534
parent32612d2d5385866fbf8e3cb490d8ff75d6929bcc (diff)
downloadhammer-of-the-scots-master.tar.gz
Multi-active instead of Both.HEADmaster
-rw-r--r--rules.js26
1 files changed, 14 insertions, 12 deletions
diff --git a/rules.js b/rules.js
index 5a8c9af..ffd2b6f 100644
--- a/rules.js
+++ b/rules.js
@@ -23,10 +23,14 @@ const PID = { "": 0, Scotland: 1, England: 2 }
const UNPID = [ "", "Scotland", "England" ]
const OBSERVER = "Observer"
-const BOTH = "Both"
const ENGLAND = "England"
const SCOTLAND = "Scotland"
+const MA_BOTH = [ "England", "Scotland" ]
+const MA_ENGLAND = [ "England" ]
+const MA_SCOTLAND = [ "Scotland" ]
+
+
const NOWHERE = 0
const E_BAG = area_index["E. Bag"]
const S_BAG = area_index["S. Bag"]
@@ -165,8 +169,12 @@ function print_turn_log(verb) {
print_turn_log_no_active(game.active + " " + verb + ":")
}
+function is_active_player(current) {
+ return current === game.active || (Array.isArray(game.active) && game.active.includes(current))
+}
+
function is_inactive_player(current) {
- return current === OBSERVER || (game.active !== current && game.active !== BOTH)
+ return !is_active_player(current)
}
function remove_from_array(array, item) {
@@ -914,18 +922,18 @@ function goto_card_phase() {
game.s_card = 0
game.show_cards = 0
game.state = 'play_card'
- game.active = BOTH
+ game.active = MA_BOTH
}
function resume_play_card() {
if (game.s_card > 0 && game.e_card > 0)
reveal_cards()
else if (game.s_card > 0)
- game.active = ENGLAND
+ game.active = MA_ENGLAND
else if (game.e_card > 0)
- game.active = SCOTLAND
+ game.active = MA_SCOTLAND
else
- game.active = BOTH
+ game.active = MA_BOTH
}
states.play_card = {
@@ -3173,12 +3181,6 @@ function observer_hand() {
return hand
}
-exports.dont_snap = function(state) {
- if (state.state === "play_card" && state.active !== BOTH)
- return true
- return false
-}
-
exports.view = function(state, current) {
game = state