{
  "id": "059_wu_surrender",
  "name": "Wu Surrender",
  "objectives": {
    "victory": "Reach the Wu surrender line with Cao Cao, then defeat the surrender guard.",
    "defeat": "Cao Cao is defeated or the battle reaches Turn 18."
  },
  "conditions": {
    "victory": { "type": "all_units_defeated", "team": "enemy", "after_event": "wu_surrender_line_reached" },
    "defeat": [
      { "type": "any_officer_defeated", "team": "player", "officer_ids": ["cao_cao"] },
      { "type": "turn_reached", "turn": 18, "team": "player" }
    ]
  },
  "briefing": {
    "title": "Wu Surrender",
    "location": "Surrender Road, Jianye, Eastern Front, 220 CE",
    "lines": [
      "Jianye's command district has fallen, and Wu's remaining officers gather around the road where surrender terms will be delivered.",
      "Cao Cao advances through the shaken city to decide whether Wu is accepted into order or driven into its last holdouts."
    ],
    "conditional_lines": [
      {
        "campaign_flags": { "secured_jianye_command": true },
        "lines": [
          "Securing the command district lets Wei carry clear terms into Jianye, with guides marking the road and officials already lowering seals."
        ]
      },
      {
        "campaign_flags": { "forced_wu_surrender": true },
        "lines": [
          "Forcing Wu toward surrender scatters stubborn officers into the canals, and every guard on the road now expects no mercy."
        ]
      }
    ]
  },
  "shop": {
    "items": [
      "bean",
      "wine",
      "iron_sword",
      "training_spear",
      "short_bow",
      "hand_axe",
      "war_axe",
      "leather_armor",
      "iron_armor"
    ],
    "conditional_items": [
      {
        "campaign_flags": { "secured_jianye_command": true },
        "items": ["imperial_seal"]
      },
      {
        "campaign_flags": { "forced_wu_surrender": true },
        "items": ["war_drum"]
      }
    ]
  },
  "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": [
      "WWWWWWWWWWWWWWWWWW",
      "WGGGFFWWRRWWFFGGGW",
      "GGGGWWGGGGRRGGGGGG",
      "GGFFWWGGRRRRGFFGGG",
      "RRRRRRRRRRRRRRRRRR",
      "GGFFWWGGRRRRGFFGGG",
      "GGGGWWGGGGRRGGGGGG",
      "GHHHWWGFFFGGFFFGGG",
      "GHHHWWGGGGHHHGGGGG",
      "GGGGWWGGGGHHHFFGGG",
      "WWWWWWWWWWWWWWWWWW"
    ]
  },
  "deployments": [
    {
      "unit_id": "cao_cao_ch59",
      "officer_id": "cao_cao",
      "team": "player",
      "pos": [1, 4]
    },
    {
      "unit_id": "guo_jia_ch59",
      "officer_id": "guo_jia",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 4]
    },
    {
      "unit_id": "zhang_he_ch59",
      "officer_id": "zhang_he",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 3]
    },
    {
      "unit_id": "xiahou_dun_ch59",
      "officer_id": "xiahou_dun",
      "team": "player",
      "pos": [1, 5]
    },
    {
      "unit_id": "dian_wei_ch59",
      "officer_id": "dian_wei",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 5]
    },
    {
      "unit_id": "xiahou_yuan_ch59",
      "officer_id": "xiahou_yuan",
      "team": "player",
      "requires_joined": true,
      "pos": [3, 3]
    },
    {
      "unit_id": "cao_ren_ch59",
      "officer_id": "cao_ren",
      "team": "player",
      "requires_joined": true,
      "pos": [3, 4]
    },
    {
      "unit_id": "wu_surrender_guard",
      "name": "Wu Surrender Guard",
      "class_id": "commander",
      "team": "enemy",
      "level": 56,
      "pos": [14, 4],
      "base": { "hp": 190, "mp": 92, "atk": 59, "def": 50, "int": 48, "agi": 35 }
    },
    {
      "unit_id": "surrender_district_captain",
      "name": "Surrender District Captain",
      "class_id": "guard_captain",
      "team": "enemy",
      "level": 56,
      "pos": [12, 4],
      "base": { "hp": 146, "atk": 58, "def": 51 }
    },
    {
      "unit_id": "sun_clan_rearguard_boat",
      "name": "Sun Clan Rearguard Boat",
      "class_id": "champion",
      "team": "enemy",
      "move_type": "water",
      "level": 56,
      "pos": [4, 3],
      "base": { "hp": 174, "mp": 12, "atk": 60, "def": 46, "int": 16, "agi": 42 }
    },
    {
      "unit_id": "wu_surrender_advisor",
      "name": "Wu Surrender Advisor",
      "class_id": "military_advisor",
      "team": "enemy",
      "level": 56,
      "pos": [13, 5],
      "skills": ["blaze", "great_mend"],
      "base": { "hp": 132, "mp": 116, "atk": 8, "def": 37, "int": 59, "agi": 32 }
    },
    {
      "unit_id": "surrender_spear_north",
      "name": "Surrender Spear",
      "class_id": "infantry",
      "team": "enemy",
      "level": 56,
      "pos": [12, 3],
      "base": { "hp": 134, "atk": 57, "def": 47 }
    },
    {
      "unit_id": "surrender_spear_south",
      "name": "Surrender Spear",
      "class_id": "infantry",
      "team": "enemy",
      "level": 56,
      "pos": [12, 5],
      "base": { "hp": 134, "atk": 57, "def": 47 }
    },
    {
      "unit_id": "surrender_arrow_boat",
      "name": "Surrender Arrow Boat",
      "class_id": "marksman",
      "team": "enemy",
      "move_type": "water",
      "level": 56,
      "pos": [5, 5],
      "base": { "hp": 126, "atk": 58, "def": 33, "agi": 45 }
    }
  ],
  "events": [
    {
      "id": "opening",
      "once": true,
      "when": { "type": "battle_start" },
      "actions": [
        { "type": "log", "text": "Wei advances through Jianye toward the road where Wu's surrender terms will be decided." }
      ]
    },
    {
      "id": "opening_dialogue",
      "once": true,
      "when": { "type": "battle_begin" },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Cao Ren", "text": "The command district is ours, but Wu still shields the surrender road." },
            { "speaker": "Guo Jia", "text": "A surrender offered under spears is still a battle. The question is what kind of order follows it." },
            { "speaker": "Cao Cao", "text": "Then we will stand where terms are spoken and make every remaining banner hear them." }
          ]
        }
      ]
    },
    {
      "id": "secured_command_orders_surrender_terms",
      "once": true,
      "when": { "type": "turn_start", "team": "player", "turn": 2, "campaign_flags": { "secured_jianye_command": true } },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Guo Jia", "text": "The command seals are in Wei hands. If the terms are clear, many gates will open themselves." },
            { "speaker": "Cao Cao", "text": "Then carry order ahead of the army. Surrender should look safer than refusal." }
          ]
        }
      ]
    },
    {
      "id": "forced_surrender_draws_holdout_boat",
      "once": true,
      "when": { "type": "turn_start", "team": "enemy", "turn": 2, "campaign_flags": { "forced_wu_surrender": true } },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Wu Surrender Guard", "text": "Wei forced us to this road. Hold the canal and let no messenger pass cleanly." },
            { "speaker": "Zhang He", "text": "Their holdouts still believe water can hide a broken command." }
          ]
        },
        {
          "type": "spawn_deployment",
          "deployment": {
            "unit_id": "wu_holdout_boat",
            "name": "Wu Holdout Boat",
            "class_id": "champion",
            "team": "enemy",
            "move_type": "water",
            "level": 56,
            "pos": [5, 3],
            "base": { "hp": 124, "atk": 53, "def": 37, "agi": 43 }
          }
        }
      ]
    },
    {
      "id": "turn_4_surrender_guard_stiffens",
      "once": true,
      "when": { "type": "turn_start", "team": "enemy", "turn": 4 },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Wu Surrender Advisor", "text": "If Wei reaches the surrender line, every hesitant officer will lay down arms." },
            { "speaker": "Cao Ren", "text": "Their fear has named our road. Push to it." }
          ]
        }
      ]
    },
    {
      "id": "wu_surrender_line_reached",
      "once": true,
      "when": { "type": "unit_reaches_tile", "team": "player", "officer_ids": ["cao_cao"], "pos": [10, 4] },
      "actions": [
        {
          "type": "set_objective",
          "victory": "The Wu surrender line is reached. Defeat the surrender guard.",
          "defeat": "Cao Cao is defeated or the battle reaches Turn 18."
        },
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Cao Cao", "text": "This is the line where Wu's answer will be received. Lay down arms, or lose the right to answer." },
            { "speaker": "Wu Surrender Guard", "text": "A guard can still buy time for those who refuse your terms." }
          ]
        },
        {
          "type": "spawn_deployments",
          "deployments": [
            {
              "unit_id": "wu_surrender_last_guard",
              "name": "Wu Surrender Last Guard",
              "class_id": "guard_captain",
              "team": "enemy",
              "level": 56,
              "pos": [16, 4],
              "base": { "hp": 142, "atk": 57, "def": 50 }
            },
            {
              "unit_id": "wu_surrender_crossbow_boat",
              "name": "Wu Surrender Crossbow Boat",
              "class_id": "marksman",
              "team": "enemy",
              "move_type": "water",
              "level": 56,
              "pos": [10, 1],
              "base": { "hp": 118, "atk": 56, "def": 30, "agi": 44 }
            }
          ]
        }
      ]
    },
    {
      "id": "turn_9_surrender_line_wavers",
      "once": true,
      "when": { "type": "turn_start", "team": "player", "turn": 9 },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Xiahou Dun", "text": "Their guard is thin now. Some still fight, but more are watching the road than our blades." },
            { "speaker": "Cao Cao", "text": "A wavering enemy needs one final proof. Give it." }
          ]
        }
      ]
    }
  ],
  "rewards": {
    "gold": 11600,
    "items": ["bean", "wine", "war_axe"]
  },
  "post_battle_dialogue": [
    { "speaker": "Guo Jia", "text": "Wu's surrender road is open. Some officers will accept Wei's order; others will flee south and call refusal loyalty." },
    { "speaker": "Cao Ren", "text": "Accepting surrender will settle Jianye quickly. Pursuing holdouts may end the next fire before it gathers." },
    { "speaker": "Cao Cao", "text": "A surrendered city and a hunted remnant both teach the same lesson. The difference is how long the lesson takes." }
  ],
  "post_battle_choices": [
    {
      "id": "accept_wu_surrender",
      "label": "Accept Surrender",
      "description": "Cao Cao accepts Wu's surrender terms and turns Jianye toward a managed settlement.",
      "set_flags": { "accepted_wu_surrender": true, "pursued_wu_holdouts": false },
      "gold": 2200,
      "items": ["imperial_seal"]
    },
    {
      "id": "pursue_wu_holdouts",
      "label": "Pursue Holdouts",
      "description": "Cao Cao drives south after the officers who refused the surrender road.",
      "set_flags": { "accepted_wu_surrender": false, "pursued_wu_holdouts": true },
      "gold": 2000,
      "items": ["war_drum"]
    }
  ]
}
