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, }); } }