HitPointsReportedEvent
A creature's hit points 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 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": "A creature's hit points after something changed them.\n\nEvery rules function that changes hit points reports one of these right after the change: the functions for\ndamage, healing, death, energy drain, and regeneration. Follow them and you know every creature's hit points without\nreading the creatures.\n\nThis is the only event with a creature's current and maximum hit points. The others report only the change:\na `DamageDealtEvent` the damage, and a\n`LevelDrainedEvent` the maximum hit points lost. Only the referee\nsees this event, because in B/X the players don't see monster hit points. Show the players the events that\nreport the change.",
"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: in B/X, the players don't see monster hit points."
},
"event_type": {
"const": "hit_points_reported",
"default": "hit_points_reported",
"title": "Event Type",
"type": "string",
"description": "The fixed string that identifies this event class in a serialized event."
},
"target_id": {
"title": "Target Id",
"type": "string",
"description": "The entity id of the creature reported on."
},
"current_hp": {
"title": "Current Hp",
"type": "integer",
"description": "The creature's hit points now, never below 0."
},
"max_hp": {
"title": "Max Hp",
"type": "integer",
"description": "The creature's maximum hit points, which energy drain can lower."
}
},
"required": [
"target_id",
"current_hp",
"max_hp"
],
"title": "HitPointsReportedEvent",
"type": "object"
}