summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js8
1 files 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."