Skip to content

ConditionGainedEvent

A creature has fallen asleep, been turned to stone, or otherwise gained a condition.

Full documentation: ConditionGainedEvent. Wire type: condition_gained.

Default visibility: player

Message codes: effects.condition.gained

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 creature has fallen asleep, been turned to stone, or otherwise gained a condition.\n\nA condition is a named state, from `Condition`, that changes what a creature\ncan do. `grant_condition` reports this, whether you called it yourself\nor `EffectsLedger.attach` called it while attaching an effect that\ngives a condition. It reports no event for a creature immune to the condition, or for one that already has it\nfrom the same effect.",
  "properties": {
    "code": {
      "default": "effects.condition.gained",
      "title": "Code",
      "type": "string",
      "description": "Fixed at `effects.condition.gained`."
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "player",
      "description": "Player visibility: a creature going rigid or falling asleep is plain to see."
    },
    "event_type": {
      "const": "condition_gained",
      "default": "condition_gained",
      "title": "Event Type",
      "type": "string",
      "description": "The fixed string that identifies this event class in a serialized event."
    },
    "target_id": {
      "title": "Target Id",
      "type": "string",
      "description": "The entity id of the creature that gained the condition."
    },
    "condition": {
      "title": "Condition",
      "type": "string",
      "description": "The condition, as a `Condition` value like `asleep` or `petrified`."
    },
    "effect_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Effect Id",
      "description": "The id of the effect that gave the condition and takes it away when it ends, or `None` for a condition\nthat doesn't come from an effect. In the core rules, that's `dead`."
    }
  },
  "required": [
    "target_id",
    "condition"
  ],
  "title": "ConditionGainedEvent",
  "type": "object"
}