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 a memorization event lists it.\n\nRead these from the `prepared` field of a `SpellsMemorizedEvent`.\n\nA caster who prepares a reversible spell chooses its form when preparing it, not when casting it, so each\nprepared copy records its form.",
      "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 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 caster has finished preparing spells for the day.\n\n`memorize_spells` reports one of these each time it prepares a caster's\nspells. Preparing replaces everything the caster had in memory, so `prepared` lists all of the caster's\nmemory now, not only what was added.",
  "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 player may see what their caster has memorized."
    },
    "event_type": {
      "const": "spells_memorized",
      "default": "spells_memorized",
      "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."
    },
    "prepared": {
      "items": {
        "$ref": "#/$defs/PreparedSpell"
      },
      "title": "Prepared",
      "type": "array",
      "description": "Every copy now in the caster's memory, as `PreparedSpell` entries. A\nspell prepared twice appears twice."
    }
  },
  "required": [
    "caster_id",
    "prepared"
  ],
  "title": "SpellsMemorizedEvent",
  "type": "object"
}