Skip to content

HitPointsReportedEvent

Where a creature's hit points stand after something changed them.

Full documentation: HitPointsReportedEvent. Wire type: hit_points_reported.

Default visibility: referee

Message codes: combat.state.hit_points

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": "Where a creature's hit points stand after something changed them.\n\nAnything that moves hit points emits one of these right after it: damage, healing, death, energy drain, a\nregeneration tick. Follow them and you always know the true state without reading the creature objects.\n\nThis is the only event that reports a creature's standing current and maximum. The others report the\nchange alone: `DamageDealtEvent` the size of a hit,\n`LevelDrainedEvent` the maximum a drain took off. It's\nreferee-visible on purpose, because B/X keeps monster hit points hidden, so show the players the change\nevents instead.",
  "properties": {
    "code": {
      "default": "combat.state.hit_points",
      "title": "Code",
      "type": "string",
      "description": "Fixed at `combat.state.hit_points`."
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "referee",
      "description": "Referee visibility: monster hit points are hidden by design."
    },
    "event_type": {
      "const": "hit_points_reported",
      "default": "hit_points_reported",
      "title": "Event Type",
      "type": "string",
      "description": "The wire name for this event type."
    },
    "target_id": {
      "title": "Target Id",
      "type": "string",
      "description": "The entity id of the creature reported on."
    },
    "current_hp": {
      "title": "Current Hp",
      "type": "integer",
      "description": "Hit points now, never below 0."
    },
    "max_hp": {
      "title": "Max Hp",
      "type": "integer",
      "description": "Hit points at full, which energy drain can lower."
    }
  },
  "required": [
    "target_id",
    "current_hp",
    "max_hp"
  ],
  "title": "HitPointsReportedEvent",
  "type": "object"
}