{
  "id": "053_jianye_approach",
  "name": "Jianye Approach",
  "objectives": {
    "victory": "Reach the Jianye approach marker with Cao Cao, then defeat the Wu approach guard.",
    "defeat": "Cao Cao is defeated or the battle reaches Turn 18."
  },
  "conditions": {
    "victory": { "type": "all_units_defeated", "team": "enemy", "after_event": "jianye_approach_reached" },
    "defeat": [
      { "type": "any_officer_defeated", "team": "player", "officer_ids": ["cao_cao"] },
      { "type": "turn_reached", "turn": 18, "team": "player" }
    ]
  },
  "briefing": {
    "title": "Jianye Approach",
    "location": "Lower Yangtze Approach, Eastern Front, 220 CE",
    "lines": [
      "With Wu's river line broken, Cao Cao advances along the lower Yangtze road toward the approaches that shield Jianye.",
      "The road is narrow, the water stays close, and Wu's captains mean to turn every bank into a delay before the capital can be threatened."
    ],
    "conditional_lines": [
      {
        "campaign_flags": { "anchored_ruxu_fleet": true },
        "lines": [
          "The anchored Ruxu fleet steadies Wei's rear, giving the advance a protected supply line and calmer crossings."
        ]
      },
      {
        "campaign_flags": { "prepared_jianye_pressure": true },
        "lines": [
          "The prepared Jianye pressure leaves Wu little time to gather, but every rushed enemy captain knows where Wei's spear is pointed."
        ]
      }
    ]
  },
  "shop": {
    "items": [
      "bean",
      "wine",
      "iron_sword",
      "training_spear",
      "short_bow",
      "hand_axe",
      "war_axe",
      "leather_armor",
      "iron_armor"
    ],
    "conditional_items": [
      {
        "campaign_flags": { "anchored_ruxu_fleet": true },
        "items": ["imperial_seal"]
      },
      {
        "campaign_flags": { "prepared_jianye_pressure": 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_ch53",
      "officer_id": "cao_cao",
      "team": "player",
      "pos": [1, 4]
    },
    {
      "unit_id": "guo_jia_ch53",
      "officer_id": "guo_jia",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 4]
    },
    {
      "unit_id": "zhang_he_ch53",
      "officer_id": "zhang_he",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 3]
    },
    {
      "unit_id": "xiahou_dun_ch53",
      "officer_id": "xiahou_dun",
      "team": "player",
      "pos": [1, 5]
    },
    {
      "unit_id": "dian_wei_ch53",
      "officer_id": "dian_wei",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 5]
    },
    {
      "unit_id": "xiahou_yuan_ch53",
      "officer_id": "xiahou_yuan",
      "team": "player",
      "requires_joined": true,
      "pos": [3, 3]
    },
    {
      "unit_id": "cao_ren_ch53",
      "officer_id": "cao_ren",
      "team": "player",
      "requires_joined": true,
      "pos": [3, 4]
    },
    {
      "unit_id": "jianye_approach_guard",
      "name": "Jianye Approach Guard",
      "class_id": "commander",
      "team": "enemy",
      "level": 50,
      "pos": [14, 4],
      "base": { "hp": 166, "mp": 80, "atk": 53, "def": 44, "int": 42, "agi": 29 }
    },
    {
      "unit_id": "ruxu_forward_captain",
      "name": "Ruxu Forward Captain",
      "class_id": "guard_captain",
      "team": "enemy",
      "level": 50,
      "pos": [12, 4],
      "base": { "hp": 134, "atk": 52, "def": 45 }
    },
    {
      "unit_id": "wu_jianye_lane_boat",
      "name": "Wu Jianye Lane Boat",
      "class_id": "champion",
      "team": "enemy",
      "move_type": "water",
      "level": 50,
      "pos": [4, 3],
      "base": { "hp": 162, "mp": 12, "atk": 54, "def": 40, "int": 14, "agi": 36 }
    },
    {
      "unit_id": "wu_approach_advisor",
      "name": "Wu Approach Advisor",
      "class_id": "military_advisor",
      "team": "enemy",
      "level": 50,
      "pos": [13, 5],
      "skills": ["blaze", "great_mend"],
      "base": { "hp": 120, "mp": 104, "atk": 8, "def": 31, "int": 53, "agi": 26 }
    },
    {
      "unit_id": "wu_approach_spear_north",
      "name": "Wu Approach Spear",
      "class_id": "infantry",
      "team": "enemy",
      "level": 50,
      "pos": [12, 3],
      "base": { "hp": 122, "atk": 51, "def": 41 }
    },
    {
      "unit_id": "wu_approach_spear_south",
      "name": "Wu Approach Spear",
      "class_id": "infantry",
      "team": "enemy",
      "level": 50,
      "pos": [12, 5],
      "base": { "hp": 122, "atk": 51, "def": 41 }
    },
    {
      "unit_id": "wu_approach_arrow_boat",
      "name": "Wu Approach Arrow Boat",
      "class_id": "marksman",
      "team": "enemy",
      "move_type": "water",
      "level": 50,
      "pos": [5, 5],
      "base": { "hp": 114, "atk": 52, "def": 27, "agi": 39 }
    }
  ],
  "events": [
    {
      "id": "opening",
      "once": true,
      "when": { "type": "battle_start" },
      "actions": [
        { "type": "log", "text": "Wei pushes from the broken Wu river line toward the approaches that shield Jianye." }
      ]
    },
    {
      "id": "opening_dialogue",
      "once": true,
      "when": { "type": "battle_begin" },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Cao Ren", "text": "The road bends east, but the river keeps one hand on our flank." },
            { "speaker": "Guo Jia", "text": "That is why Wu guards this approach. Lose the bank here and Jianye begins listening for Wei drums." },
            { "speaker": "Cao Cao", "text": "Then let the drums be clear. Take the approach and leave Wu no quiet road home." }
          ]
        }
      ]
    },
    {
      "id": "anchored_fleet_supplies_road",
      "once": true,
      "when": { "type": "turn_start", "team": "player", "turn": 2, "campaign_flags": { "anchored_ruxu_fleet": true } },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Xiahou Dun", "text": "The anchored fleet is holding the rear water. Our supply carts can keep pace with the road." },
            { "speaker": "Cao Cao", "text": "A road fed by water can strike farther than a road alone." }
          ]
        }
      ]
    },
    {
      "id": "jianye_pressure_draws_hasty_boats",
      "once": true,
      "when": { "type": "turn_start", "team": "enemy", "turn": 2, "campaign_flags": { "prepared_jianye_pressure": true } },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Jianye Approach Guard", "text": "Wei points straight at Jianye. Send the hasty boats before their road column settles." },
            { "speaker": "Zhang He", "text": "They are answering speed with speed. That makes their line sharp, but thin." }
          ]
        },
        {
          "type": "spawn_deployment",
          "deployment": {
            "unit_id": "wu_hasty_counterboat",
            "name": "Wu Hasty Counterboat",
            "class_id": "champion",
            "team": "enemy",
            "move_type": "water",
            "level": 50,
            "pos": [5, 3],
            "base": { "hp": 112, "atk": 47, "def": 31, "agi": 37 }
          }
        }
      ]
    },
    {
      "id": "turn_4_approach_pressure",
      "once": true,
      "when": { "type": "turn_start", "team": "enemy", "turn": 4 },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Wu Approach Advisor", "text": "Hold the road long enough for Jianye to hear the warning. Every step Wei buys here costs them time." },
            { "speaker": "Guo Jia", "text": "They trade ground for warning. So we must take ground and silence together." }
          ]
        }
      ]
    },
    {
      "id": "jianye_approach_reached",
      "once": true,
      "when": { "type": "unit_reaches_tile", "team": "player", "officer_ids": ["cao_cao"], "pos": [10, 4] },
      "actions": [
        {
          "type": "set_objective",
          "victory": "The Jianye approach is reached. Defeat the Wu approach guard.",
          "defeat": "Cao Cao is defeated or the battle reaches Turn 18."
        },
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Cao Cao", "text": "This approach carries the sound of Jianye's gates. Break the guard and make that sound ours." },
            { "speaker": "Jianye Approach Guard", "text": "Jianye does not open because a road boasts loudly." }
          ]
        },
        {
          "type": "spawn_deployments",
          "deployments": [
            {
              "unit_id": "wu_approach_inner_guard",
              "name": "Wu Approach Inner Guard",
              "class_id": "guard_captain",
              "team": "enemy",
              "level": 50,
              "pos": [16, 4],
              "base": { "hp": 130, "atk": 51, "def": 44 }
            },
            {
              "unit_id": "wu_approach_crossbow_boat",
              "name": "Wu Approach Crossbow Boat",
              "class_id": "marksman",
              "team": "enemy",
              "move_type": "water",
              "level": 50,
              "pos": [10, 1],
              "base": { "hp": 106, "atk": 50, "def": 24, "agi": 38 }
            }
          ]
        }
      ]
    },
    {
      "id": "turn_9_approach_buckles",
      "once": true,
      "when": { "type": "turn_start", "team": "player", "turn": 9 },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Cao Ren", "text": "Their approach guard is buckling. The road ahead is opening by the wagon-length." },
            { "speaker": "Cao Cao", "text": "Then widen it until Wu must choose between guarding Jianye and answering us here." }
          ]
        }
      ]
    }
  ],
  "rewards": {
    "gold": 10400,
    "items": ["bean", "wine", "iron_armor"]
  },
  "post_battle_dialogue": [
    { "speaker": "Guo Jia", "text": "The Jianye approach is open enough to shape the next move. Wei can secure the route, or force Wu to strike before its capital guard is ready." },
    { "speaker": "Cao Ren", "text": "Secure the approach and our line becomes hard to cut. Force the counterstroke and Wu must spend its strength away from the walls." },
    { "speaker": "Cao Cao", "text": "A capital is not taken by walking toward it. It is taken by deciding which fear reaches it first." }
  ],
  "post_battle_choices": [
    {
      "id": "secure_jianye_approach",
      "label": "Secure Approach",
      "description": "Cao Cao secures the Jianye approach as a stable road toward the lower Yangtze front.",
      "set_flags": { "secured_jianye_approach": true, "forced_wu_counterstroke": false },
      "gold": 1900,
      "items": ["imperial_seal"]
    },
    {
      "id": "force_wu_counterstroke",
      "label": "Force Counter",
      "description": "Cao Cao forces Wu to counterattack before the Jianye guard can settle.",
      "set_flags": { "secured_jianye_approach": false, "forced_wu_counterstroke": true },
      "gold": 1700,
      "items": ["war_drum"]
    }
  ]
}
