{
  "id": "054_wu_counterstroke",
  "name": "Wu Counterstroke",
  "objectives": {
    "victory": "Reach the counterstroke line with Cao Cao, then defeat the Wu counterstroke commander.",
    "defeat": "Cao Cao is defeated or the battle reaches Turn 18."
  },
  "conditions": {
    "victory": { "type": "all_units_defeated", "team": "enemy", "after_event": "counterstroke_line_reached" },
    "defeat": [
      { "type": "any_officer_defeated", "team": "player", "officer_ids": ["cao_cao"] },
      { "type": "turn_reached", "turn": 18, "team": "player" }
    ]
  },
  "briefing": {
    "title": "Wu Counterstroke",
    "location": "Jianye Road and River Banks, Eastern Front, 220 CE",
    "lines": [
      "The open approach toward Jianye draws Wu into a counterstroke before Wei can decide whether to fortify the road or press the capital guard.",
      "Cao Cao advances to seize the counterstroke line, break Wu's river response, and decide whether the lower Yangtze becomes a held route or a road to the gates."
    ],
    "conditional_lines": [
      {
        "campaign_flags": { "secured_jianye_approach": true },
        "lines": [
          "The secured Jianye approach gives Wei prepared carts, marked crossings, and a firm place to absorb Wu's answer."
        ]
      },
      {
        "campaign_flags": { "forced_wu_counterstroke": true },
        "lines": [
          "Forcing Wu's counterstroke pulls their captains forward in anger, but their boats now rush into battle before the rear line can fully form."
        ]
      }
    ]
  },
  "shop": {
    "items": [
      "bean",
      "wine",
      "iron_sword",
      "training_spear",
      "short_bow",
      "hand_axe",
      "war_axe",
      "leather_armor",
      "iron_armor"
    ],
    "conditional_items": [
      {
        "campaign_flags": { "secured_jianye_approach": true },
        "items": ["imperial_seal"]
      },
      {
        "campaign_flags": { "forced_wu_counterstroke": 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_ch54",
      "officer_id": "cao_cao",
      "team": "player",
      "pos": [1, 4]
    },
    {
      "unit_id": "guo_jia_ch54",
      "officer_id": "guo_jia",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 4]
    },
    {
      "unit_id": "zhang_he_ch54",
      "officer_id": "zhang_he",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 3]
    },
    {
      "unit_id": "xiahou_dun_ch54",
      "officer_id": "xiahou_dun",
      "team": "player",
      "pos": [1, 5]
    },
    {
      "unit_id": "dian_wei_ch54",
      "officer_id": "dian_wei",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 5]
    },
    {
      "unit_id": "xiahou_yuan_ch54",
      "officer_id": "xiahou_yuan",
      "team": "player",
      "requires_joined": true,
      "pos": [3, 3]
    },
    {
      "unit_id": "cao_ren_ch54",
      "officer_id": "cao_ren",
      "team": "player",
      "requires_joined": true,
      "pos": [3, 4]
    },
    {
      "unit_id": "wu_counterstroke_commander",
      "name": "Wu Counterstroke Commander",
      "class_id": "commander",
      "team": "enemy",
      "level": 51,
      "pos": [14, 4],
      "base": { "hp": 170, "mp": 82, "atk": 54, "def": 45, "int": 43, "agi": 30 }
    },
    {
      "unit_id": "jianye_road_captain",
      "name": "Jianye Road Captain",
      "class_id": "guard_captain",
      "team": "enemy",
      "level": 51,
      "pos": [12, 4],
      "base": { "hp": 136, "atk": 53, "def": 46 }
    },
    {
      "unit_id": "ling_tong_counter_boat",
      "name": "Ling Tong Counter Boat",
      "class_id": "champion",
      "team": "enemy",
      "move_type": "water",
      "level": 51,
      "pos": [4, 3],
      "base": { "hp": 164, "mp": 12, "atk": 55, "def": 41, "int": 14, "agi": 37 }
    },
    {
      "unit_id": "wu_counterstroke_advisor",
      "name": "Wu Counterstroke Advisor",
      "class_id": "military_advisor",
      "team": "enemy",
      "level": 51,
      "pos": [13, 5],
      "skills": ["blaze", "great_mend"],
      "base": { "hp": 122, "mp": 106, "atk": 8, "def": 32, "int": 54, "agi": 27 }
    },
    {
      "unit_id": "wu_counter_spear_north",
      "name": "Wu Counter Spear",
      "class_id": "infantry",
      "team": "enemy",
      "level": 51,
      "pos": [12, 3],
      "base": { "hp": 124, "atk": 52, "def": 42 }
    },
    {
      "unit_id": "wu_counter_spear_south",
      "name": "Wu Counter Spear",
      "class_id": "infantry",
      "team": "enemy",
      "level": 51,
      "pos": [12, 5],
      "base": { "hp": 124, "atk": 52, "def": 42 }
    },
    {
      "unit_id": "wu_counter_arrow_boat",
      "name": "Wu Counter Arrow Boat",
      "class_id": "marksman",
      "team": "enemy",
      "move_type": "water",
      "level": 51,
      "pos": [5, 5],
      "base": { "hp": 116, "atk": 53, "def": 28, "agi": 40 }
    }
  ],
  "events": [
    {
      "id": "opening",
      "once": true,
      "when": { "type": "battle_start" },
      "actions": [
        { "type": "log", "text": "Wu throws a counterstroke across the Jianye road and river banks." }
      ]
    },
    {
      "id": "opening_dialogue",
      "once": true,
      "when": { "type": "battle_begin" },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Cao Ren", "text": "Wu is no longer waiting behind the approach. Their counterstroke is already on the road." },
            { "speaker": "Guo Jia", "text": "A rushed counterstroke spends courage before it spends judgment. Break its line and Jianye loses both." },
            { "speaker": "Cao Cao", "text": "Then meet their courage directly. We decide where this road ends." }
          ]
        }
      ]
    },
    {
      "id": "secured_approach_holds_line",
      "once": true,
      "when": { "type": "turn_start", "team": "player", "turn": 2, "campaign_flags": { "secured_jianye_approach": true } },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Xiahou Dun", "text": "The secured approach is holding. Their counterstroke has to hit us where the road is already ours." },
            { "speaker": "Cao Cao", "text": "Good. A prepared road turns enemy speed into noise." }
          ]
        }
      ]
    },
    {
      "id": "forced_counterstroke_rushes_boats",
      "once": true,
      "when": { "type": "turn_start", "team": "enemy", "turn": 2, "campaign_flags": { "forced_wu_counterstroke": true } },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Wu Counterstroke Commander", "text": "Wei forced us forward. Strike with the river boats before their column locks shields." },
            { "speaker": "Zhang He", "text": "They are committed now. If we bend their boat line, the road guard stands alone." }
          ]
        },
        {
          "type": "spawn_deployment",
          "deployment": {
            "unit_id": "wu_rushing_counter_boat",
            "name": "Wu Rushing Counter Boat",
            "class_id": "champion",
            "team": "enemy",
            "move_type": "water",
            "level": 51,
            "pos": [5, 3],
            "base": { "hp": 114, "atk": 48, "def": 32, "agi": 38 }
          }
        }
      ]
    },
    {
      "id": "turn_4_counterstroke_commits",
      "once": true,
      "when": { "type": "turn_start", "team": "enemy", "turn": 4 },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Wu Counterstroke Advisor", "text": "Commit the center. If Wei takes this road, the capital hears hoofbeats before counsel." },
            { "speaker": "Guo Jia", "text": "Their center moves because the capital is afraid. That fear is useful ground." }
          ]
        }
      ]
    },
    {
      "id": "counterstroke_line_reached",
      "once": true,
      "when": { "type": "unit_reaches_tile", "team": "player", "officer_ids": ["cao_cao"], "pos": [10, 4] },
      "actions": [
        {
          "type": "set_objective",
          "victory": "The counterstroke line is reached. Defeat the Wu counterstroke commander.",
          "defeat": "Cao Cao is defeated or the battle reaches Turn 18."
        },
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Cao Cao", "text": "This is the line Wu threw forward. Break it, and Jianye's guard must answer from behind its own fear." },
            { "speaker": "Wu Counterstroke Commander", "text": "A counterstroke broken still leaves a capital wall before you." }
          ]
        },
        {
          "type": "spawn_deployments",
          "deployments": [
            {
              "unit_id": "wu_counter_inner_guard",
              "name": "Wu Counter Inner Guard",
              "class_id": "guard_captain",
              "team": "enemy",
              "level": 51,
              "pos": [16, 4],
              "base": { "hp": 132, "atk": 52, "def": 45 }
            },
            {
              "unit_id": "wu_counter_crossbow_boat",
              "name": "Wu Counter Crossbow Boat",
              "class_id": "marksman",
              "team": "enemy",
              "move_type": "water",
              "level": 51,
              "pos": [10, 1],
              "base": { "hp": 108, "atk": 51, "def": 25, "agi": 39 }
            }
          ]
        }
      ]
    },
    {
      "id": "turn_9_counterstroke_frays",
      "once": true,
      "when": { "type": "turn_start", "team": "player", "turn": 9 },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Cao Ren", "text": "Their counterstroke is fraying. The boats still cut at our flank, but the road center is losing order." },
            { "speaker": "Cao Cao", "text": "Then close the road before the river gives them another answer." }
          ]
        }
      ]
    }
  ],
  "rewards": {
    "gold": 10600,
    "items": ["bean", "wine", "war_axe"]
  },
  "post_battle_dialogue": [
    { "speaker": "Guo Jia", "text": "Wu's counterstroke is spent. The lower Yangtze route can be held and widened, or Wei can press toward Jianye's gate while the enemy gathers itself." },
    { "speaker": "Cao Ren", "text": "Hold the route and no one cuts our rear. Press the gate and Wu must decide inside its own walls." },
    { "speaker": "Cao Cao", "text": "A broken counterstroke is a door. Whether we bar it behind us or step through it is the next command." }
  ],
  "post_battle_choices": [
    {
      "id": "hold_lower_yangtze_route",
      "label": "Hold Route",
      "description": "Cao Cao holds and widens the lower Yangtze route before committing against Jianye.",
      "set_flags": { "held_lower_yangtze_route": true, "pressed_jianye_gate": false },
      "gold": 1950,
      "items": ["imperial_seal"]
    },
    {
      "id": "press_jianye_gate",
      "label": "Press Gate",
      "description": "Cao Cao presses toward Jianye's gate before Wu can rebuild its counterstroke line.",
      "set_flags": { "held_lower_yangtze_route": false, "pressed_jianye_gate": true },
      "gold": 1750,
      "items": ["war_drum"]
    }
  ]
}
