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, Copy, PartialEq, Eq)]
7pub enum PlanarDieFace {
8    Planeswalk,
9    Chaos,
10    Blank,
11}
12impl PlanarDieFace {
13    pub fn parse(value: &str) -> Option<Self> {
14        match value.trim().to_ascii_lowercase().as_str() {
15            "planeswalk" => Some(Self::Planeswalk),
16            "chaos" => Some(Self::Chaos),
17            "blank" => Some(Self::Blank),
18            _ => None,
19        }
20    }
21}
22
23#[derive(Debug, Clone)]
24pub enum GameNotification {
25    Event(GameLogEvent),
26    CardPlayed {
27        player: PlayerId,
28        card_id: CardId,
29        card_name: String,
30        set_code: String,
31    },
32    TurnChanged {
33        active_player: PlayerId,
34        turn_number: u32,
35    },
36    PhaseChanged {
37        phase: PhaseType,
38    },
39    PriorityChanged {
40        player: PlayerId,
41    },
42    StateChanged,
43    SnapshotCreated {
44        checkpoint_id: u64,
45        label: String,
46    },
47    ManaPaymentResolved {
48        player: PlayerId,
49        actions: Vec<ManaCostAction>,
50    },
51    ActivatedAbilityPaymentFailed {
52        player: PlayerId,
53        card_id: CardId,
54        ability_index: usize,
55    },
56    /// Dice were rolled. Display-only — sent for UI animation/feedback.
57    /// Mirrors Java's `PlayerController.notifyOfRoll`.
58    DiceRolled {
59        player: PlayerId,
60        sides: i32,
61        natural_results: Vec<i32>,
62        final_results: Vec<i32>,
63        ignored_rolls: Vec<i32>,
64        source_card_id: Option<CardId>,
65    },
66    FirstPlayerRoll {
67        sides: i32,
68        rounds: Vec<Vec<(PlayerId, i32)>>,
69        winner: PlayerId,
70    },
71    GameOver,
72}