CompleteQuest
Referee: finish an active quest, and on the concluding quest, the adventure.
Full documentation: CompleteQuest. Wire type: complete_quest.
Legal session modes: battle, encounter, exploring, game_over, town, victory
JSON Schema
{
"description": "Referee: finish an active quest, and on the concluding quest, the adventure.\n\nThe quest must be active, and that is the only test: the completion rule is\n*not* checked here. Ruling a quest done is the referee's call, and an authored\nquest layer is a disciplined issuer that checks the rule before issuing.\nIds are the closed domain\n`ActivateQuest` documents.\n\nRewards are not this command's business: whoever completes the quest issues the\nauthored rewards afterwards as ordinary commands of their own, so a completion\ndriven by hand grants nothing and every reward that does land is a line in the\nlog. The completion appends the quest's `completion` beat to the journal when\nits author wrote one, and the events include the same line. No\n`JournalEntryAddedEvent` follows.\n\n**The victory transition.** Completing a quest whose spec sets\n`concludes_adventure` from a non-terminal mode clears any open encounter and\nbattle, because a concluded session has no live play state, and switches the\nsession to `victory`. This is the one entrance to that mode. From a terminal mode\n(`game_over` or `victory`) the quest still completes and still journals, but\nnothing transitions and no adventure-completed event lands: an ended session\nnever ends again, so the record shows a fallen party finishing the job without\nresurrecting the adventure around it. Referee commands are legal in every mode,\nterminal modes included.\n\nModes:\n `town`, `exploring`, `encounter`, `battle`, `game_over`, `victory`\n\nRejections:\n - `session.command.unknown_quest` - `quest_id` names no quest of the\n adventure.\n - `session.command.quest_state` - the quest is inactive or already\n completed. The rejection names the quest and the state that refused it.\n\nEvents:\n `QuestCompletedEvent` with the\n quest id, the quest's name, and the completion beat, followed by\n `AdventureCompletedEvent`\n with the same beat when the quest concludes the adventure and the\n session had not already ended.",
"properties": {
"command_type": {
"const": "complete_quest",
"default": "complete_quest",
"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."
},
"quest_id": {
"minLength": 1,
"title": "Quest Id",
"type": "string",
"description": "Which quest to finish, by\n`QuestSpec.id`. It has to be active, and that's the only\ntest: whether its objectives are done is the issuer's judgement rather than the engine's."
}
},
"required": [
"quest_id"
],
"title": "CompleteQuest",
"type": "object"
}