mundane.engine.state¶
Game-state dataclasses: the single source of truth for a Mundane game.
Nothing in this module mutates state; mundane.engine.rules.apply_action() is the only
thing that does. Cards are referenced by id throughout the state; card objects — built from
JSON sets by mundane.engine.cards.build_card() — and the effect closures they carry live only
in the per-game pool, never in serialisable state. That separation is what lets a whole
GameState round-trip through JSON.
Attributes¶
An effect mutates the state when its card resolves, given the resolving |
|
Classes¶
The five kinds of card. The first three are permanents (they stay on the board). |
|
A card definition, built from a JSON set by |
|
One household. Card collections hold library ids ( |
|
A card waiting to resolve. |
|
The entire game. Fully JSON-serialisable: every field is data, never code. |
Functions¶
|
Do nothing. Permanents resolve onto the board, so they carry this placeholder effect. |
Module Contents¶
- class mundane.engine.state.CardType[source]¶
Bases:
enum.StrEnumThe five kinds of card. The first three are permanents (they stay on the board).
- type mundane.engine.state.Effect = Callable[[GameState, StackItem], None][source]¶
An effect mutates the state when its card resolves, given the resolving
StackItem.
- mundane.engine.state._no_effect(_state: GameState, _item: StackItem) None[source]¶
Do nothing. Permanents resolve onto the board, so they carry this placeholder effect.
- class mundane.engine.state.Card[source]¶
A card definition, built from a JSON set by
mundane.engine.cards.build_card().State refers to a card only by its composed
id(set_id:id); the boundeffectclosure lives in the per-game pool, never in serialisable state.
- class mundane.engine.state.Player[source]¶
One household. Card collections hold library ids (
str), never Card objects.
- class mundane.engine.state.StackItem[source]¶
A card waiting to resolve.
idis unique within a game (seeGameState.next_stack_id).