summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-10-11 18:28:47 +0200
committerTor Andersson <tor@ccxvii.net>2024-10-11 18:28:47 +0200
commitd018a3ace9027d238cfaa0410244cbeff4aef90a (patch)
treec6f55962d4d7744e8110bb9b9cf40a036e4febae
parenta97f89375f6ff56e9a4ddec0ddfbcd40f6509ed0 (diff)
downloadrichard-iii-master.tar.gz
Fix regroup and piracy.HEADmaster
-rw-r--r--rules.js12
1 files 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."