summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-07-09 20:11:47 +0200
committerTor Andersson <tor@ccxvii.net>2023-07-09 20:11:47 +0200
commit70520cf7f360d8f2bbce1557ea1c40dbd53710f4 (patch)
tree3426ebceb95e5f40f5c1b7f956c5dddeb63a8a69 /rules.js
parent2b1eaf95c116ce95751b44912e0c0e804bbcbce8 (diff)
downloadrichard-iii-70520cf7f360d8f2bbce1557ea1c40dbd53710f4.tar.gz
Fix regroup with piracy and _not_ attacker.
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."