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 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 referee rolled dice for something the rules don't cover.\n\nEmitted by `RollDice`. The roll comes off the\nsession's own adjudication stream, kept apart from the streams the rules use, so\na referee rolling for weather or a rumour never shifts the dice a later attack or\nsave would have drawn.\n\nIt's referee visibility: a hidden adjudication isn't automatically the table's\nto see. Show it to the players yourself when the ruling was made 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 wire discriminator, `dice_rolled`."
    },
    "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 own result, in roll order, so a transcript can show the dice rather than only\nthe sum."
    }
  },
  "required": [
    "expression",
    "total",
    "rolls"
  ],
  "title": "DiceRolledEvent",
  "type": "object"
}