Skip to content

SpellCastEvent

A spell cast: the memorized copy was consumed.

Full documentation: SpellCastEvent. Wire type: spell_cast.

Default visibility: player

Message codes: magic.cast.cast, magic.cast.no_effect

JSON Schema

{
  "$defs": {
    "Visibility": {
      "description": "Who may see an event.\n\nThe wire values are `\"player\"` and `\"referee\"` \u2014 lowercase, serialized into every\nevent; changing them is a `schema_version` bump.",
      "enum": [
        "player",
        "referee"
      ],
      "title": "Visibility",
      "type": "string"
    }
  },
  "description": "A spell cast: the memorized copy was consumed.\n\nEmitted by [`cast_spell`][osrlib.core.spells.cast_spell] or\n[`cast_from_scroll`][osrlib.core.spells.cast_from_scroll]. `code` is\n`magic.cast.cast` for an ordinary cast, or `magic.cast.no_effect` when every\ntarget was ineligible or unaffected \u2014 the copy is still spent, since rejections\nare free and would leak hidden state about which targets were eligible.\n\n`manual=True` marks modes the kernel doesn't execute \u2014 the game narrates the\neffect from the spell's prose. Resolution consequences ride the existing event\ntypes (saves, damage, conditions, effects, healing, deaths), exactly as breath\nweapons do.",
  "properties": {
    "code": {
      "title": "Code",
      "type": "string"
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "player"
    },
    "event_type": {
      "const": "spell_cast",
      "default": "spell_cast",
      "title": "Event Type",
      "type": "string"
    },
    "caster_id": {
      "title": "Caster Id",
      "type": "string"
    },
    "spell_id": {
      "title": "Spell Id",
      "type": "string"
    },
    "mode": {
      "title": "Mode",
      "type": "string"
    },
    "reversed": {
      "default": false,
      "title": "Reversed",
      "type": "boolean"
    },
    "target_ids": {
      "default": [],
      "items": {
        "type": "string"
      },
      "title": "Target Ids",
      "type": "array"
    },
    "manual": {
      "default": false,
      "title": "Manual",
      "type": "boolean"
    }
  },
  "required": [
    "code",
    "caster_id",
    "spell_id",
    "mode"
  ],
  "title": "SpellCastEvent",
  "type": "object"
}