Skip to main content

manabrew_engine/agent/
notification.rs

1use crate::agent::GameLogEvent;
2use crate::agent::ManaCostAction;
3use crate::ids::{CardId, PlayerId};
4use forge_foundation::PhaseType;
5
6#[derive(Debug, Clone)]
7pub enum GameNotification {
8    Event(GameLogEvent),
9    CardPlayed {
10        player: PlayerId,
11        card_id: CardId,
12        card_name: String,
13        set_code: String,
14    },
15    TurnChanged {
16        active_player: PlayerId,
17        turn_number: u32,
18    },
19    PhaseChanged {
20        phase: PhaseType,
21    },
22    PriorityChanged {
23        player: PlayerId,
24    },
25    StateChanged,
26    SnapshotCreated {
27        checkpoint_id: u64,
28        label: String,
29    },
30    ManaPaymentResolved {
31        player: PlayerId,
32        actions: Vec<ManaCostAction>,
33    },
34    ActivatedAbilityPaymentFailed {
35        player: PlayerId,
36        card_id: CardId,
37        ability_index: usize,
38    },
39    /// Dice were rolled. Display-only — sent for UI animation/feedback.
40    /// Mirrors Java's `PlayerController.notifyOfRoll`.
41    DiceRolled {
42        player: PlayerId,
43        sides: i32,
44        /// Natural (pre-modifier) values, one per kept die.
45        natural_results: Vec<i32>,
46        /// Final values after modifiers/exchanges, one per kept die.
47        final_results: Vec<i32>,
48        /// Rolls dropped before modification (ignore-lowest, choose-to-ignore).
49        ignored_rolls: Vec<i32>,
50        /// Display name of the card that triggered the roll, if any.
51        source_card_name: Option<String>,
52    },
53    /// Each player rolled a die at the start of the game; the highest
54    /// roller goes first. Sent once with every player's final roll so
55    /// the UI can animate them side-by-side.
56    FirstPlayerRoll {
57        sides: i32,
58        /// One entry per player in `player_order`, paired with their roll.
59        rolls: Vec<(PlayerId, i32)>,
60        /// The player who won the roll-off (after any tiebreaks).
61        winner: PlayerId,
62    },
63    GameOver,
64}