summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-11-16 20:28:22 +0100
committerTor Andersson <tor@ccxvii.net>2022-11-30 13:26:51 +0100
commit5f23b20f6f9acf40a778912458b889f518ff1aa7 (patch)
tree3aec73656661b7668a59e2556e82aa3690fb9bd7 /rules.js
parenta6ea23b14c512e57b6d28150b5766147cd354319 (diff)
downloadcrusader-rex-5f23b20f6f9acf40a778912458b889f518ff1aa7.tar.gz
Fix delay hits being skipped when a battle ends early after harrying.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/rules.js b/rules.js
index 89fb28c..9543e7c 100644
--- a/rules.js
+++ b/rules.js
@@ -2822,6 +2822,10 @@ function resume_field_battle() {
game.active = game.attacker[game.where]
if (is_friendly_field(game.where)) {
+ if (game.delay_hits && game.hits > 0) {
+ game.active = enemy(save_active)
+ return goto_field_battle_hits()
+ }
print_retreat_summary()
log("Field battle won by " + game.active + ".")
game.show_field = 0
@@ -2829,6 +2833,10 @@ function resume_field_battle() {
}
if (is_enemy_field(game.where)) {
+ if (game.delay_hits && game.hits > 0) {
+ game.active = enemy(save_active)
+ return goto_field_battle_hits()
+ }
game.active = enemy(game.active)
print_retreat_summary()
log("Field battle won by " + game.active + ".")
@@ -2837,12 +2845,20 @@ function resume_field_battle() {
}
if (is_enemy_battle_field()) {
+ if (game.delay_hits && game.hits > 0) {
+ game.active = enemy(save_active)
+ return goto_field_battle_hits()
+ }
print_retreat_summary()
log("Attacking main force was eliminated.")
return next_combat_round()
}
if (is_friendly_battle_field()) {
+ if (game.delay_hits && game.hits > 0) {
+ game.active = enemy(save_active)
+ return goto_field_battle_hits()
+ }
print_retreat_summary()
log("Defending main force was eliminated.")
log("Battlefield control changed.")