Skip to content

ConditionGainedEvent

A creature has fallen asleep, been turned to stone, or otherwise taken on a named state.

Full documentation: ConditionGainedEvent. Wire type: condition_gained.

Default visibility: player

Message codes: effects.condition.gained

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": "A creature has fallen asleep, been turned to stone, or otherwise taken on a named state.\n\n`grant_condition` emits this, whether you called it yourself or\n`EffectsLedger.attach` called it for you while attaching an\neffect that brings a condition with it. A creature immune to the condition produces no event at all.",
  "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 wire name for this event type."
    },
    "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 granted it and will take it back, or `None` for a state no effect owns, which\nin the core rules means `dead`."
    }
  },
  "required": [
    "target_id",
    "condition"
  ],
  "title": "ConditionGainedEvent",
  "type": "object"
}