Skip to content

DiceRolledEvent

The referee rolled dice for something the rules don't cover.

Full documentation: DiceRolledEvent. Wire type: dice_rolled.

Default visibility: referee

Message codes: adjudication.dice_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": "The referee rolled dice for something the rules don't cover.\n\nEmitted by `RollDice`. The dice come from\n`ADJUDICATION_STREAM`, which the session\nuses for no other roll, so a referee rolling for weather or a rumour never changes the\ndice for a later attack or save.\n\nIt has referee visibility, because a referee's roll may be secret. Show it to the\nplayers yourself when you roll in the open.",
  "properties": {
    "code": {
      "default": "adjudication.dice_rolled",
      "title": "Code",
      "type": "string",
      "description": "The message code, always `adjudication.dice_rolled`."
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "referee",
      "description": "Referee visibility: the referee decides what to share."
    },
    "event_type": {
      "const": "dice_rolled",
      "default": "dice_rolled",
      "title": "Event Type",
      "type": "string",
      "description": "The event type, `dice_rolled`, which identifies this class in serialized form."
    },
    "expression": {
      "title": "Expression",
      "type": "string",
      "description": "What was rolled, as the dice expression that was asked for, like `\"2d6+1\"`."
    },
    "total": {
      "title": "Total",
      "type": "integer",
      "description": "The result, dice and modifier together."
    },
    "rolls": {
      "items": {
        "type": "integer"
      },
      "title": "Rolls",
      "type": "array",
      "description": "Each die's result, in roll order, so you can show the dice in a transcript rather than\nonly the sum."
    }
  },
  "required": [
    "expression",
    "total",
    "rolls"
  ],
  "title": "DiceRolledEvent",
  "type": "object"
}