namespace SVSim.BattleNode.Protocol; /// /// Wire value of result on a WS BattleFinish frame. /// /// Maps to the client's NetworkBattleReceiver.RESULT_CODE enum at /// NetworkBattleReceiver.cs:963-986. Names are from the player's perspective: /// LifeWin = "I won by life", LifeLose = "I lost by life". Verified /// end-to-end via the path /// RESULT_CODEJudgeResultReceive switch → _finishEffectType → /// FinishBattleEffectInitiateGameEndSequence(hasWon): /// /// /// LifeWin = 101_finishEffectType = LOSE → /// InitiateGameEndSequence(hasWon: true) → PLAYER WIN UI /// LifeLose = 102_finishEffectType = WIN → /// InitiateGameEndSequence(hasWon: false) → PLAYER LOSE UI /// /// /// The SettingResultUI_SpecialResultTypeText switch passes the OPPONENT's /// outcome to set the secondary "by retire/by disconnect/etc." text — that's why /// the inner switch direction looks inverted (LifeWin → LOSE param, LifeLose → WIN /// param). The actual WIN/LOSE rendering happens in FinishBattleEffect via /// the !isPlayer flip at line 1315. /// /// /// Prior docstrings on this enum had the direction backwards (claimed LifeLose /// → WIN UI from a misread of the inner switch); see /// docs/audits/battle-node-sio-events-2026-06-02.md Addendum for the live /// reproduction that exposed the inversion. /// /// /// Always serialize as the int value, not the name; see the /// JsonNumberEnumConverter on . /// /// public enum BattleResult { /// Player won by reducing opponent's life to 0. Pushed to the winner /// on TurnEndFinal. Routes through the client switch to /// InitiateGameEndSequence(hasWon: true). LifeWin = 101, /// Player lost by their own life dropping to 0. Pushed to the loser on /// the opponent's TurnEndFinal. Prod TK2 capture at /// data_dumps/captures/battle-traffic_tk2_regular.ndjson:274 is a loss /// shown to the player from a real opponent's lethal. LifeLose = 102, /// Player won because opponent retired. Pushed to the survivor on /// Retire/Kill. Same player-perspective convention as the Life codes. RetireWin = 105, /// Player lost by retiring. Pushed to the retirer on Retire/Kill. RetireLose = 106, /// Survivor wins because the opponent's socket dropped without a graceful /// Retire. Pushed to the survivor by the /// RunAsync drop cascade. Client RESULT_CODE.DisconnectWin renders the /// "opponent disconnected" result text → player WIN UI. Same player-perspective /// convention as the Life/Retire codes. DisconnectWin = 201, }