mundane.engine.actions ====================== .. py:module:: mundane.engine.actions .. autoapi-nested-parse:: 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)``. :data:`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 ---------- .. autoapisummary:: mundane.engine.actions.Action mundane.engine.actions.ACTION_TYPES Exceptions ---------- .. autoapisummary:: mundane.engine.actions.IllegalAction Classes ------- .. autoapisummary:: mundane.engine.actions.PlayCard mundane.engine.actions.CastInstant mundane.engine.actions.PassPriority Module Contents --------------- .. py:class:: PlayCard Sorcery-speed play of a PERSON / APPLIANCE / HABIT / TASK from hand. .. py:attribute:: player :type: int .. py:attribute:: hand_index :type: int .. py:class:: CastInstant Cast an INSTANT from hand. Legal any time the player holds priority. .. py:attribute:: player :type: int .. py:attribute:: hand_index :type: int .. py:attribute:: target_id :type: int | None :value: None .. py:class:: PassPriority Pass priority. The phase advances as a *consequence* of passing, not via its own action. .. py:attribute:: player :type: int .. py:type:: Action :canonical: PlayCard | CastInstant | PassPriority The closed set of moves a player may submit. .. py:data:: ACTION_TYPES :type: dict[str, type[Action]] Canonical JSON tag -> action-class registry (the ``type`` discriminator values). .. py:exception:: IllegalAction Bases: :py:obj:`Exception` Raised when an action is rejected. State is never mutated on rejection.