Skip to content

LevelDrainedEvent

Energy drain resolved: levels lost, with the terminal case as its own code.

Full documentation: LevelDrainedEvent. Wire type: level_drained.

Default visibility: player

Message codes: combat.drain.drained, combat.drain.slain

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": "Energy drain resolved: levels lost, with the terminal case as its own code.\n\nEmitted by [`drain_monster_hd`][osrlib.core.combat.drain_monster_hd] or\n[`drain_levels`][osrlib.core.classes.drain_levels]. `code` is\n`combat.drain.drained` for levels lost, or `combat.drain.slain` for the terminal\ncase \u2014 the victim is already at level 1 (or 1 Hit Die or fewer) with nowhere\nleft to drain, so the drain kills it outright.\n\n`spawn_consequence` is the structured-but-manual field carrying the SRD's spawn\nprose (\"becomes a wight in 1d4 days, under the control of the wight that killed\nthem\") \u2014 the kernel kills, the game narrates.",
  "properties": {
    "code": {
      "title": "Code",
      "type": "string"
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "player"
    },
    "event_type": {
      "const": "level_drained",
      "default": "level_drained",
      "title": "Event Type",
      "type": "string"
    },
    "target_id": {
      "title": "Target Id",
      "type": "string"
    },
    "levels_lost": {
      "title": "Levels Lost",
      "type": "integer"
    },
    "new_level": {
      "title": "New Level",
      "type": "integer"
    },
    "hp_lost": {
      "title": "Hp Lost",
      "type": "integer"
    },
    "xp_after": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Xp After"
    },
    "spawn_consequence": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Spawn Consequence"
    }
  },
  "required": [
    "code",
    "target_id",
    "levels_lost",
    "new_level",
    "hp_lost"
  ],
  "title": "LevelDrainedEvent",
  "type": "object"
}