From 2469f0a6da414c5ad15256b3c4fe22bc11660e9d Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 3 Feb 2025 11:37:54 +0100 Subject: Fix sea retreat limit when both players can retreat by sea. --- rules.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rules.js b/rules.js index fb7e342..56e0ff2 100644 --- a/rules.js +++ b/rules.js @@ -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) -- cgit v1.2.3