LearnSpell
Add a spell to an arcane caster's spell book, when they gain a level or a mentor teaches them.
Full documentation: LearnSpell. Wire type: learn_spell.
Legal session modes: exploring, town
JSON Schema
{
"description": "Add a spell to an arcane caster's spell book, when they gain a level or a mentor teaches them.\n\nIt's legal in town and while exploring. At each spell level, no more spells fit in the book\nthan the caster has slots at that level. The book never shrinks, so a caster\nwho lost a level can have more spells in it than their slots, and can't learn more at\nthat level until they regain the slots. No game time passes. What the learning costs in\nthe story, like a mentor's week or the price of copying a scroll, is up to you.\n\nModes:\n `town`, `exploring`\n\nRejections:\n - `session.command.wrong_mode` - an encounter or battle is underway, or the\n session has ended.\n - `session.command.unknown_member` - `character_id` matches no party member.\n - `session.command.member_incapacitated` - the member can't act.\n - `magic.book.not_arcane` - the member's class isn't an arcane caster.\n - `magic.book.unknown_spell` - `spell_id`, or a spell already in the caster's\n book, matches no spell in the session's catalog.\n - `magic.book.wrong_list` - the spell isn't on the caster's spell list.\n - `magic.book.duplicate` - the book already contains the spell.\n - `magic.book.capacity_exceeded` - the book is full at the spell's level.\n\nEvents:\n `SpellBookUpdatedEvent` with\n the added spell.",
"properties": {
"command_type": {
"const": "learn_spell",
"default": "learn_spell",
"title": "Command Type",
"type": "string",
"description": "The name that identifies the command class in serialized data. Each command class fixes\nit to a distinct snake_case string, like `\"move_party\"` or `\"open_door\"`, and constructing\nthe class sets it, so you never pass it yourself.\n`parse_command` and the\n`AnyCommand` union use it to rebuild the right class\nfrom a serialized mapping. A class's value never changes between releases."
},
"source": {
"anyOf": [
{
"minLength": 1,
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Source",
"description": "Who or what issued the command on whose behalf: an authored trigger or quest id, or the\nname of one of your game's systems. The engine never reads it, so a command with a\n`source` does exactly what the same command without one does. The session logs and\nreplays it with the command, so the log alone shows why something happened. Leave it\n`None` when there's nothing to record. An empty string fails validation when the command\nis constructed."
},
"character_id": {
"title": "Character Id",
"type": "string",
"description": "The arcane caster whose book gets the spell, by\n`MemberView.id`. The session refuses a member whose class\nisn't an arcane caster with `magic.book.not_arcane`."
},
"spell_id": {
"title": "Spell Id",
"type": "string",
"description": "The spell to write into the book, by its id in\n`GameSession.effective_spells`: a\nbuilt-in spell (see the\n[spell id index](https://mmacy.github.io/osrlib-python/reference/content-ids/spells/)) or one\nthe adventure bundles. It has to be on the spell list of the caster's class. At each spell\nlevel, no more spells fit in the book than the caster has slots at that level."
}
},
"required": [
"character_id",
"spell_id"
],
"title": "LearnSpell",
"type": "object"
}