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