{
  "id": "023_white_wolf_mountain",
  "name": "White Wolf Mountain",
  "objectives": {
    "victory": "Reach the Wuhuan command ridge with Cao Cao, then defeat Tadun's guard and the Yuan exile force.",
    "defeat": "Cao Cao is defeated or the battle reaches Turn 18."
  },
  "conditions": {
    "victory": { "type": "all_units_defeated", "team": "enemy", "after_event": "command_ridge_reached" },
    "defeat": [
      { "type": "any_officer_defeated", "team": "player", "officer_ids": ["cao_cao"] },
      { "type": "turn_reached", "turn": 18, "team": "player" }
    ]
  },
  "briefing": {
    "title": "White Wolf Mountain",
    "location": "White Wolf Mountain, 204 CE",
    "lines": [
      "The Yuan brothers' envoys have failed to hide the White Wolf road. Wuhuan outriders now gather around a vanguard camp in the hills.",
      "Cao Cao advances before the frontier chiefs can turn scattered riders into a full host."
    ],
    "conditional_lines": [
      {
        "campaign_flags": { "struck_wuhuan_vanguard": true },
        "lines": [
          "The first strike has shaken the Wuhuan forward riders, leaving the camp alert but short on time to form ranks."
        ]
      },
      {
        "campaign_flags": { "fortified_white_wolf_route": true },
        "lines": [
          "The fortified White Wolf road keeps supplies close behind the army, giving Cao Cao room to force the hills methodically."
        ]
      }
    ]
  },
  "shop": {
    "items": [
      "bean",
      "wine",
      "iron_sword",
      "training_spear",
      "short_bow",
      "hand_axe",
      "war_axe",
      "leather_armor",
      "iron_armor"
    ],
    "conditional_items": [
      {
        "campaign_flags": { "struck_wuhuan_vanguard": true },
        "items": ["war_drum"]
      },
      {
        "campaign_flags": { "fortified_white_wolf_route": true },
        "items": ["imperial_seal"]
      }
    ]
  },
  "roster": {
    "max_units": 7,
    "required_officers": ["cao_cao", "guo_jia"]
  },
  "formation": {
    "cells": [[1, 3], [1, 4], [1, 5], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6]]
  },
  "map": {
    "width": 18,
    "height": 11,
    "terrain": [
      "GGHHHHGGGGHHHHGGGG",
      "GGFHHHGGRRGHHHFFGG",
      "GGRRRRRRRRRRRRFFGG",
      "GGGFGHGGHGRRGGGGGG",
      "RRRRRRRRRRRRRRRRRR",
      "GGGGGHHHHGRRGFFGGG",
      "GGHHGFFFGGFFFGGHHG",
      "GGHHGFFFGGFFFGGHHG",
      "GGGGGGFFGGHHHGGGGG",
      "GGFFGGGGGGHHHFFGGG",
      "GGGGGGGGGGGGGGGGGG"
    ]
  },
  "deployments": [
    {
      "unit_id": "cao_cao_ch23",
      "officer_id": "cao_cao",
      "team": "player",
      "pos": [1, 4]
    },
    {
      "unit_id": "guo_jia_ch23",
      "officer_id": "guo_jia",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 4]
    },
    {
      "unit_id": "zhang_he_ch23",
      "officer_id": "zhang_he",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 3]
    },
    {
      "unit_id": "xiahou_dun_ch23",
      "officer_id": "xiahou_dun",
      "team": "player",
      "pos": [1, 5]
    },
    {
      "unit_id": "dian_wei_ch23",
      "officer_id": "dian_wei",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 5]
    },
    {
      "unit_id": "xiahou_yuan_ch23",
      "officer_id": "xiahou_yuan",
      "team": "player",
      "requires_joined": true,
      "pos": [3, 3]
    },
    {
      "unit_id": "cao_ren_ch23",
      "officer_id": "cao_ren",
      "team": "player",
      "requires_joined": true,
      "pos": [3, 4]
    },
    {
      "unit_id": "tadun_vanguard_chief",
      "name": "Tadun Vanguard Chief",
      "class_id": "elite_cavalry",
      "team": "enemy",
      "level": 22,
      "pos": [14, 4],
      "base": { "hp": 92, "mp": 8, "atk": 28, "def": 18, "int": 9, "agi": 20 }
    },
    {
      "unit_id": "yuan_exile_captain",
      "name": "Yuan Exile Captain",
      "class_id": "commander",
      "team": "enemy",
      "level": 22,
      "pos": [13, 5],
      "base": { "hp": 96, "mp": 28, "atk": 26, "def": 21, "int": 17, "agi": 14 }
    },
    {
      "unit_id": "wuhuan_shaman",
      "name": "Wuhuan Shaman",
      "class_id": "military_advisor",
      "team": "enemy",
      "level": 21,
      "pos": [15, 5],
      "skills": ["blaze", "great_mend"],
      "base": { "hp": 62, "mp": 46, "atk": 7, "def": 11, "int": 24, "agi": 12 }
    },
    {
      "unit_id": "white_wolf_rider_north",
      "name": "White Wolf Rider",
      "class_id": "elite_cavalry",
      "team": "enemy",
      "level": 21,
      "pos": [12, 3],
      "base": { "hp": 70, "atk": 25, "def": 15, "agi": 19 }
    },
    {
      "unit_id": "white_wolf_rider_south",
      "name": "White Wolf Rider",
      "class_id": "elite_cavalry",
      "team": "enemy",
      "level": 21,
      "pos": [12, 5],
      "base": { "hp": 70, "atk": 25, "def": 15, "agi": 19 }
    },
    {
      "unit_id": "wuhuan_bow_north",
      "name": "Wuhuan Bow Rider",
      "class_id": "marksman",
      "team": "enemy",
      "level": 21,
      "pos": [13, 2],
      "base": { "hp": 56, "atk": 24, "def": 10, "agi": 18 }
    },
    {
      "unit_id": "wuhuan_bow_south",
      "name": "Wuhuan Bow Rider",
      "class_id": "marksman",
      "team": "enemy",
      "level": 21,
      "pos": [14, 6],
      "base": { "hp": 56, "atk": 24, "def": 10, "agi": 18 }
    },
    {
      "unit_id": "yuan_banner_guard",
      "name": "Yuan Banner Guard",
      "class_id": "guard_captain",
      "team": "enemy",
      "level": 21,
      "pos": [15, 3],
      "base": { "hp": 74, "atk": 24, "def": 20 }
    }
  ],
  "events": [
    {
      "id": "opening",
      "once": true,
      "when": { "type": "battle_start" },
      "actions": [
        { "type": "log", "text": "Wuhuan riders gather at White Wolf while Yuan exiles offer banners and gifts." }
      ]
    },
    {
      "id": "opening_dialogue",
      "once": true,
      "when": { "type": "battle_begin" },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Guo Jia", "text": "The Yuan brothers have found horsemen, but not yet an army." },
            { "speaker": "Cao Cao", "text": "Then we strike while they are still choosing whose banner to follow." },
            { "speaker": "Zhang He", "text": "The Wuhuan chief watches the road, not the camp. He expects us to crawl through the hills." }
          ]
        }
      ]
    },
    {
      "id": "scattered_vanguard_returns",
      "once": true,
      "when": { "type": "turn_start", "team": "enemy", "turn": 2, "campaign_flags": { "struck_wuhuan_vanguard": true } },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Tadun Vanguard Chief", "text": "Their first blow came too soon. Call the riders back before Cao Cao splits the camp." },
            { "speaker": "Xiahou Dun", "text": "They are calling men who have already started running." }
          ]
        },
        {
          "type": "spawn_deployment",
          "deployment": {
            "unit_id": "scattered_wuhuan_rider",
            "name": "Scattered Wuhuan Rider",
            "class_id": "cavalry",
            "team": "enemy",
            "level": 21,
            "pos": [16, 3],
            "base": { "hp": 60, "atk": 23, "def": 12, "agi": 16 }
          }
        }
      ]
    },
    {
      "id": "fortified_route_support",
      "once": true,
      "when": { "type": "turn_start", "team": "player", "turn": 2, "campaign_flags": { "fortified_white_wolf_route": true } },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Cao Ren", "text": "The road behind us is held. If the riders circle, they meet our wagons and shields." },
            { "speaker": "Cao Cao", "text": "Good. Let the camp learn that our rear is not prey." }
          ]
        }
      ]
    },
    {
      "id": "turn_4_wuhuan_charge",
      "once": true,
      "when": { "type": "turn_start", "team": "enemy", "turn": 4 },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Tadun Vanguard Chief", "text": "Circle the southern men. The mountain belongs to riders who know its wind." },
            { "speaker": "Guo Jia", "text": "Their pride has chosen a path for them. Close it." }
          ]
        }
      ]
    },
    {
      "id": "command_ridge_reached",
      "once": true,
      "when": { "type": "unit_reaches_tile", "team": "player", "officer_ids": ["cao_cao"], "pos": [10, 4] },
      "actions": [
        {
          "type": "set_objective",
          "victory": "The command ridge is reached. Defeat Tadun's guard and the Yuan exile force.",
          "defeat": "Cao Cao is defeated or the battle reaches Turn 18."
        },
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Cao Cao", "text": "There is the ridge. Break the riders before the chiefs arrive." },
            { "speaker": "Tadun Vanguard Chief", "text": "White Wolf does not bend to men from the south. Ride them down!" }
          ]
        },
        {
          "type": "spawn_deployments",
          "deployments": [
            {
              "unit_id": "tadun_command_guard",
              "name": "Tadun Command Guard",
              "class_id": "guard_captain",
              "team": "enemy",
              "level": 21,
              "pos": [16, 4],
              "base": { "hp": 72, "atk": 24, "def": 19 }
            },
            {
              "unit_id": "yuan_exile_archer",
              "name": "Yuan Exile Archer",
              "class_id": "archer",
              "team": "enemy",
              "level": 21,
              "pos": [16, 5],
              "base": { "hp": 50, "atk": 22, "def": 8, "agi": 16 }
            }
          ]
        }
      ]
    },
    {
      "id": "turn_9_frontier_breaks",
      "once": true,
      "when": { "type": "turn_start", "team": "player", "turn": 9 },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Zhang He", "text": "The camp fires are moving. They are packing before the battle is decided." },
            { "speaker": "Cao Cao", "text": "Then decide it loudly enough for the hills to hear." }
          ]
        }
      ]
    }
  ],
  "rewards": {
    "gold": 4400,
    "items": ["bean", "wine", "imperial_seal"]
  },
  "post_battle_dialogue": [
    { "speaker": "Guo Jia", "text": "The White Wolf line is broken. Wuhuan chiefs will now either bargain from fear or gather out of pride." },
    { "speaker": "Zhang He", "text": "The Yuan brothers are still beyond the next ridge, but their borrowed shield has cracked." },
    { "speaker": "Cao Cao", "text": "Then choose whether we press toward Liaodong or turn Wuhuan submission into a quieter frontier." }
  ],
  "post_battle_choices": [
    {
      "id": "press_liaodong_pursuit",
      "label": "Chase Yuan",
      "description": "Cao Cao drives toward Liaodong before the Yuan brothers can find another camp.",
      "set_flags": { "pressed_liaodong_pursuit": true, "secured_wuhuan_submission": false },
      "gold": 350,
      "items": ["war_drum"]
    },
    {
      "id": "secure_wuhuan_submission",
      "label": "Secure Submission",
      "description": "The army takes hostages and pledges from Wuhuan chiefs before pursuing the Yuan brothers.",
      "set_flags": { "pressed_liaodong_pursuit": false, "secured_wuhuan_submission": true },
      "gold": 650,
      "items": ["imperial_seal"]
    }
  ]
}
