Skip to content

HealingAppliedEvent

Hit points restored, or healing refused.

Full documentation: HealingAppliedEvent. Wire type: healing_applied.

Default visibility: player

Message codes: combat.healing.applied, combat.healing.blocked

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": "Hit points restored, or healing refused.\n\n`apply_healing` reports this, and so does\n`EffectsLedger.advance` each round a regeneration effect heals. Read\n`amount`, not the amount you asked for: healing stops at the creature's maximum hit points, and a cursed creature\nmay have had it halved.\n\n`apply_healing` can also refuse healing. Then the code is `combat.healing.blocked` and `amount` is 0. A diseased\ncreature gets no magical healing, and a weakened one gets no healing at all.",
  "properties": {
    "code": {
      "title": "Code",
      "type": "string",
      "description": "What happened, like `combat.attack.hit`: two or more lowercase parts separated by dots. The first part is\nthe area of the rules the event comes from, like `combat` or `magic`.\n\nBranch on it, and pass the event to `format_message` to turn it into English.\nBuilding an event with a code in any other format raises a pydantic `ValidationError`."
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "player",
      "description": "Player visibility: everyone sees a wound close. The hit points the creature now has are in the\n`HitPointsReportedEvent` that follows, which only the referee\nsees."
    },
    "event_type": {
      "const": "healing_applied",
      "default": "healing_applied",
      "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 that was healed."
    },
    "amount": {
      "title": "Amount",
      "type": "integer",
      "description": "The hit points restored, after the maximum and any halving. 0 when the healing was blocked."
    },
    "source": {
      "title": "Source",
      "type": "string",
      "description": "Where the healing came from: `magical` for a spell or potion, `natural` for rest, or `regeneration` for a\nregenerating creature."
    }
  },
  "required": [
    "code",
    "target_id",
    "amount",
    "source"
  ],
  "title": "HealingAppliedEvent",
  "type": "object"
}