Source code for yasuki_core.engine.rules.events
from dataclasses import dataclass
from yasuki_core.engine.players import PlayerId
from yasuki_core.game_pieces.constants import Side
from yasuki_core.game_pieces.counters import Counter
[docs]
@dataclass(frozen=True, slots=True)
class TurnStarted:
"""A seat's turn has begun (after straighten and province reveal)."""
seat: PlayerId
[docs]
@dataclass(frozen=True, slots=True)
class CardDiscarded:
"""A card entered a discard pile. ``by_seat`` is the seat whose action caused it, ``side`` the
discarded card's side — the two facts a discard-reaction reads ("your action, a Fate card")."""
card_id: str
side: Side
by_seat: PlayerId
[docs]
@dataclass(frozen=True, slots=True)
class CounterGained:
"""A card gained ``amount`` of a counter — the actual number added, after any floor."""
card_id: str
counter: Counter
amount: int
[docs]
@dataclass(frozen=True, slots=True)
class Destroyed:
"""A card was destroyed — sent to a discard by destruction, distinct from being discarded from
hand."""
card_id: str
[docs]
@dataclass(frozen=True, slots=True)
class EnteredPlay:
"""A card entered play on the battlefield."""
card_id: str
GameEvent = TurnStarted | CardDiscarded | CounterGained | Destroyed | EnteredPlay