//! 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::log_depths`). use super::card::TriggerOn; use super::world::{EntityId, PlayerId}; #[derive(Debug, Clone, PartialEq, Eq)] pub enum Event { /// `id` entered the board. `by` is the minion whose triggered ability put it there (the /// trigger resolving when it entered), or `None` for a spell, a play or a summon from /// outside a Sequence. Module 10: SpellGrid puts it on `by`'s grid tile. The course's log /// doesn't show `by`. Summoned { id: EntityId, by: Option, }, Damaged { target: EntityId, amount: i32, }, Triggered { source: EntityId, on: TriggerOn, }, Drew { player: PlayerId, id: EntityId, }, Fatigue { player: PlayerId, }, ArmorGained { player: PlayerId, amount: i32, }, /// Armor absorbed `amount` of a Damage to `player`'s hero. The `Damaged` that follows /// shows the full amount. ArmorLost { player: PlayerId, amount: i32, }, StatsChanged { id: EntityId, attack: i32, health: i32, }, 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. Destroyed { id: EntityId, before: Option, }, DeathPhase { round: u32, }, /// A minion was played from hand (it has just entered the board). Its Battlecry answers this. Played { id: EntityId, }, /// Module 12: `player`'s turn ended. Their minions' end of turn triggers answer this. TurnEnded { player: PlayerId, }, /// Module 10: `source`'s effect asked for `word` to be written on its grid tile. /// Part I has no grid: it only records the request. SpellGrid reads it when the /// Sequence ends. TextSpawned { source: EntityId, word: String, }, }