mundane.engine.actions

Player actions: the data players submit, plus the rejection exception.

Actions are data, not method calls — a whole game is reduce(apply_action, actions, initial). ACTION_TYPES is the single canonical registry mapping JSON discriminator tags to action classes; both the JSON export (serialize.py) and the HTTP parser (api/schemas.py) derive from it so the wire format can never drift from the engine.

Attributes

Action

The closed set of moves a player may submit.

ACTION_TYPES

Canonical JSON tag -> action-class registry (the type discriminator values).

Exceptions

IllegalAction

Raised when an action is rejected. State is never mutated on rejection.

Classes

PlayCard

Sorcery-speed play of a PERSON / APPLIANCE / HABIT / TASK from hand.

CastInstant

Cast an INSTANT from hand. Legal any time the player holds priority.

PassPriority

Pass priority. The phase advances as a consequence of passing, not via its own action.

Module Contents

class mundane.engine.actions.PlayCard[source]

Sorcery-speed play of a PERSON / APPLIANCE / HABIT / TASK from hand.

player: int[source]
hand_index: int[source]
class mundane.engine.actions.CastInstant[source]

Cast an INSTANT from hand. Legal any time the player holds priority.

player: int[source]
hand_index: int[source]
target_id: int | None = None[source]
class mundane.engine.actions.PassPriority[source]

Pass priority. The phase advances as a consequence of passing, not via its own action.

player: int[source]
type mundane.engine.actions.Action = PlayCard | CastInstant | PassPriority[source]

The closed set of moves a player may submit.

mundane.engine.actions.ACTION_TYPES: dict[str, type[Action]][source]

Canonical JSON tag -> action-class registry (the type discriminator values).

exception mundane.engine.actions.IllegalAction[source]

Bases: Exception

Raised when an action is rejected. State is never mutated on rejection.