Skip to content

EncounterStartedEvent

The party has met something, and here is what it sees.

Full documentation: EncounterStartedEvent. Wire type: encounter_started.

Default visibility: player

Message codes: encounter.started

JSON Schema

{
  "$defs": {
    "Visibility": {
      "description": "Who is allowed to see an event.\n\nEvery event has one of these two values, and the split exists because B/X keeps some rolls behind the\nreferee's screen. Filter a log on it before you show anything to a player, or call\n`GameSession.view`, which builds the player's and the referee's\nviews for you. A narrator playing referee reads both.\n\nThe values are the lowercase strings and they serialize into every event, so a renamed value is a\n`schema_version` bump.\n\nExamples:\n    ```python\n    from osrlib.core.events import DamageDealtEvent, HitPointsReportedEvent, Visibility\n\n    log = [\n        DamageDealtEvent(target_id=\"monster-0001\", amount=5),\n        HitPointsReportedEvent(target_id=\"monster-0001\", current_hp=2, max_hp=7),\n    ]\n    shown = [event.code for event in log if event.visibility is Visibility.PLAYER]\n    assert shown == [\"combat.damage.dealt\"]  # the goblin's remaining hit points stay hidden\n    ```",
      "enum": [
        "player",
        "referee"
      ],
      "title": "Visibility",
      "type": "string"
    }
  },
  "description": "The party has met something, and here is what it sees.\n\nEmitted when an encounter opens, whichever way it did: walking into a keyed area\nwith `MoveParty`,\n`EnterDungeon` or\n`UseStairs` arriving on one, a wandering\ncheck, or a referee's `SpawnMonsters` or\n`SpawnNpcParty`. The session mode becomes\n`encounter`, where the party can talk, run, wait, or fight.\n\nIt contains only what the party can see: a name, a count, a distance.\nThe dice behind the meeting are reported on\n`SurpriseRolledEvent` and on the\nreaction roll, both at referee visibility. The two surprise outcomes are here,\nbecause being caught off guard is something the party lives through.",
  "properties": {
    "code": {
      "default": "encounter.started",
      "title": "Code",
      "type": "string",
      "description": "The message code, always `encounter.started`."
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "player",
      "description": "Player visibility: this is the moment the table is told what walked in."
    },
    "event_type": {
      "const": "encounter_started",
      "default": "encounter_started",
      "title": "Event Type",
      "type": "string",
      "description": "The wire discriminator, `encounter_started`."
    },
    "monster_name": {
      "title": "Monster Name",
      "type": "string",
      "description": "The label of the first group in the encounter, as the party would name it. An NPC\nadventuring party appears under a label like `\"Basic Adventurers\"`, with its roster kept\nbehind the screen."
    },
    "count": {
      "title": "Count",
      "type": "integer",
      "description": "How many creatures there are across every group in the encounter."
    },
    "distance_feet": {
      "title": "Distance Feet",
      "type": "integer",
      "description": "How far away they are, in feet, when the encounter opens. Battle starts from this distance\nand closes from there."
    },
    "party_surprised": {
      "default": false,
      "title": "Party Surprised",
      "type": "boolean",
      "description": "Whether the party was caught off guard, which costs it the first beat of the fight."
    },
    "monsters_surprised": {
      "default": false,
      "title": "Monsters Surprised",
      "type": "boolean",
      "description": "Whether the monsters were caught off guard, which gives the party a free round if the fight\nstarts."
    }
  },
  "required": [
    "monster_name",
    "count",
    "distance_feet"
  ],
  "title": "EncounterStartedEvent",
  "type": "object"
}