PrepareSpells
Prepare a caster's daily spells: once per sleep, after an uninterrupted night, six turns.
Full documentation: PrepareSpells. Wire type: prepare_spells.
Legal session modes: exploring, town
JSON Schema
{
"$defs": {
"MemorizedSpell": {
"description": "One spell a caster has ready to cast: which spell, and in which form.\n\nYou build these to hand to `memorize_spells`, one per slot\nyou want filled, and you read them back off a character's `memorized_spells`, where they sit in\nthe order they were prepared. That order matters: casting spends the first copy that matches,\nand a level drain forgets the newest first.\n\nA copy names a spell and fills a slot. What the spell can do comes from the template you get\nwith `SpellCatalog.get`.\n\nExamples:\n ```python\n from osrlib.core.spells import MemorizedSpell\n\n prepared = [MemorizedSpell(spell_id=\"magic_missile\"), MemorizedSpell(spell_id=\"light_mu\", reversed=True)]\n assert prepared[1].reversed # this copy casts *darkness*, not *light*\n ```",
"properties": {
"spell_id": {
"minLength": 1,
"title": "Spell Id",
"type": "string",
"description": "The spell's id, from `load_spells`.\n\nFor the ids the shipped catalog uses, see the spell id index."
},
"reversed": {
"default": false,
"title": "Reversed",
"type": "boolean",
"description": "True when this copy is prepared as the spell's reversed form.\n\nOnly an arcane caster sets it, because the SRD has arcane casters choose the form when the spell\nis memorized. A divine caster memorizes the normal form and speaks it backwards at the moment of\ncasting, so divine copies are always False and preparing one with True is rejected."
}
},
"required": [
"spell_id"
],
"title": "MemorizedSpell",
"type": "object"
}
},
"description": "Prepare a caster's daily spells: once per sleep, after an uninterrupted night, six turns.\n\nLegal in town and while exploring. The caster must have slept (a night or day\n`Rest`) since the last preparation, and the\nselections replace the memorized list wholesale.\n\nModes:\n `town`, `exploring`\n\nRejections:\n - `session.command.wrong_mode` - an encounter or battle is underway, or the\n game is over.\n - `session.command.unknown_member` - `character_id` names no party member.\n - `session.command.member_incapacitated` - the member cannot act.\n - `magic.memorize.needs_sleep` - no sleep since the last preparation.\n - `magic.memorize.not_a_caster` - the class casts no spells.\n - `magic.memorize.unknown_spell` - a selection names no known spell.\n - `magic.memorize.wrong_list` - a selection is off the caster's spell list.\n - `magic.memorize.divine_reverses_at_cast` - divine casters choose the\n reversed form at casting, not at prayer.\n - `magic.memorize.not_in_book` - an arcane selection is missing from the\n spell book.\n - `magic.memorize.not_reversible` - a reversed selection has no reversed\n form.\n - `magic.memorize.slots_exceeded` - more selections at some spell level\n than the caster has slots.\n\nEvents:\n `SpellsMemorizedEvent` with the\n prepared list. Six turns pass with their usual follow-on events.",
"properties": {
"command_type": {
"const": "prepare_spells",
"default": "prepare_spells",
"title": "Command Type",
"type": "string",
"description": "The wire discriminator. Each subclass fixes it to its own snake_case literal, like\n`\"move_party\"` or `\"open_door\"`, so you never set it yourself: constructing the subclass\ndoes. It's what `parse_command` and the\n`AnyCommand` union read to rebuild the right class\nfrom a serialized mapping, and it stays the same across releases."
},
"source": {
"anyOf": [
{
"minLength": 1,
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Source",
"description": "An annotation naming the authored object (a trigger or quest id) or the game\nsystem on whose behalf the command was issued. Execution never reads it: a stamped\ncommand does exactly what the same command unstamped does. It is logged and replayed\nwith the command, so the log alone answers \"why did this happen\". Absent is `None`,\nand the empty string is not a value."
},
"character_id": {
"title": "Character Id",
"type": "string",
"description": "The caster preparing, by `MemberView.id`. The member\nhas to have slept since their last preparation, so pair this with a `night` or `day`\n`Rest`."
},
"selections": {
"default": [],
"items": {
"$ref": "#/$defs/MemorizedSpell"
},
"title": "Selections",
"type": "array",
"description": "The spells to hold ready, replacing the caster's current list outright rather than adding\nto it. Each `MemorizedSpell` names a spell id and, for\nan arcane caster, which form of a reversible spell the copy takes. Repeat a spell to hold\nmore than one copy of it. The count at each spell level has to fit the caster's slots at\nthat level, and an empty tuple clears the list. The caster's current list is on\n`MemberView.memorized_spells`."
}
},
"required": [
"character_id"
],
"title": "PrepareSpells",
"type": "object"
}