diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-05-05 12:03:11 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-05-05 12:03:11 +0200 |
commit | a2d1bfbbd8ffdab0497455fa6d5cb364877a55ad (patch) | |
tree | ea17823583c6d8b8131d571590eb074d68b4e80c /rules.ts | |
parent | c23ee443691edc8d3b756ebef4275e8a93991755 (diff) | |
download | plantagenet-a2d1bfbbd8ffdab0497455fa6d5cb364877a55ad.tar.gz |
skip hit assignment if zero hits or no targets
Diffstat (limited to 'rules.ts')
-rw-r--r-- | rules.ts | 24 |
1 files changed, 18 insertions, 6 deletions
@@ -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]) { |