{
  "id": "052_wu_river_line",
  "name": "Wu River Line",
  "objectives": {
    "victory": "Reach Wu's river line with Cao Cao, then defeat the Wu fleet guard.",
    "defeat": "Cao Cao is defeated or the battle reaches Turn 18."
  },
  "conditions": {
    "victory": { "type": "all_units_defeated", "team": "enemy", "after_event": "wu_river_line_reached" },
    "defeat": [
      { "type": "any_officer_defeated", "team": "player", "officer_ids": ["cao_cao"] },
      { "type": "turn_reached", "turn": 18, "team": "player" }
    ]
  },
  "briefing": {
    "title": "Wu River Line",
    "location": "Ruxu River Line, Eastern Front, 220 CE",
    "lines": [
      "The eastern front alarm has quieted, but Wu's river line remains alive with watchfires, current boats, and captains testing the edge of Wei's new authority.",
      "Cao Cao advances toward the river line to decide whether Ruxu becomes a stable fleet base or the first step toward deeper Wu pressure."
    ],
    "conditional_lines": [
      {
        "campaign_flags": { "secured_eastern_fleet": true },
        "lines": [
          "Securing the eastern fleet gives Cao Cao steadier boats, screened crossings, and time to measure Wu's river guard before committing."
        ]
      },
      {
        "campaign_flags": { "pressed_wu_river_line": true },
        "lines": [
          "Pressing Wu's river line keeps the enemy unsettled, but their captains now expect Wei to strike before the water calms."
        ]
      }
    ]
  },
  "shop": {
    "items": [
      "bean",
      "wine",
      "iron_sword",
      "training_spear",
      "short_bow",
      "hand_axe",
      "war_axe",
      "leather_armor",
      "iron_armor"
    ],
    "conditional_items": [
      {
        "campaign_flags": { "secured_eastern_fleet": true },
        "items": ["imperial_seal"]
      },
      {
        "campaign_flags": { "pressed_wu_river_line": 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_ch52",
      "officer_id": "cao_cao",
      "team": "player",
      "pos": [1, 4]
    },
    {
      "unit_id": "guo_jia_ch52",
      "officer_id": "guo_jia",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 4]
    },
    {
      "unit_id": "zhang_he_ch52",
      "officer_id": "zhang_he",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 3]
    },
    {
      "unit_id": "xiahou_dun_ch52",
      "officer_id": "xiahou_dun",
      "team": "player",
      "pos": [1, 5]
    },
    {
      "unit_id": "dian_wei_ch52",
      "officer_id": "dian_wei",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 5]
    },
    {
      "unit_id": "xiahou_yuan_ch52",
      "officer_id": "xiahou_yuan",
      "team": "player",
      "requires_joined": true,
      "pos": [3, 3]
    },
    {
      "unit_id": "cao_ren_ch52",
      "officer_id": "cao_ren",
      "team": "player",
      "requires_joined": true,
      "pos": [3, 4]
    },
    {
      "unit_id": "wu_river_line_guard",
      "name": "Wu River Line Guard",
      "class_id": "commander",
      "team": "enemy",
      "level": 49,
      "pos": [14, 4],
      "base": { "hp": 162, "mp": 78, "atk": 52, "def": 43, "int": 41, "agi": 28 }
    },
    {
      "unit_id": "ruxu_fleet_captain",
      "name": "Ruxu Fleet Captain",
      "class_id": "guard_captain",
      "team": "enemy",
      "level": 49,
      "pos": [12, 4],
      "base": { "hp": 132, "atk": 51, "def": 44 }
    },
    {
      "unit_id": "gan_ning_river_line_boat",
      "name": "Gan Ning River Line Boat",
      "class_id": "champion",
      "team": "enemy",
      "move_type": "water",
      "level": 49,
      "pos": [4, 3],
      "base": { "hp": 160, "mp": 12, "atk": 53, "def": 39, "int": 14, "agi": 35 }
    },
    {
      "unit_id": "wu_river_line_advisor",
      "name": "Wu River Line Advisor",
      "class_id": "military_advisor",
      "team": "enemy",
      "level": 49,
      "pos": [13, 5],
      "skills": ["blaze", "great_mend"],
      "base": { "hp": 118, "mp": 102, "atk": 8, "def": 30, "int": 52, "agi": 26 }
    },
    {
      "unit_id": "wu_river_spear_north",
      "name": "Wu River Spear",
      "class_id": "infantry",
      "team": "enemy",
      "level": 49,
      "pos": [12, 3],
      "base": { "hp": 120, "atk": 50, "def": 40 }
    },
    {
      "unit_id": "wu_river_spear_south",
      "name": "Wu River Spear",
      "class_id": "infantry",
      "team": "enemy",
      "level": 49,
      "pos": [12, 5],
      "base": { "hp": 120, "atk": 50, "def": 40 }
    },
    {
      "unit_id": "wu_river_arrow_boat",
      "name": "Wu River Arrow Boat",
      "class_id": "marksman",
      "team": "enemy",
      "move_type": "water",
      "level": 49,
      "pos": [5, 5],
      "base": { "hp": 112, "atk": 51, "def": 26, "agi": 38 }
    }
  ],
  "events": [
    {
      "id": "opening",
      "once": true,
      "when": { "type": "battle_start" },
      "actions": [
        { "type": "log", "text": "Wei advances from the eastern alarm toward Wu's river line at Ruxu." }
      ]
    },
    {
      "id": "opening_dialogue",
      "once": true,
      "when": { "type": "battle_begin" },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Cao Ren", "text": "The alarm has faded, but Wu's river line still waits with boats in every channel." },
            { "speaker": "Guo Jia", "text": "A quiet river after alarm is not peace. It is the enemy listening for our next oar." },
            { "speaker": "Cao Cao", "text": "Then let them hear it. We take the line before the current chooses for us." }
          ]
        }
      ]
    },
    {
      "id": "secured_fleet_covers_advance",
      "once": true,
      "when": { "type": "turn_start", "team": "player", "turn": 2, "campaign_flags": { "secured_eastern_fleet": true } },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Xiahou Yuan", "text": "The secured fleet is screening our bank. Wu's side current cannot surprise the crossing." },
            { "speaker": "Cao Cao", "text": "A river guarded before battle becomes a road during battle." }
          ]
        }
      ]
    },
    {
      "id": "pressed_line_draws_counterboats",
      "once": true,
      "when": { "type": "turn_start", "team": "enemy", "turn": 2, "campaign_flags": { "pressed_wu_river_line": true } },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Wu River Line Guard", "text": "Wei presses before the river settles. Send counterboats through the side channel." },
            { "speaker": "Zhang He", "text": "They answer pressure with speed. That means the line can still be bent." }
          ]
        },
        {
          "type": "spawn_deployment",
          "deployment": {
            "unit_id": "wu_side_channel_boat",
            "name": "Wu Side-Channel Boat",
            "class_id": "champion",
            "team": "enemy",
            "move_type": "water",
            "level": 49,
            "pos": [5, 3],
            "base": { "hp": 110, "atk": 46, "def": 30, "agi": 36 }
          }
        }
      ]
    },
    {
      "id": "turn_4_river_line_pressure",
      "once": true,
      "when": { "type": "turn_start", "team": "enemy", "turn": 4 },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Wu River Line Advisor", "text": "Keep their front guessing between road and water. Ruxu falls only when men trust the bank too much." },
            { "speaker": "Guo Jia", "text": "They want indecision. Give them a decision sharp enough to cross." }
          ]
        }
      ]
    },
    {
      "id": "wu_river_line_reached",
      "once": true,
      "when": { "type": "unit_reaches_tile", "team": "player", "officer_ids": ["cao_cao"], "pos": [10, 4] },
      "actions": [
        {
          "type": "set_objective",
          "victory": "Wu's river line is reached. Defeat the Wu fleet guard.",
          "defeat": "Cao Cao is defeated or the battle reaches Turn 18."
        },
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Cao Cao", "text": "This is Wu's river line. Break the fleet guard and make Ruxu answer to Wei's command." },
            { "speaker": "Wu River Line Guard", "text": "Ruxu's water has carried more than one boast away." }
          ]
        },
        {
          "type": "spawn_deployments",
          "deployments": [
            {
              "unit_id": "wu_river_inner_guard",
              "name": "Wu River Inner Guard",
              "class_id": "guard_captain",
              "team": "enemy",
              "level": 49,
              "pos": [16, 4],
              "base": { "hp": 128, "atk": 50, "def": 43 }
            },
            {
              "unit_id": "wu_river_crossbow_boat",
              "name": "Wu River Crossbow Boat",
              "class_id": "marksman",
              "team": "enemy",
              "move_type": "water",
              "level": 49,
              "pos": [10, 1],
              "base": { "hp": 104, "atk": 49, "def": 23, "agi": 37 }
            }
          ]
        }
      ]
    },
    {
      "id": "turn_9_line_bends",
      "once": true,
      "when": { "type": "turn_start", "team": "player", "turn": 9 },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Cao Ren", "text": "Their river line is bending. The boats are still moving, but their orders are slower." },
            { "speaker": "Cao Cao", "text": "Then make the current carry our pace, not theirs." }
          ]
        }
      ]
    }
  ],
  "rewards": {
    "gold": 10200,
    "items": ["bean", "wine", "war_drum"]
  },
  "post_battle_dialogue": [
    { "speaker": "Guo Jia", "text": "Wu's river line is broken open. Ruxu can become an anchored fleet base, or the first marker on a road toward Jianye." },
    { "speaker": "Cao Ren", "text": "Anchor the fleet and the river listens longer. Press toward Jianye and Wu must answer before it is ready." },
    { "speaker": "Cao Cao", "text": "A river line broken is an invitation, not a conclusion. Choose how loudly we answer." }
  ],
  "post_battle_choices": [
    {
      "id": "anchor_ruxu_fleet",
      "label": "Anchor Fleet",
      "description": "Cao Cao anchors the Ruxu fleet as a lasting eastern base.",
      "set_flags": { "anchored_ruxu_fleet": true, "prepared_jianye_pressure": false },
      "gold": 1850,
      "items": ["imperial_seal"]
    },
    {
      "id": "prepare_jianye_pressure",
      "label": "Press Jianye",
      "description": "Cao Cao prepares pressure toward Jianye before Wu can recover the river line.",
      "set_flags": { "anchored_ruxu_fleet": false, "prepared_jianye_pressure": true },
      "gold": 1650,
      "items": ["war_drum"]
    }
  ]
}
