Skip to content

AttackRolledEvent

An attack roll resolved: the die, the modifiers, and what it needed.

Full documentation: AttackRolledEvent. Wire type: attack_rolled.

Default visibility: player

Message codes: combat.attack.auto_hit, combat.attack.hit, combat.attack.missed

JSON Schema

{
  "$defs": {
    "Visibility": {
      "description": "Who may see an event.\n\nThe wire values are `\"player\"` and `\"referee\"` \u2014 lowercase, serialized into every\nevent; changing them is a `schema_version` bump.",
      "enum": [
        "player",
        "referee"
      ],
      "title": "Visibility",
      "type": "string"
    }
  },
  "description": "An attack roll resolved: the die, the modifiers, and what it needed.\n\nEmitted by [`attack_roll`][osrlib.core.combat.attack_roll]. `code` is\n`combat.attack.hit` or `combat.attack.missed` for a rolled attack, or\n`combat.attack.auto_hit` for a helpless target (no roll required); `roll`,\n`total`, and `required` are `None` in the auto-hit case. `natural` carries 1 or\n20 when the natural roll overrode the modified total.",
  "properties": {
    "code": {
      "title": "Code",
      "type": "string"
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "player"
    },
    "event_type": {
      "const": "attack_rolled",
      "default": "attack_rolled",
      "title": "Event Type",
      "type": "string"
    },
    "attacker_id": {
      "title": "Attacker Id",
      "type": "string"
    },
    "defender_id": {
      "title": "Defender Id",
      "type": "string"
    },
    "attack_name": {
      "title": "Attack Name",
      "type": "string"
    },
    "roll": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Roll"
    },
    "modifier": {
      "default": 0,
      "title": "Modifier",
      "type": "integer"
    },
    "total": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Total"
    },
    "required": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Required"
    },
    "defender_ac": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Defender Ac"
    },
    "natural": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Natural"
    }
  },
  "required": [
    "code",
    "attacker_id",
    "defender_id",
    "attack_name"
  ],
  "title": "AttackRolledEvent",
  "type": "object"
}