Skip to content

TargetsSelectedEvent

Which of the candidates a spell reached.

Full documentation: TargetsSelectedEvent. Wire type: targets_selected.

Default visibility: referee

Message codes: combat.targeting.selected

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": "Which of the candidates a spell reached.\n\n`select_targets` reports this before the spell's other events, so a log\nshows which creatures a spell like *sleep* or *hold person* reached, not only the creatures it was aimed\nat.",
  "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 a record for the referee. What happens to the targets comes as separate\nevents."
    },
    "event_type": {
      "const": "targets_selected",
      "default": "targets_selected",
      "title": "Event Type",
      "type": "string",
      "description": "The fixed string that identifies this event class in a serialized event."
    },
    "mode": {
      "title": "Mode",
      "type": "string",
      "description": "How the 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 of the selected creatures, in the order they were chosen."
    }
  },
  "required": [
    "mode",
    "target_ids"
  ],
  "title": "TargetsSelectedEvent",
  "type": "object"
}