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    TurnChanged {
28        active_player: PlayerId,
29        turn_number: u32,
30    },
31    PhaseChanged {
32        phase: PhaseType,
33    },
34    PriorityChanged {
35        player: PlayerId,
36    },
37    StateChanged,
38    SnapshotCreated {
39        checkpoint_id: u64,
40        label: String,
41    },
42    ManaPaymentResolved {
43        player: PlayerId,
44        actions: Vec<ManaCostAction>,
45    },
46    ActivatedAbilityPaymentFailed {
47        player: PlayerId,
48        card_id: CardId,
49        ability_index: usize,
50    },
51    /// Dice were rolled. Display-only — sent for UI animation/feedback.
52    /// Mirrors Java's `PlayerController.notifyOfRoll`.
53    DiceRolled {
54        player: PlayerId,
55        sides: i32,
56        natural_results: Vec<i32>,
57        final_results: Vec<i32>,
58        ignored_rolls: Vec<i32>,
59        source_card_id: Option<CardId>,
60    },
61    FirstPlayerRoll {
62        sides: i32,
63        rounds: Vec<Vec<(PlayerId, i32)>>,
64        winner: PlayerId,
65    },
66    GameOver,
67}