BattleEndedEvent
The battle is over: won, quit, or lost.
Full documentation: BattleEndedEvent. Wire type: battle_ended.
Default visibility: player
Message codes: battle.ended.defeat, battle.ended.fled, battle.ended.victory
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": "The battle is over: won, quit, or lost.\n\nEmitted by `ResolveBattleRound`, and\nby `EngageBattle` when the opposition\nbreaks before the first exchange.\n\nA victory ends the encounter with it. A retreat may leave the party in a chase\nrather than clear of the fight. A defeat means nobody is left standing, and a\n`GameOverEvent` closes the same result.",
"properties": {
"code": {
"title": "Code",
"type": "string",
"description": "What happened, as two or more lowercase segments separated by dots and namespaced by subsystem, like\n`combat.attack.hit`. This is what you branch on and what\n`format_message` looks up. Anything else raises a validation error."
},
"visibility": {
"$ref": "#/$defs/Visibility",
"default": "player",
"description": "Player visibility: the fight is the party's own."
},
"event_type": {
"const": "battle_ended",
"default": "battle_ended",
"title": "Event Type",
"type": "string",
"description": "The wire discriminator, `battle_ended`."
}
},
"required": [
"code"
],
"title": "BattleEndedEvent",
"type": "object"
}