MonsterDefeatedEvent
One monster was defeated, with the experience it's worth.
Full documentation: MonsterDefeatedEvent. Wire type: monster_defeated.
Default visibility: player
Message codes: battle.monster.defeated
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": "One monster was defeated, with the experience it's worth.\n\nEmitted when the encounter ends, once for each creature that was slain, ran away, or\nwas turned, before the `EncounterEndedEvent`.\nA creature the party got away from without defeating has no event.\n\nThe session adds up their `xp` for the experience award. Under the default ruleset the\naward arrives as an `AdventureXpAwardEvent`\nwhen the party travels back to town. When\n`Ruleset.xp_award_timing` is set to award\nexperience immediately, each survivor's\n`XpAwardedEvent` arrives at the end of the\nencounter instead, before the `EncounterEndedEvent`.",
"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 event type, `monster_defeated`, which identifies this class in serialized form."
},
"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 was defeated: `\"slain\"`, or `\"routed\"` when it ran away 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"
}