diff options
author | Tor Andersson <tor@ccxvii.net> | 2025-02-03 11:37:54 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2025-02-05 23:36:56 +0100 |
commit | 2469f0a6da414c5ad15256b3c4fe22bc11660e9d (patch) | |
tree | 33f6ed6476e0c181b1ee5b1200a70b10699e56e1 | |
parent | 9c7f01b27688be698448e67428f892884014e2a1 (diff) | |
download | julius-caesar-2469f0a6da414c5ad15256b3c4fe22bc11660e9d.tar.gz |
Fix sea retreat limit when both players can retreat by sea.
-rw-r--r-- | rules.js | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -35,6 +35,8 @@ const BOTH = "Both" const CAESAR = "Caesar" const POMPEIUS = "Pompeius" +const PLAYER_MASK = { Caesar: 1, Pompeius: 2 } + const B_CAESAR = find_block("Caesar") const B_POMPEIUS = find_block("Pompeius") const B_CLEOPATRA = find_block("Cleopatra") @@ -238,7 +240,7 @@ function deal_cards(deck, n) { function reset_road_limits() { game.sea_moved = [] - game.sea_retreated = false + game.sea_retreated = 0 game.limits = [] } @@ -700,7 +702,7 @@ function can_block_continue(b, last_from) { } function can_sea_retreat(who, _from, to) { - if (game.sea_retreated) + if (game.sea_retreated & PLAYER_MASK[game.active]) return false if (BLOCKS[who].type === "navis") return false @@ -2299,7 +2301,7 @@ states.retreat = { if (is_sea(to) && !is_navis(game.who)) { push_undo() move_to(game.who, from, to) - game.sea_retreated = true + game.sea_retreated |= PLAYER_MASK[game.active] game.state = "sea_retreat" } else { move_to(game.who, from, to) |