summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-08-12 21:28:35 +0200
committerTor Andersson <tor@ccxvii.net>2023-08-12 21:28:35 +0200
commitca43b789e4ad9ffd866cd10ab57f0e26bc87860d (patch)
treef10d06d47918c5242f16adb3c2f6874ca98269c8
parent6f2230d57630d51aaa3a1929c686f5e2a48d79d1 (diff)
downloadtime-of-crisis-ca43b789e4ad9ffd866cd10ab57f0e26bc87860d.tar.gz
Fix battle victory when attacker is eliminated but did more hits total.
Oops!
-rw-r--r--rules.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/rules.js b/rules.js
index 3c1e44b..90f42d4 100644
--- a/rules.js
+++ b/rules.js
@@ -4509,7 +4509,7 @@ states.combat_victory = {
let ae = is_attacker_eliminated()
if (de && ae)
prompt("Combat: There is no winner.")
- else if (de || game.combat.dtaken + game.combat.staken + game.combat.cavalry > game.combat.ataken)
+ else if (!ae && (de || game.combat.dtaken + game.combat.staken + game.combat.cavalry > game.combat.ataken))
prompt("Combat: You win the battle!")
else
prompt("Combat: Defenders win the battle!")
@@ -4528,7 +4528,7 @@ function goto_combat_victory() {
let ae = is_attacker_eliminated()
if (de && ae)
goto_combat_no_victory()
- else if (de || game.combat.dtaken + game.combat.staken + game.combat.cavalry > game.combat.ataken)
+ else if (!ae && (de || game.combat.dtaken + game.combat.staken + game.combat.cavalry > game.combat.ataken))
goto_combat_victory_attacker()
else
goto_combat_victory_defender()