Skip to content

UndeadTurnedEvent

A cleric tried to turn undead, and this is what happened.

Full documentation: UndeadTurnedEvent. Wire type: undead_turned.

Default visibility: player

Message codes: magic.turning.destroyed, magic.turning.failed, magic.turning.turned

JSON Schema

{
  "$defs": {
    "TurningTypeOutcome": {
      "description": "How one kind of monster fared against a cleric's attempt to turn undead.\n\n`turn_undead` reads the turning table once for each kind of monster present, not once for each monster, and\neach of these is one reading. Read them from the `types` field of an\n`UndeadTurnedEvent`.",
      "properties": {
        "template_id": {
          "title": "Template Id",
          "type": "string",
          "description": "The monster template's content id, like `\"skeleton\"`."
        },
        "column": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Column",
          "description": "The turning table column this kind is read in, which depends on its Hit Dice. `None` when the kind is too\nstrong to have a column, or isn't undead."
        },
        "outcome": {
          "title": "Outcome",
          "type": "string",
          "description": "The result for this kind, as one of four strings.\n\n`turn` means the roll reached the threshold, or the table's entry is an automatic turn. `fail` means the roll\nfell short, the table's entry gives the cleric no chance, or the kind has no column. `destroy` means the\ntable's entry at the cleric's level is an automatic destroy. `unaffected` means the monster isn't undead."
        },
        "threshold": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Threshold",
          "description": "The 2d6 total the cleric needed for this kind. `None` when the table has an automatic result instead of\na number."
        }
      },
      "required": [
        "template_id",
        "outcome"
      ],
      "title": "TurningTypeOutcome",
      "type": "object"
    },
    "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 cleric tried to turn undead, and this is what happened.\n\n`turn_undead` reports one of these for each attempt. Turning takes two\nrolls. `turn_undead` reads the first on the turning table once for each kind of undead present. When any kind is\nturned or destroyed, a second roll sets how many Hit Dice of those kinds are affected. What then happens to each\nmonster comes as separate events: a condition gained, or a death.",
  "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": "player",
      "description": "Player visibility: the player rolls the turning dice."
    },
    "event_type": {
      "const": "undead_turned",
      "default": "undead_turned",
      "title": "Event Type",
      "type": "string",
      "description": "The fixed string that identifies this event class in a serialized event."
    },
    "caster_id": {
      "title": "Caster Id",
      "type": "string",
      "description": "The entity id of the cleric who tried to turn undead."
    },
    "roll": {
      "title": "Roll",
      "type": "integer",
      "description": "The first 2d6, read on the turning table."
    },
    "hd_pool": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Hd Pool",
      "description": "The second 2d6: how many Hit Dice of undead the turning affects. `None` when no kind was turned or\ndestroyed, so no second roll was made.\n\n`turn_undead` takes the weakest undead first. When the next one has more Hit Dice than are left, the rest go\nunused, and it takes no other monster in its place."
    },
    "types": {
      "default": [],
      "items": {
        "$ref": "#/$defs/TurningTypeOutcome"
      },
      "title": "Types",
      "type": "array",
      "description": "One `TurningTypeOutcome` for each kind of monster present, in the\norder you listed the monsters."
    },
    "affected_ids": {
      "default": [],
      "items": {
        "type": "string"
      },
      "title": "Affected Ids",
      "type": "array",
      "description": "The entity ids of the monsters the second roll reached. When any kind was turned or destroyed, at least one\nmonster is affected, even when the second roll was too low for it."
    }
  },
  "required": [
    "code",
    "caster_id",
    "roll"
  ],
  "title": "UndeadTurnedEvent",
  "type": "object"
}