Skip to content

SpellDisruptedEvent

A spell the caster declared came to nothing, and the caster lost it anyway.

Full documentation: SpellDisruptedEvent. Wire type: spell_disrupted.

Default visibility: player

Message codes: magic.cast.disrupted, magic.cast.fizzled

JSON Schema

{
  "$defs": {
    "Visibility": {
      "description": "Who may see an event: the players, or only the referee.\n\nEvery event has one of these values, because in B/X the referee makes some rolls behind a screen. Filter\na log on it before you show anything to a player, or call\n`GameSession.view`, which builds the players' view and the referee's\nview for you. A narrator that plays the referee reads every event.\n\nA serialized event contains the lowercase value. The values stay fixed within a `schema_version`, the version\nstamp of the saved format.\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": "A spell the caster declared came to nothing, and the caster lost it anyway.\n\nIt's reported in two cases, and you tell them apart by `code`:\n\n- `magic.cast.disrupted`: `disrupt_casting` reports it when a caster\n  who declared a spell is hit, or stopped some other way, before the spell goes off.\n- `magic.cast.fizzled`: a session reports it during a battle round. In the round's magic phase, the session\n  checks each declared spell again, just before the spell would go off. If a check the spell passed at the start of\n  the round now fails, because something earlier in the round changed, the spell fizzles. Two examples are an ally's\n  *silence 15' radius* centered on the party's cell, and the party's last torch going out when its bearer\n  dies. Any of the checks can cause a fizzle, and `reason` has the rejection code of the one that failed.\n\nEither way, nothing happened and the memorized copy is gone, as if the spell had been cast. Tell the player\nthe spell failed and the copy is used up. A spell read from a scroll that fizzles uses up the scroll's spell\nthe same way, and the caster loses no memorized copy.",
  "properties": {
    "code": {
      "default": "magic.cast.disrupted",
      "title": "Code",
      "type": "string",
      "description": "Which of the two failures this is, defaulting to `magic.cast.disrupted`."
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "player",
      "description": "Player visibility: the caster's spell visibly fails."
    },
    "event_type": {
      "const": "spell_disrupted",
      "default": "spell_disrupted",
      "title": "Event Type",
      "type": "string",
      "description": "The fixed string that identifies this event class in a serialized event."
    },
    "caster_id": {
      "title": "Caster Id",
      "type": "string",
      "description": "The entity id of the caster."
    },
    "spell_id": {
      "title": "Spell Id",
      "type": "string",
      "description": "The spell's content id."
    },
    "reversed": {
      "default": false,
      "title": "Reversed",
      "type": "boolean",
      "description": "True when the lost copy was the spell's reversed form."
    },
    "reason": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Reason",
      "description": "Why a `magic.cast.fizzled` spell failed: the code of the first check that failed when the session checked\nthe spell again during the battle round.\n\nAny check a spell passes at the start of the round can fail, so read the code and don't assume a cause. An\nally's silence on the party's cell gives `magic.cast.silenced_area`, and a scroll read in the dark gives\n`exploration.action.requires_light`. Match on it as you match on the code of a\n`Rejection`. The rejection code reference explains\neach code. `None` on a `magic.cast.disrupted` event, whose cause is the hit, and on an event from a log\nwritten before the field existed."
    }
  },
  "required": [
    "caster_id",
    "spell_id"
  ],
  "title": "SpellDisruptedEvent",
  "type": "object"
}