Skip to content

PlaceParty

Referee: teleport the party to a location.

Full documentation: PlaceParty. Wire type: place_party.

Legal session modes: battle, encounter, exploring, game_over, town

JSON Schema

{
  "$defs": {
    "Direction": {
      "description": "The four grid directions the party faces and moves in.\n\nThis is the direction vocabulary the whole crawl uses: which way\n`MoveParty` steps, which side of a cell\n`OpenDoor` works on, which way a transition faces the party on\narrival. There is no up or down here. Between levels is a\n`TransitionSpec`.\n\nThe wire values are lowercase and they serialize into commands, events, and saves, so changing\none is a `schema_version` bump.",
      "enum": [
        "north",
        "east",
        "south",
        "west"
      ],
      "title": "Direction",
      "type": "string"
    },
    "PartyLocation": {
      "description": "Where the party is: in the base town, or on a dungeon cell facing a direction.\n\nThe session keeps one of these on\n`DungeonState.location` and moves it as the party moves. You\nread it to draw the map and to know which mode the party is in, and you never write it. The referee\ncommand `PlaceParty` is how a game moves the party by fiat.\n\nThe two shapes are exclusive and the model enforces it: a town location carries no dungeon\nfields, and a dungeon location carries all four.\n\nAttributes:\n    kind: Which of the two shapes this is.\n    dungeon_id: The dungeon the party is in.\n    level_number: The level it is on.\n    position: The cell it stands on.\n    facing: The direction it faces.\n\nRaises:\n    ValueError: If `kind` is `\"dungeon\"` and any dungeon field is missing, or if `kind` is\n        `\"town\"` and any is set.\n\nExamples:\n    ```python\n    from osrlib.crawl.dungeon import Direction, PartyLocation\n\n    here = PartyLocation(kind=\"dungeon\", dungeon_id=\"crypt\", level_number=1, position=(0, 0), facing=Direction.EAST)\n    print(here.position, here.facing)\n    # (0, 0) east\n    ```",
      "properties": {
        "kind": {
          "enum": [
            "town",
            "dungeon"
          ],
          "title": "Kind",
          "type": "string",
          "description": "`\"town\"` when the party is in the base town between delves, `\"dungeon\"` when it is standing on\na grid. A new session starts in town."
        },
        "dungeon_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Dungeon Id",
          "description": "The id of the dungeon the party is in, and `None` in town."
        },
        "level_number": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Level Number",
          "description": "The 1-based number of the level the party is on, and `None` in town."
        },
        "position": {
          "anyOf": [
            {
              "maxItems": 2,
              "minItems": 2,
              "prefixItems": [
                {
                  "type": "integer"
                },
                {
                  "type": "integer"
                }
              ],
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Position",
          "description": "The cell the party stands on, and `None` in town."
        },
        "facing": {
          "anyOf": [
            {
              "$ref": "#/$defs/Direction"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The direction the party faces, and `None` in town. Facing is what a front end draws the view\nfrom. Movement itself names its own direction, so the party can step any way it likes regardless\nof which way it looks."
        }
      },
      "required": [
        "kind"
      ],
      "title": "PartyLocation",
      "type": "object"
    }
  },
  "description": "Referee: teleport the party to a location.\n\nThe party cannot be teleported out of an open encounter or battle. Placing\ninto a dungeon marks the cell explored and switches the session to\n`exploring`, and placing in town switches it to `town`. That switch is play\nresuming, which is why this is the one referee command a concluded adventure\nwithholds: it is illegal in `victory`. It stays legal in `game_over`, where it\nis the way out, because carrying the fallen party to town is the first\nstep of the revival flow that ends at\n`PurchaseHealing`'s `raise_dead`.\n\nModes:\n    `town`, `exploring`, `encounter`, `battle`, `game_over`\n\nRejections:\n    - `session.command.encounter_in_progress` - an encounter or battle is\n      open.\n    - `session.command.unknown_location` - the location names no dungeon\n      level.\n    - `session.command.out_of_bounds` - the position is off the level's grid.\n\nEvents:\n    `LocationEnteredEvent` for the\n    destination, a dungeon one with `via` `\"placed\"`, so a log doesn't read a\n    referee's teleport as a walk down the stairs.",
  "properties": {
    "command_type": {
      "const": "place_party",
      "default": "place_party",
      "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."
    },
    "location": {
      "$ref": "#/$defs/PartyLocation",
      "description": "Where the party ends up. A `PartyLocation` with\n`kind=\"town\"` has no other fields. One with `kind=\"dungeon\"` needs the dungeon id, the\nlevel number, the cell, and the facing, all four together. A dungeon placement marks the\ncell explored and switches the session to `exploring`, and a town placement switches it to\n`town`. A position off the level's grid is refused with\n`session.command.out_of_bounds`."
    }
  },
  "required": [
    "location"
  ],
  "title": "PlaceParty",
  "type": "object"
}