diff options
author | Mischa Untaga <99098079+MischaU8@users.noreply.github.com> | 2023-11-19 13:41:23 +0100 |
---|---|---|
committer | Mischa Untaga <99098079+MischaU8@users.noreply.github.com> | 2023-11-19 13:41:23 +0100 |
commit | 1ab908062fad07cc2e950cc39d2ee61d9e51d1b5 (patch) | |
tree | 5dcf5fe036466d7ba0cb05704947f37e727582e1 | |
parent | 6380a2670773bc6ab784fa9282d8d296236957dd (diff) | |
download | votes-for-women-1ab908062fad07cc2e950cc39d2ee61d9e51d1b5.tar.gz |
cap buttons
-rw-r--r-- | rules.js | 29 |
1 files changed, 25 insertions, 4 deletions
@@ -18,6 +18,9 @@ const last_strategy_card = 116 const first_states_card = 117 const last_states_card = 128 +const MAX_SUPPORT_BUTTONS = 12 +const MAX_OPPOSITION_BUTTONS = 6 + const WEST = 1 const PLAINS = 2 const SOUTH = 3 @@ -250,6 +253,24 @@ function clear_red_x(u) { game.us_states[u] &= ~RED_X_MASK } +function count_green_checks() { + let result = 0 + for (let s = 1; s <= us_states_count; ++s) { + if (is_green_check(s)) + result += 1 + } + return result +} + +function count_red_xs() { + let result = 0 + for (let s = 1; s <= us_states_count; ++s) { + if (is_red_x(s)) + result += 1 + } + return result +} + function purple_cubes(u) { return (game.us_states[u] & PURPLE_MASK) >> PURPLE_SHIFT } @@ -1459,18 +1480,18 @@ states.vm_add_campaigner = { function increase_player_buttons(count=1) { log(`+${pluralize(count, 'button')}.`) if (game.active === SUF) { - game.support_buttons += count + game.support_buttons = Math.min(game.support_buttons + count, MAX_SUPPORT_BUTTONS) } else { - game.opposition_buttons += count + game.opposition_buttons = Math.min(game.opposition_buttons + count, MAX_OPPOSITION_BUTTONS) } } function decrease_player_buttons(count=1) { log(`-${pluralize(count, 'button')}.`) if (game.active === SUF) { - game.support_buttons -= count + game.support_buttons = Math.max(game.support_buttons - count, 0) } else { - game.opposition_buttons -= count + game.opposition_buttons = Math.max(game.opposition_buttons - count, 0) } } |