Skip to content

InitiativeRolledEvent

Who acts first this round, and what everyone rolled to get there.

Full documentation: InitiativeRolledEvent. Wire type: initiative_rolled.

Default visibility: player

Message codes: combat.initiative.rolled

JSON Schema

{
  "$defs": {
    "InitiativeRoll": {
      "description": "One initiative roll on an `InitiativeRolledEvent`.\n\nRead these from the event's `entries` to show what each side or combatant rolled. Check the event's\n`mode` to know which: a side under side initiative, a combatant under individual initiative.",
      "properties": {
        "key": {
          "title": "Key",
          "type": "string",
          "description": "Who rolled: a side's name under side initiative, or a combatant's entity id under individual\ninitiative."
        },
        "rolls": {
          "items": {
            "type": "integer"
          },
          "title": "Rolls",
          "type": "array",
          "description": "Every d6 rolled for this side or combatant, in the order rolled. `roll_initiative` re-rolls a tie, so more\nthan one entry means there was a tie, and the later entries are the rolls that broke it. The last entry is the\none that counts."
        },
        "modifier": {
          "default": 0,
          "title": "Modifier",
          "type": "integer",
          "description": "The modifier added to the last roll. It's 0 under side initiative. Under individual initiative, a\ncharacter's comes from its DEX and class, through\n`participant_modifier`, and a monster's is the one you chose."
        },
        "total": {
          "title": "Total",
          "type": "integer",
          "description": "The last roll plus the modifier. `roll_initiative` sorts the acting order on this total."
        }
      },
      "required": [
        "key",
        "rolls",
        "total"
      ],
      "title": "InitiativeRoll",
      "type": "object"
    },
    "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": "Who acts first this round, and what everyone rolled to get there.\n\n`roll_initiative` reports one of these each time it's called, which is\nat the start of each combat round. Read `order` to know who acts next, and `entries` to show the dice.",
  "properties": {
    "code": {
      "default": "combat.initiative.rolled",
      "title": "Code",
      "type": "string",
      "description": "Fixed at `combat.initiative.rolled`."
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "player",
      "description": "Player visibility: everyone at the table can see the order of play."
    },
    "event_type": {
      "const": "initiative_rolled",
      "default": "initiative_rolled",
      "title": "Event Type",
      "type": "string",
      "description": "The fixed string that identifies this event class in a serialized event."
    },
    "mode": {
      "enum": [
        "side",
        "individual"
      ],
      "title": "Mode",
      "type": "string",
      "description": "How initiative was rolled: `\"side\"` when each side rolled once for all its members, `\"individual\"` when\neach combatant rolled for itself."
    },
    "entries": {
      "items": {
        "$ref": "#/$defs/InitiativeRoll"
      },
      "title": "Entries",
      "type": "array",
      "description": "One `InitiativeRoll` for each side, or for each combatant under\nindividual initiative. They're in the order `roll_initiative` received them, not the order they act."
    },
    "order": {
      "items": {
        "type": "string"
      },
      "title": "Order",
      "type": "array",
      "description": "Every combatant's key, usually its entity id, in the order they act this round, first to last."
    }
  },
  "required": [
    "mode",
    "entries",
    "order"
  ],
  "title": "InitiativeRolledEvent",
  "type": "object"
}