summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-07-17 13:47:36 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-16 19:19:39 +0100
commitc39b3aaed8203fcc7565297532a0695302260e22 (patch)
tree3a62bfadd56b25bfb3f91c393b310c46a67f49af /rules.js
parent9ff6d22ddbd0e5690d5164694c9adf0158da893b (diff)
downloadcrusader-rex-c39b3aaed8203fcc7565297532a0695302260e22.tar.gz
crusader: Fix regroup away test, again...
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/rules.js b/rules.js
index ba7a342..1f50b3e 100644
--- a/rules.js
+++ b/rules.js
@@ -2360,11 +2360,15 @@ function goto_combat_round(new_combat_round) {
let was_contested = is_contested_battle_field();
- game.active = game.attacker[game.where];
- if (game.combat_round === 1 && count_friendly_in_field_excluding_reserves(game.where) === 0) {
- log("Combat round skipped because main attack regrouped away.");
- console.log("MAIN ATTACK REGROUPED AWAY, SKIP ROUND 1");
- game.combat_round = 2;
+ // If the main attack regroups away from a new siege while reinforcements
+ // are on the way, we need to skip the first combat round.
+ if (game.combat_round === 1 && is_under_siege(game.where)) {
+ game.active = besieging_player(game.where);
+ if (count_friendly_in_field_excluding_reserves(game.where) === 0) {
+ log("Combat round skipped because main attack regrouped away.");
+ console.log("MAIN ATTACK REGROUPED AWAY, SKIP ROUND 1");
+ game.combat_round = 2;
+ }
}
console.log("COMBAT ROUND", game.combat_round);