diff options
-rw-r--r-- | rules.js | 26 |
1 files changed, 14 insertions, 12 deletions
@@ -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 |