Skip to content

BattleStartedEvent

Blows have been struck: the encounter became a battle.

Full documentation: BattleStartedEvent. Wire type: battle_started.

Default visibility: player

Message codes: battle.started

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": "Blows have been struck: the encounter became a battle.\n\nEmitted when a fight opens, by `EngageBattle`\nwhen the party attacks, and on its own when the monsters do, which can happen\nthe moment an encounter opens, when a parley goes wrong, when undead are\npresented with a holy symbol, or when a chase ends in capture.\n\nThe session mode becomes `battle`, where\n`ResolveBattleRound` is the only play\ncommand the session accepts. Positions are no longer cells: each monster group\nhas a distance from the party, and closing or pulling back moves that number.",
  "properties": {
    "code": {
      "default": "battle.started",
      "title": "Code",
      "type": "string",
      "description": "The message code, always `battle.started`."
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "player",
      "description": "Player visibility: the party is in it."
    },
    "event_type": {
      "const": "battle_started",
      "default": "battle_started",
      "title": "Event Type",
      "type": "string",
      "description": "The wire discriminator, `battle_started`."
    }
  },
  "title": "BattleStartedEvent",
  "type": "object"
}