Skip to content

TargetsSelectedEvent

Who a spell, a breath weapon, or a thrown flask ended up catching.

Full documentation: TargetsSelectedEvent. Wire type: targets_selected.

Default visibility: referee

Message codes: combat.targeting.selected

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": "Who a spell, a breath weapon, or a thrown flask ended up catching.\n\n`select_targets` emits this before the resolution that follows, so a log\nrecords which candidates a Hit Dice budget or an area actually reached rather than only who was standing\nnearby.",
  "properties": {
    "code": {
      "default": "combat.targeting.selected",
      "title": "Code",
      "type": "string",
      "description": "Fixed at `combat.targeting.selected`."
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "referee",
      "description": "Referee visibility: this is bookkeeping. What the targets then suffer arrives as its own events."
    },
    "event_type": {
      "const": "targets_selected",
      "default": "targets_selected",
      "title": "Event Type",
      "type": "string",
      "description": "The wire name for this event type."
    },
    "mode": {
      "title": "Mode",
      "type": "string",
      "description": "How targets were chosen, as a `TargetingMode` value: `self`,\n`single`, `up_to_n`, `hd_budget`, `area`, or `gaze`."
    },
    "target_ids": {
      "items": {
        "type": "string"
      },
      "title": "Target Ids",
      "type": "array",
      "description": "The entity ids selected, in resolution order."
    }
  },
  "required": [
    "mode",
    "target_ids"
  ],
  "title": "TargetsSelectedEvent",
  "type": "object"
}