MoraleCheckedEvent
A side's morale check, and whether the side held.
Full documentation: MoraleCheckedEvent. Wire type: morale_checked.
Default visibility: referee
Message codes: combat.morale.broke, combat.morale.exempt, combat.morale.held
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": "A side's morale check, and whether the side held.\n\n`check_morale` reports one of these each time a side checks morale. A side\nthat breaks flees or surrenders, and making it do so is up to you.\n\nAt some morale scores, a side never rolls. A side with a score of 2 or less never fights, and a side with 12 or\nmore never checks. `check_morale` reports both with `combat.morale.exempt` and no roll. Read `held` to tell them\napart, as for any other code: at 2 or less the side has broken, and at 12 or more it holds.",
"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": "referee",
"description": "Referee visibility: the players learn that a side has broken by watching it run."
},
"event_type": {
"const": "morale_checked",
"default": "morale_checked",
"title": "Event Type",
"type": "string",
"description": "The fixed string that identifies this event class in a serialized event."
},
"subject": {
"title": "Subject",
"type": "string",
"description": "The key of the side whose morale was checked, as you passed it."
},
"score": {
"title": "Score",
"type": "integer",
"description": "The side's morale score. A side with a score from 3 to 11 rolls. A side with 2 or less doesn't roll and has\nbroken, and a side with 12 or more doesn't roll and holds."
},
"roll": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Roll",
"description": "The 2d6 total, before the modifier. `None` when the side didn't roll."
},
"modifier": {
"default": 0,
"title": "Modifier",
"type": "integer",
"description": "The adjustment applied, after it was limited to the range \u22122 to +2."
},
"held": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"default": null,
"title": "Held",
"description": "Whether the side keeps fighting.\n\n`check_morale` sets it on every event, whatever the code. After a roll, it's\nthe outcome of the roll. It's `True` for a score of 12 or more, and `False` for a score of 2 or less. Show the\noutcome from this field, not from the code and the score. It's `None` on an event loaded from a save written\nbefore the field existed, because osrlib doesn't fill it in when it loads such a save."
}
},
"required": [
"code",
"subject",
"score"
],
"title": "MoraleCheckedEvent",
"type": "object"
}