Skip to content

EndEncounter

Referee: close the open encounter when the party talks its way past or walks away.

Full documentation: EndEncounter. Wire type: end_encounter.

Legal session modes: battle, encounter

JSON Schema

{
  "description": "Referee: close the open encounter when the party talks its way past or walks away.\n\nUse it when the party pays a toll, bluffs the guards, or walks away from monsters that let\nit go. The session closes the encounter the same way it does when the party wins or gets\naway, and then switches to `exploring`:\n\n- Monsters that were slain earlier in the encounter, or that fled, are still fleeing, or\n  were turned, count as defeated and are worth experience.\n- Slain monsters drop their treasure in a pile on the party's cell. Monsters that fled or\n  were turned take theirs with them.\n- Monsters still standing aren't defeated and are worth no experience.\n- Effects on the encounter's monsters end.\n- The clock advances, so the encounter costs at least one turn.\n\nIn `battle`, the command closes the battle too, so `session.battle` is `None` afterward. It\nemits no `BattleEndedEvent`, because the\n`EncounterEndedEvent` closes both. To know the fight is over, check the session's mode.\n\nThe monsters keyed to an area of the adventure come back each time the party walks into\nthe area, until every one of them is slain or driven off. To stop them coming back, set\n`resolve_area` to `True`, which marks the area resolved. The command is legal only while\nan encounter is open, so you can't use it to resolve an area after its encounter has\nclosed.\n\nSet `outcome` to `\"parley\"` when the two sides came to terms, or `\"departed\"` when one side\nleft the other. It has no default.\n\nAn adventure document can contain this command as an authored consequence, so a trigger\ncan close the encounter. For example, a trigger can close the encounter and resolve the\narea when a flag records that the party paid the toll.\n\nModes:\n    `encounter`, `battle`\n\nRejections:\n    - `session.command.wrong_mode` - no encounter is open.\n\nEvents:\n    A `MonsterDefeatedEvent` for each monster\n    that counts as defeated, a `LootDroppedEvent`\n    when the slain leave anything on the floor, the events of effects ending on the\n    encounter's monsters, and the experience award when the ruleset awards it immediately.\n    Then the `EncounterEndedEvent` with the\n    command's `outcome`, and the events of the clock advance.",
  "properties": {
    "command_type": {
      "const": "end_encounter",
      "default": "end_encounter",
      "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."
    },
    "outcome": {
      "enum": [
        "parley",
        "departed"
      ],
      "title": "Outcome",
      "type": "string",
      "description": "How the encounter ended, as the `outcome` of the\n`EncounterEndedEvent`. Use `\"parley\"` when the\nparty and the monsters came to terms, like a toll paid or a bluff believed. Use\n`\"departed\"` when one side left the other, like a party that walks away from monsters\nthat let it go, or a pursuit that you call off."
    },
    "resolve_area": {
      "default": false,
      "title": "Resolve Area",
      "type": "boolean",
      "description": "Whether to mark the area the encounter came from as resolved, so its keyed monsters don't\nappear when the party next walks in. With `False`, the default, the area stays unresolved,\nand its monsters are back the next time the party enters it. A wandering or spawned\nencounter didn't come from an area, so the flag does nothing for it."
    }
  },
  "required": [
    "outcome"
  ],
  "title": "EndEncounter",
  "type": "object"
}