CastSpell
Cast a memorized spell outside battle (one round).
Full documentation: CastSpell. Wire type: cast_spell.
Legal session modes: exploring, town
JSON Schema
{
"description": "Cast a memorized spell outside battle (one round).\n\n`targets` are entity ids, or `cell:` references for location-bound casts. In\nencounter mode a hostile cast is opened through\n`EngageBattle` and the first round's\ndeclarations instead, and in battle casting is a declaration kind.\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.cast.unknown_spell` - `spell_id` names no spell.\n - `magic.cast.silenced_area` - a *silence* effect covers the party's cell.\n - `magic.cast.unknown_target` - a target reference resolves to nothing.\n - `magic.cast.not_memorized` - no memorized copy (non-casters included).\n - `magic.cast.caster_incapacitated`, `magic.cast.caster_restrained`,\n `magic.cast.anti_magic_shell` - the caster cannot cast right now.\n - `magic.cast.not_reversible` - `reversed` on a spell with no reversed\n form.\n - `magic.cast.unknown_mode` - `mode` names no mode of the spell.\n - `magic.cast.target_count` - the wrong number of targets for the mode.\n - `magic.cast.out_of_range` - a target lies beyond the spell's range.\n\nEvents:\n `SpellCastEvent` plus the spell's own\n resolution: saving throws, damage, healing, and effect attachments, each\n its own event. One round passes.",
"properties": {
"command_type": {
"const": "cast_spell",
"default": "cast_spell",
"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, by `MemberView.id`. They need a memorized\ncopy of the spell, which casting spends."
},
"spell_id": {
"title": "Spell Id",
"type": "string",
"description": "The spell to cast, from `load_spells` (see the spell id\nindex). A caster with no memorized copy is refused with\n`magic.cast.not_memorized`, which is also what a non-caster gets."
},
"mode": {
"title": "Mode",
"type": "string",
"description": "Which of the spell's numbered usages to cast, by that usage's\n`SpellMode.key` on the form you're casting. Spells whose\npage lists several usages, like *cure light wounds* and *light*, have one mode each, and a\nsingle-usage spell still needs its one key named. A key the form doesn't have comes back as\n`magic.cast.unknown_mode`."
},
"reversed": {
"default": false,
"title": "Reversed",
"type": "boolean",
"description": "Cast the reversed form, like *cause light wounds* for *cure light wounds*. An arcane\ncaster fixes the form when memorizing, so a reversed cast needs a reversed copy in hand. A\ndivine caster memorizes the normal form and chooses here at the altar. A spell with no\nreversed form is refused with `magic.cast.not_reversible`."
},
"targets": {
"default": [],
"items": {
"type": "string"
},
"title": "Targets",
"type": "array",
"description": "Who or what the spell lands on, as entity ids: a party member's\n`MemberView.id`, a monster's id, or a cell reference in\nthe `cell:{dungeon}:{level}:{x},{y}` form that\n`cell_ref` builds, for a spell that anchors to a place\nrather than a creature. How many the mode takes is the mode's own targeting, and the wrong\ncount is refused with `magic.cast.target_count`."
}
},
"required": [
"character_id",
"spell_id",
"mode"
],
"title": "CastSpell",
"type": "object"
}