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 <noreply@anthropic.com>
This commit is contained in:
parent
cdb17ca8ca
commit
8e0aa5e1be
2 changed files with 29 additions and 3 deletions
|
|
@ -1 +1 @@
|
|||
3c52b166be3edaf62db87a9d6e88bb4435720f75
|
||||
cdb17ca8ca503ba0d58c8d17cb9a93447e4813b7
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue