Skip to content

MonsterDefeatedEvent

One monster is out of the fight, and here is what it was worth.

Full documentation: MonsterDefeatedEvent. Wire type: monster_defeated.

Default visibility: player

Message codes: battle.monster.defeated

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": "One monster is out of the fight, and here is what it was worth.\n\nEmitted once per defeated creature when the encounter concludes, which follows\nthe last `ResolveBattleRound` or an\nescape that leaves the fight behind.\n\nThese are the entries the adventure's experience award adds up, and the award\nitself arrives later, as\n`AdventureXpAwardEvent` on the trip\nback to town, or at once when the ruleset awards immediately.",
  "properties": {
    "code": {
      "default": "battle.monster.defeated",
      "title": "Code",
      "type": "string",
      "description": "The message code, always `battle.monster.defeated`."
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "player",
      "description": "Player visibility: the party sees them fall or flee."
    },
    "event_type": {
      "const": "monster_defeated",
      "default": "monster_defeated",
      "title": "Event Type",
      "type": "string",
      "description": "The wire discriminator, `monster_defeated`."
    },
    "monster_id": {
      "title": "Monster Id",
      "type": "string",
      "description": "The session id of the creature that was defeated."
    },
    "template_id": {
      "title": "Template Id",
      "type": "string",
      "description": "What it was: a monster catalog id, or `\"npc:<class id>\"` for a defeated NPC adventurer."
    },
    "outcome": {
      "title": "Outcome",
      "type": "string",
      "description": "How it went out: `\"slain\"`, or `\"routed\"` when it fled or was turned."
    },
    "xp": {
      "title": "Xp",
      "type": "integer",
      "description": "What it's worth: the monster catalog's printed award, or the level-based award for an NPC\nadventurer."
    }
  },
  "required": [
    "monster_id",
    "template_id",
    "outcome",
    "xp"
  ],
  "title": "MonsterDefeatedEvent",
  "type": "object"
}