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\nYou read these off the event's `entries` to show what each side or combatant rolled. Which of the two it is\ndepends on the event's `mode`.",
"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 participant, oldest first. A tie is re-rolled, so a tuple longer than one entry\nis the record of a tie and the rolls that broke it. The last entry is the one that counts."
},
"modifier": {
"default": 0,
"title": "Modifier",
"type": "integer",
"description": "The adjustment added to the final roll. Under individual initiative a character's comes from dexterity\nand class, from `participant_modifier`, and a monster's is\nwhatever the caller passed."
},
"total": {
"title": "Total",
"type": "integer",
"description": "The last roll plus the modifier, which is the number the order was sorted on."
}
},
"required": [
"key",
"rolls",
"total"
],
"title": "InitiativeRoll",
"type": "object"
},
"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": "Who acts first this round, and what everyone rolled to get there.\n\n`roll_initiative` emits one of these at the top of each combat round.\nRead `order` to know whose turn comes 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: the order of play is something everyone at the table can see."
},
"event_type": {
"const": "initiative_rolled",
"default": "initiative_rolled",
"title": "Event Type",
"type": "string",
"description": "The wire name for this event type."
},
"mode": {
"enum": [
"side",
"individual"
],
"title": "Mode",
"type": "string",
"description": "How initiative was rolled: `\"side\"` when one roll sets the order for a whole side, `\"individual\"` when\nevery combatant rolled for itself."
},
"entries": {
"items": {
"$ref": "#/$defs/InitiativeRoll"
},
"title": "Entries",
"type": "array",
"description": "One `InitiativeRoll` per participant, in the order they were passed\nin rather than the order they act."
},
"order": {
"items": {
"type": "string"
},
"title": "Order",
"type": "array",
"description": "The acting order for the round, first to last. The entries are side names or combatant entity ids,\nmatching `mode`."
}
},
"required": [
"mode",
"entries",
"order"
],
"title": "InitiativeRolledEvent",
"type": "object"
}