fix(engine): emit zone_death events instead of bot_died with reason

Per plan §3.7.1, zone kills should emit dedicated zone_death events
for tracking, not generic bot_died events with a reason field.

Changes:
- executeZone() now directly emits EventZoneDeath instead of calling
  KillBot() which would emit EventBotDied with reason="zone"
- Event includes bot_id, owner, position fields (consistent with
  combat_death and collision_death events)

Verification:
- Generated test replay shows zone_death events with correct schema
- All Go tests pass

Closes: bf-xauy

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
jedarden 2026-05-25 14:30:48 -04:00
parent 41d868b5c1
commit f0a0673eca

View file

@ -146,7 +146,24 @@ func (gs *GameState) executeZone() {
// Calculate distance from zone center (accounting for toroidal wrap)
dist2 := gs.Grid.Distance2(b.Position, gs.ZoneCenter)
if dist2 > gs.ZoneRadius*gs.ZoneRadius {
gs.KillBot(b, "zone")
// Mark bot as dead
b.Alive = false
gs.DeadBots = append(gs.DeadBots, b)
if b.Owner < len(gs.Players) {
gs.Players[b.Owner].BotCount--
}
// Emit zone_death event
gs.Events = append(gs.Events, Event{
Type: EventZoneDeath,
Turn: gs.Turn,
Details: map[string]interface{}{
"bot_id": b.ID,
"owner": b.Owner,
"position": b.Position,
},
})
}
}
}