From 70520cf7f360d8f2bbce1557ea1c40dbd53710f4 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 9 Jul 2023 20:11:47 +0200 Subject: Fix regroup with piracy and _not_ attacker. --- rules.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rules.js b/rules.js index 07553c1..38ade69 100644 --- a/rules.js +++ b/rules.js @@ -2696,6 +2696,10 @@ function goto_regroup() { clear_undo() } +function is_attacker_with_piracy() { + game.active === game.piracy && game.active === game.attacker[game.where] +} + states.regroup = { prompt: function (view, current) { if (is_inactive_player(current)) @@ -2705,7 +2709,7 @@ states.regroup = { gen_action(view, 'end_regroup') for (let b = 0; b < block_count; ++b) { if (game.location[b] === game.where) { - if (game.active === game.piracy) { + if (is_attacker_with_piracy()) { if (set_has(game.is_pirate, b)) gen_action(view, 'block', b) } else { @@ -2731,7 +2735,7 @@ states.regroup = { states.regroup_to = { prompt: function (view, current) { - if (game.active === game.piracy && set_has(game.is_pirate, game.who)) { + if (is_attacker_with_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