From 392b1caf0ade470903404602c3cc93b43b6e9fc4 Mon Sep 17 00:00:00 2001 From: iisaev Date: Wed, 21 Oct 2026 13:22:17 +0200 Subject: [PATCH] Battle end reports the real outcome Both result screens set IsDestroyed before ClearBattle, which derived the result from that flag, so BattleEndedEvent.Result was always "defeat". The screens now pass the outcome in. --- src/BattleSceneContext.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/BattleSceneContext.cs b/src/BattleSceneContext.cs index 3d793a5..1f789fc 100644 --- a/src/BattleSceneContext.cs +++ b/src/BattleSceneContext.cs @@ -292,7 +292,7 @@ namespace Cthangover.Core.Battle return; IsDestroyed = true; _battleSpeedControl?.ResetToNormal(); - ClearBattle(); + ClearBattle("defeat"); deadground?.Show(); } @@ -307,7 +307,7 @@ namespace Cthangover.Core.Battle return; IsDestroyed = true; _battleSpeedControl?.ResetToNormal(); - ClearBattle(); + ClearBattle("victory"); winground?.Show(); } @@ -346,7 +346,13 @@ namespace Cthangover.Core.Battle } } - private void ClearBattle() + /// + /// Stops the battle and publishes . The + /// outcome is passed in by the caller: both screens set + /// before clearing, so it cannot be derived + /// from that flag (it used to be, and every battle reported "defeat"). + /// + private void ClearBattle(string result) { BattleActionMachine?.StopMachine(); ActiveCharacter = null; @@ -355,7 +361,7 @@ namespace Cthangover.Core.Battle OnBattleCleared?.Invoke(); ModEventBus.Publish(new BattleEndedEvent { - Result = IsDestroyed ? "defeat" : "victory", + Result = result, }); } }