From d018a3ace9027d238cfaa0410244cbeff4aef90a Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 11 Oct 2024 18:28:47 +0200 Subject: Fix regroup and piracy. --- rules.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/rules.js b/rules.js index af0c0ac..0a87053 100644 --- a/rules.js +++ b/rules.js @@ -1984,6 +1984,7 @@ states.sea_move_to = { if (game.active === game.piracy && is_contested_area(to)) { // Can attack with piracy, but no port-to-port bonus. + // TODO: blocks attacking same area from another sea should go into reserve log_move_continue(to, ATTACK_MARK) set_add(game.is_pirate, game.who) if (!game.attacker[to]) @@ -2714,10 +2715,6 @@ function goto_regroup() { clear_undo() } -function is_attacker_with_piracy() { - return game.active === game.piracy && game.active === game.attacker[game.where] -} - states.regroup = { prompt: function (view, current) { if (is_inactive_player(current)) @@ -2727,9 +2724,8 @@ states.regroup = { gen_action(view, 'end_regroup') for (let b = 0; b < block_count; ++b) { if (game.location[b] === game.where && !set_has(game.dead, b)) { - if (is_attacker_with_piracy()) { - if (set_has(game.is_pirate, b)) - gen_action(view, 'block', b) + if (game.active === game.piracy && set_has(game.is_pirate, b)) { + gen_action(view, 'block', b) } else { if (can_block_regroup(b)) gen_action(view, 'block', b) @@ -2753,7 +2749,7 @@ states.regroup = { states.regroup_to = { prompt: function (view, current) { - if (is_attacker_with_piracy() && set_has(game.is_pirate, game.who)) { + if (game.active === game.piracy && set_has(game.is_pirate, game.who)) { if (is_inactive_player(current)) return view.prompt = "Waiting for " + game.active + " to regroup." view.prompt = "Regroup: Move the army to a friendly or vacant area in the same sea zone." -- cgit v1.2.3