// What happened, in order. The engine records an event each time it changes the game. // The world also keeps the nesting depth each event was recorded at (`World.logDepths`). import type { TriggerOn } from "./card"; import type { EntityId, PlayerId } from "./world"; export type Event = | { type: "Summoned"; id: EntityId } | { type: "Damaged"; target: EntityId; amount: number } | { type: "Triggered"; source: EntityId; on: TriggerOn } | { type: "Drew"; player: PlayerId; id: EntityId } | { type: "Fatigue"; player: PlayerId } | { type: "ArmorGained"; player: PlayerId; amount: number } /** Armor absorbed `amount` of a Damage to `player`'s hero. The `Damaged` that follows shows the full amount. */ | { type: "ArmorLost"; player: PlayerId; amount: number } | { type: "StatsChanged"; id: EntityId; attack: number; health: number } | { type: "SpellCast"; card: string } /** * A Death Event: the Death Creation Step moved `id` from play to the graveyard. * `before` is the nearest minion to its right that did not die in the same step, if any: * its Deathrattle summons immediately left of that minion, or at the right end. It is a * handle because a board index goes stale when a minion further left dies in the same step. */ | { type: "Destroyed"; id: EntityId; before: EntityId | undefined } | { type: "DeathPhase"; round: number } /** A minion was played from hand (it has just entered the board). Its Battlecry answers this. */ | { type: "Played"; id: EntityId };