From f3a7a5e0d93bafcab11c6ce49de2dff64de15c77 Mon Sep 17 00:00:00 2001 From: jedarden Date: Tue, 26 May 2026 13:54:37 -0400 Subject: [PATCH] fix(engine): add combat_deaths array to replay JSON top level MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per plan §7.1, the replay format should include combat_deaths array at the top level for easy access. Previously this field only existed inside the Result object, causing all replays to show combat_deaths: null at the top level despite having combat_death events in the turns array. Changes: - Add CombatDeaths []int field to Replay struct with json tag - Populate CombatDeaths in Finalize() from result.CombatDeaths Closes: bf-36tko Co-Authored-By: Claude Opus 4.7 --- engine/replay.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engine/replay.go b/engine/replay.go index 5ad9c66..bd53286 100644 --- a/engine/replay.go +++ b/engine/replay.go @@ -20,6 +20,7 @@ type Replay struct { Turns []ReplayTurn `json:"turns"` WinProb []WinProbEntry `json:"win_prob,omitempty"` CriticalMoments []CriticalMoment `json:"critical_moments,omitempty"` + CombatDeaths []int `json:"combat_deaths,omitempty"` // bots killed in combat per player (focus-fire) } // ReplayPlayer represents player info in a replay. @@ -204,6 +205,10 @@ func (rw *ReplayWriter) Finalize(result *MatchResult) { rw.replay.EndTime = time.Now().UTC() rw.replay.Result = result rw.replay.Turns = rw.turns + // Copy combat_deaths to top level for easy access (plan §7.1) + if result != nil { + rw.replay.CombatDeaths = result.CombatDeaths + } } // GetReplay returns the completed replay.