SurpriseRolledEvent
One side's surprise die, rolled in secret.
Full documentation: SurpriseRolledEvent. Wire type: surprise_rolled.
Default visibility: referee
Message codes: encounter.surprise.rolled
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": "One side's surprise die, rolled in secret.\n\nEmitted twice when an encounter opens, once for each side, before\n`EncounterStartedEvent` reports the\noutcomes to the players.\n\nA side that can't be surprised doesn't roll, and its event has `roll` set to `None`.\nThe party doesn't roll when it already heard the monsters through the door. The\nmonsters don't roll when they know the party is coming, when they can see its light,\nor when they're wandering monsters, which know the dungeon. An NPC party met on a\nwandering check still rolls.",
"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 players through the\nencounter event."
},
"event_type": {
"const": "surprise_rolled",
"default": "surprise_rolled",
"title": "Event Type",
"type": "string",
"description": "The event type, `surprise_rolled`, which identifies this class in serialized form."
},
"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's 2, except for a party\nwithout light that has a living member without infravision, where it's 3."
},
"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"
}