Skip to content

SurpriseRolledEvent

One side's surprise die, rolled behind the screen.

Full documentation: SurpriseRolledEvent. Wire type: surprise_rolled.

Default visibility: referee

Message codes: encounter.surprise.rolled

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": "One side's surprise die, rolled behind the screen.\n\nEmitted twice when an encounter opens, once for each side, before\n`EncounterStartedEvent` reports the\noutcomes to the table.\n\nA side that cannot be surprised doesn't roll: a party that already knows what is\nin the room, or monsters that heard the party coming or can see its light.",
  "properties": {
    "code": {
      "default": "encounter.surprise.rolled",
      "title": "Code",
      "type": "string",
      "description": "The message code, always `encounter.surprise.rolled`."
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "referee",
      "description": "Referee visibility: the die is the referee's, and the result reaches the table through the\nencounter event."
    },
    "event_type": {
      "const": "surprise_rolled",
      "default": "surprise_rolled",
      "title": "Event Type",
      "type": "string",
      "description": "The wire discriminator, `surprise_rolled`."
    },
    "side": {
      "title": "Side",
      "type": "string",
      "description": "Which side rolled: `\"party\"` or `\"monsters\"`."
    },
    "threshold": {
      "title": "Threshold",
      "type": "integer",
      "description": "The number on a d6 at or under which that side is surprised. It is 2 as a rule, and 3 for a\nparty moving in the dark without infravision."
    },
    "roll": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Roll",
      "description": "The d6 that came up, or `None` when this side never had to roll."
    },
    "surprised": {
      "title": "Surprised",
      "type": "boolean",
      "description": "Whether this side was surprised."
    }
  },
  "required": [
    "side",
    "threshold",
    "surprised"
  ],
  "title": "SurpriseRolledEvent",
  "type": "object"
}