Skip to content

SpellDeclaredEvent

Somebody declared a spell, before anyone knows who acts first.

Full documentation: SpellDeclaredEvent. Wire type: spell_declared.

Default visibility: player

Message codes: battle.spell.declared

JSON Schema

{
  "$defs": {
    "Visibility": {
      "description": "Who is allowed to see an event.\n\nEvery event has one of these two values, and the split exists because B/X keeps some rolls behind the\nreferee's screen. Filter a log on it before you show anything to a player, or call\n`GameSession.view`, which builds the player's and the referee's\nviews for you. A narrator playing referee reads both.\n\nThe values are the lowercase strings and they serialize into every event, so a renamed value is a\n`schema_version` bump.\n\nExamples:\n    ```python\n    from osrlib.core.events import DamageDealtEvent, HitPointsReportedEvent, Visibility\n\n    log = [\n        DamageDealtEvent(target_id=\"monster-0001\", amount=5),\n        HitPointsReportedEvent(target_id=\"monster-0001\", current_hp=2, max_hp=7),\n    ]\n    shown = [event.code for event in log if event.visibility is Visibility.PLAYER]\n    assert shown == [\"combat.damage.dealt\"]  # the goblin's remaining hit points stay hidden\n    ```",
      "enum": [
        "player",
        "referee"
      ],
      "title": "Visibility",
      "type": "string"
    }
  },
  "description": "Somebody declared a spell, before anyone knows who acts first.\n\nEmitted by `ResolveBattleRound` for\neach caster who declared one, party member or NPC alike, at the top of the round.\n\nB/X has declarations posted before initiative on purpose: a caster who takes\ndamage before their turn loses the spell, and the other side can act on knowing\nwhat is coming. The disruption itself arrives later in the round as a kernel\nevent.",
  "properties": {
    "code": {
      "default": "battle.spell.declared",
      "title": "Code",
      "type": "string",
      "description": "The message code, always `battle.spell.declared`."
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "player",
      "description": "Player visibility: a declaration is made out loud at the table."
    },
    "event_type": {
      "const": "spell_declared",
      "default": "spell_declared",
      "title": "Event Type",
      "type": "string",
      "description": "The wire discriminator, `spell_declared`."
    },
    "caster_id": {
      "title": "Caster Id",
      "type": "string",
      "description": "Who is casting: a party member's id, or an NPC adventurer's."
    },
    "spell_id": {
      "title": "Spell Id",
      "type": "string",
      "description": "Which spell was declared, as its catalog id."
    },
    "reversed": {
      "default": false,
      "title": "Reversed",
      "type": "boolean",
      "description": "Whether the reversed form was declared, for a spell that has one."
    }
  },
  "required": [
    "caster_id",
    "spell_id"
  ],
  "title": "SpellDeclaredEvent",
  "type": "object"
}