Skip to content

EffectAttachedEvent

An effect has started running on a creature, item, or location.

Full documentation: EffectAttachedEvent. Wire type: effect_attached.

Default visibility: referee

Message codes: effects.effect.attached

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": "An effect has started running on a creature, item, or location.\n\n`EffectsLedger.attach` emits this first, before any condition or\nmodifier the effect grants. Keep the `effect_id` if you plan to end the effect early through\n`EffectsLedger.release`.",
  "properties": {
    "code": {
      "default": "effects.effect.attached",
      "title": "Code",
      "type": "string",
      "description": "Fixed at `effects.effect.attached`."
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "referee",
      "description": "Referee visibility: this is the ledger's bookkeeping. What the players notice is the condition the effect\ngranted, which arrives as its own event."
    },
    "event_type": {
      "const": "effect_attached",
      "default": "effect_attached",
      "title": "Event Type",
      "type": "string",
      "description": "The wire name for this event type."
    },
    "effect_id": {
      "title": "Effect Id",
      "type": "string",
      "description": "The id the ledger allocated for the effect, in the form `effect-0001`."
    },
    "kind": {
      "title": "Kind",
      "type": "string",
      "description": "The effect's kind, from its definition: `\"sleep\"`, `\"regeneration\"`, `\"light\"`, and so on."
    },
    "target_ref": {
      "title": "Target Ref",
      "type": "string",
      "description": "What it attached to: an entity id for a creature, or a location string for something that sits in a\nplace."
    },
    "expires_round": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Expires Round",
      "description": "The absolute round the effect is due to end on, or `None` when it has no duration or is permanent."
    }
  },
  "required": [
    "effect_id",
    "kind",
    "target_ref"
  ],
  "title": "EffectAttachedEvent",
  "type": "object"
}