Skip to content

EncounterStartedEvent

The party met monsters, with what the party can see of them.

Full documentation: EncounterStartedEvent. Wire type: encounter_started.

Default visibility: player

Message codes: encounter.started

JSON Schema

{
  "$defs": {
    "Visibility": {
      "description": "Who may see an event: the players, or only the referee.\n\nEvery event has one of these values, because in B/X the referee makes some rolls behind a screen. Filter\na log on it before you show anything to a player, or call\n`GameSession.view`, which builds the players' view and the referee's\nview for you. A narrator that plays the referee reads every event.\n\nA serialized event contains the lowercase value. The values stay fixed within a `schema_version`, the version\nstamp of the saved format.\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 met monsters, with what the party can see of them.\n\nEmitted when an encounter opens, whichever way it opened: the party stepping into an\narea whose author placed monsters there, with\n`MoveParty`, or arriving in one with\n`EnterDungeon` or\n`UseStairs`, a wandering-monster check that hits,\nor 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, and a distance. The dice\nbehind the meeting are on the\n`SurpriseRolledEvent`s and the reaction\nroll's kernel event, both at referee visibility. The two surprise outcomes are here,\nbecause the party knows when it's caught off guard.",
  "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 players are told what they have met."
    },
    "event_type": {
      "const": "encounter_started",
      "default": "encounter_started",
      "title": "Event Type",
      "type": "string",
      "description": "The event type, `encounter_started`, which identifies this class in serialized form."
    },
    "monster_name": {
      "title": "Monster Name",
      "type": "string",
      "description": "The `label` of the first group in the encounter:\nwhat the party would call one of its members, like `\"goblin\"`. A party of NPC adventurers appears\nas `\"adventurer\"`, and its roster stays hidden from the players."
    },
    "monster_name_plural": {
      "default": "",
      "title": "Monster Name Plural",
      "type": "string",
      "description": "The first group's `label_plural`, like\n`\"goblins\"`, for a line like \"3 goblins\". An event loaded from a save that has no plural gets\n`monster_name` with the regular English ending."
    },
    "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 can give the monsters a free first round."
    },
    "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"
}