Skip to content

SpellsMemorizedEvent

A caster has finished preparing spells for the day.

Full documentation: SpellsMemorizedEvent. Wire type: spells_memorized.

Default visibility: player

Message codes: magic.memorize.prepared

JSON Schema

{
  "$defs": {
    "PreparedSpell": {
      "description": "One spell a caster has in memory, as it appears on a memorization event.\n\nYou read these off a `SpellsMemorizedEvent`'s `prepared` tuple.\n\nA caster who prepares a reversible spell chooses which way round it goes at preparation time, not at casting\ntime, so each prepared copy records the form it's locked into.",
      "properties": {
        "spell_id": {
          "title": "Spell Id",
          "type": "string",
          "description": "The spell's content id, like `\"magic_missile\"`."
        },
        "reversed": {
          "default": false,
          "title": "Reversed",
          "type": "boolean",
          "description": "True when the copy was prepared in the spell's reversed form, as *cause light wounds* is the reverse of\n*cure light wounds*."
        }
      },
      "required": [
        "spell_id"
      ],
      "title": "PreparedSpell",
      "type": "object"
    },
    "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": "A caster has finished preparing spells for the day.\n\n`memorize_spells` emits one of these per preparation. Preparation\nreplaces everything the caster had in memory, so `prepared` is the whole new memory rather than what was\nadded to it.",
  "properties": {
    "code": {
      "default": "magic.memorize.prepared",
      "title": "Code",
      "type": "string",
      "description": "Fixed at `magic.memorize.prepared`."
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "player",
      "description": "Player visibility: the caster's own memory is the player's to see."
    },
    "event_type": {
      "const": "spells_memorized",
      "default": "spells_memorized",
      "title": "Event Type",
      "type": "string",
      "description": "The wire name for this event type."
    },
    "caster_id": {
      "title": "Caster Id",
      "type": "string",
      "description": "The entity id of the caster."
    },
    "prepared": {
      "items": {
        "$ref": "#/$defs/PreparedSpell"
      },
      "title": "Prepared",
      "type": "array",
      "description": "Every copy now in memory, as `PreparedSpell` entries. A spell\nprepared twice appears twice."
    }
  },
  "required": [
    "caster_id",
    "prepared"
  ],
  "title": "SpellsMemorizedEvent",
  "type": "object"
}