From ca43b789e4ad9ffd866cd10ab57f0e26bc87860d Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 12 Aug 2023 21:28:35 +0200 Subject: Fix battle victory when attacker is eliminated but did more hits total. Oops! --- rules.js | 4 ++-- 1 file 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() -- cgit v1.2.3