Skip to main content

weiss_core/state/
stack.rs

1use serde::{Deserialize, Serialize};
2
3use crate::db::CardId;
4use crate::effects::{EffectId, EffectPayload};
5
6use super::TimingWindow;
7
8/// Item on the effect stack.
9#[derive(Clone, Debug, Hash, Serialize, Deserialize)]
10pub struct StackItem {
11    /// Unique stack item id.
12    pub id: u32,
13    /// Controlling player for resolution ordering.
14    pub controller: u8,
15    /// Source card id that created the stack item.
16    pub source_id: CardId,
17    /// Compiled effect id for this item.
18    pub effect_id: EffectId,
19    /// Payload to resolve.
20    pub payload: EffectPayload,
21}
22
23/// Priority window state.
24#[derive(Clone, Debug, Hash, Serialize, Deserialize)]
25pub struct PriorityState {
26    /// Current priority holder seat.
27    pub holder: u8,
28    /// Consecutive pass count (for window termination).
29    pub passes: u8,
30    /// Active timing window.
31    pub window: TimingWindow,
32    /// Bitmask of already-used ACT abilities (by index).
33    pub used_act_mask: u32,
34}
35
36/// Stack ordering state when multiple items are pending.
37#[derive(Clone, Debug, Hash, Serialize, Deserialize)]
38pub struct StackOrderState {
39    /// Group identifier for the ordering prompt.
40    pub group_id: u32,
41    /// Controller making the ordering decision.
42    pub controller: u8,
43    /// Items to order.
44    pub items: Vec<StackItem>,
45}