From 8e0aa5e1bee7365bbc32dec44e028d7a07a2ceed Mon Sep 17 00:00:00 2001 From: jedarden Date: Fri, 22 May 2026 14:48:19 -0400 Subject: [PATCH] Emit combat_death events with killers array in executeCombat Modified executeCombat to emit EventCombatDeath events with a killers array containing all enemy bots within attack radius of the killed bot. Each killer entry includes bot_id, owner, and position, matching the replay schema specification. Co-Authored-By: Claude Opus 4.7 --- .needle-predispatch-sha | 2 +- engine/turn.go | 30 ++++++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/.needle-predispatch-sha b/.needle-predispatch-sha index a349526..b2c929f 100644 --- a/.needle-predispatch-sha +++ b/.needle-predispatch-sha @@ -1 +1 @@ -3c52b166be3edaf62db87a9d6e88bb4435720f75 +cdb17ca8ca503ba0d58c8d17cb9a93447e4813b7 diff --git a/engine/turn.go b/engine/turn.go index 5f9ee6c..4b2e155 100644 --- a/engine/turn.go +++ b/engine/turn.go @@ -157,10 +157,36 @@ func (gs *GameState) executeCombat() { } } - // Kill the dead bots + // Kill the dead bots and emit combat_death events for _, b := range gs.Bots { if dead[b.ID] { - gs.KillBot(b, "combat") + b.Alive = false + gs.DeadBots = append(gs.DeadBots, b) + + if b.Owner < len(gs.Players) { + gs.Players[b.Owner].BotCount-- + } + + // Build killers array (enemies within attack radius) + var killers []map[string]interface{} + for _, e := range botsInRadius[b.ID] { + killers = append(killers, map[string]interface{}{ + "bot_id": e.ID, + "owner": e.Owner, + "position": e.Position, + }) + } + + gs.Events = append(gs.Events, Event{ + Type: EventCombatDeath, + Turn: gs.Turn, + Details: map[string]interface{}{ + "bot_id": b.ID, + "owner": b.Owner, + "position": b.Position, + "killers": killers, + }, + }) } } }