summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rules.ts24
1 files changed, 18 insertions, 6 deletions
diff --git a/rules.ts b/rules.ts
index 9f880e0..24d11a2 100644
--- a/rules.ts
+++ b/rules.ts
@@ -7502,9 +7502,22 @@ states.final_charge = {
// === 4.4.2 BATTLE ROUNDS: ROLL BY HIT (PROTECTION ROLL, VALOUR RE-ROLL, FORCES ROUT) ===
+function no_remaining_targets() {
+ for (let pos of game.battle.engagements[0]) {
+ let lord = game.battle.array[pos]
+ if (is_friendly_lord(lord))
+ if (lord_has_unrouted_units(lord))
+ return false
+ }
+ return true
+}
+
function goto_defender_assign_hits() {
set_active_defender()
- goto_assign_hits()
+ if (game.battle.ahits === 0 || no_remaining_targets())
+ end_defender_assign_hits()
+ else
+ game.state = "assign_hits"
}
function end_defender_assign_hits() {
@@ -7514,7 +7527,10 @@ function end_defender_assign_hits() {
function goto_attacker_assign_hits() {
set_active_attacker()
- goto_assign_hits()
+ if (game.battle.dhits === 0 || no_remaining_targets())
+ end_attacker_assign_hits()
+ else
+ game.state = "assign_hits"
}
function end_attacker_assign_hits() {
@@ -7522,10 +7538,6 @@ function end_attacker_assign_hits() {
end_battle_strike_step()
}
-function goto_assign_hits() {
- game.state = "assign_hits"
-}
-
function prompt_hit_forces() {
let done = true
for (let pos of game.battle.engagements[0]) {