Compare commits

..
3 Commits
Author SHA1 Message Date
cthangover 9e4d07df45 Mod cover 2026-10-22 17:09:50 +02:00
cthangover 1018c90c25 Line endings: LF everywhere
.gitattributes forces LF (CRLF only for .bat/.cmd), core.autocrlf is off;
files that differed only by CRLF are normalized.
2026-10-21 13:29:57 +02:00
cthangover 392b1caf0a 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.
2026-10-21 13:22:17 +02:00
3 changed files with 40 additions and 4 deletions

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
# Line endings: LF everywhere, on every OS, whatever core.autocrlf says.
* text=auto eol=lf
# cmd.exe misreads labels and goto in LF batch files, so they stay CRLF.
*.bat text eol=crlf
*.cmd text eol=crlf
# Binaries: never converted, never diffed as text.
*.png binary
*.jpg binary
*.jpeg binary
*.webp binary
*.svg text
*.ogg binary
*.wav binary
*.mp3 binary
*.ttf binary
*.otf binary
*.woff binary
*.woff2 binary
*.dll binary
*.so binary
*.dylib binary
*.pdb binary
*.exe binary
*.zip binary
*.pck binary
*.moc3 binary
*.res binary
*.scn binary
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

+10 -4
View File
@@ -292,7 +292,7 @@ namespace Cthangover.Core.Battle
return; return;
IsDestroyed = true; IsDestroyed = true;
_battleSpeedControl?.ResetToNormal(); _battleSpeedControl?.ResetToNormal();
ClearBattle(); ClearBattle("defeat");
deadground?.Show(); deadground?.Show();
} }
@@ -307,7 +307,7 @@ namespace Cthangover.Core.Battle
return; return;
IsDestroyed = true; IsDestroyed = true;
_battleSpeedControl?.ResetToNormal(); _battleSpeedControl?.ResetToNormal();
ClearBattle(); ClearBattle("victory");
winground?.Show(); winground?.Show();
} }
@@ -346,7 +346,13 @@ namespace Cthangover.Core.Battle
} }
} }
private void ClearBattle() /// <summary>
/// Stops the battle and publishes <see cref="BattleEndedEvent"/>. The
/// outcome is passed in by the caller: both screens set
/// <see cref="IsDestroyed"/> before clearing, so it cannot be derived
/// from that flag (it used to be, and every battle reported "defeat").
/// </summary>
private void ClearBattle(string result)
{ {
BattleActionMachine?.StopMachine(); BattleActionMachine?.StopMachine();
ActiveCharacter = null; ActiveCharacter = null;
@@ -355,7 +361,7 @@ namespace Cthangover.Core.Battle
OnBattleCleared?.Invoke(); OnBattleCleared?.Invoke();
ModEventBus.Publish(new BattleEndedEvent ModEventBus.Publish(new BattleEndedEvent
{ {
Result = IsDestroyed ? "defeat" : "victory", Result = result,
}); });
} }
} }