{
  "id": "029_red_cliffs_fleet",
  "name": "Red Cliffs Fleet",
  "objectives": {
    "victory": "Reach the chained fleet line with Cao Cao, then defeat the coalition vanguard.",
    "defeat": "Cao Cao is defeated or the battle reaches Turn 18."
  },
  "conditions": {
    "victory": { "type": "all_units_defeated", "team": "enemy", "after_event": "fleet_line_reached" },
    "defeat": [
      { "type": "any_officer_defeated", "team": "player", "officer_ids": ["cao_cao"] },
      { "type": "turn_reached", "turn": 18, "team": "player" }
    ]
  },
  "briefing": {
    "title": "Red Cliffs Fleet",
    "location": "Red Cliffs, Yangtze River, 208 CE",
    "lines": [
      "Xiakou's harbor road has been shaken, but Sun Quan and Liu Bei now gather ships downstream at Red Cliffs.",
      "Cao Cao's northern veterans step onto a river campaign where discipline, wind, and fear all move differently."
    ],
    "conditional_lines": [
      {
        "campaign_flags": { "pressed_red_cliffs_fleet": true },
        "lines": [
          "The fleet has been urged forward quickly, catching the coalition vanguard near Red Cliffs before every river banner can settle."
        ]
      },
      {
        "campaign_flags": { "secured_xiakou_harbor": true },
        "lines": [
          "Xiakou's secured harbor gives Cao Cao time to chain ships and steady seasick troops before facing the coalition vanguard."
        ]
      }
    ]
  },
  "shop": {
    "items": [
      "bean",
      "wine",
      "iron_sword",
      "training_spear",
      "short_bow",
      "hand_axe",
      "war_axe",
      "leather_armor",
      "iron_armor"
    ],
    "conditional_items": [
      {
        "campaign_flags": { "pressed_red_cliffs_fleet": true },
        "items": ["war_drum"]
      },
      {
        "campaign_flags": { "secured_xiakou_harbor": 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": [
      "GGGGHHGGGGGGHHGGGG",
      "GGFFHHGGRRGGHHFFGG",
      "GGRRRRRRRRRRRRFFGG",
      "GGGFGHGGGGRRGGGGGG",
      "RRRRRRRRRRRRRRRRRR",
      "GGGGGHHGGGRRGFFGGG",
      "GGHHGFFFGGFFFGGHHG",
      "GGHHGFFFGGFFFGGHHG",
      "GGGGGGFFGGHHHGGGGG",
      "GGFFGGGGGGHHHFFGGG",
      "GGGGGGGGGGGGGGGGGG"
    ]
  },
  "deployments": [
    {
      "unit_id": "cao_cao_ch29",
      "officer_id": "cao_cao",
      "team": "player",
      "pos": [1, 4]
    },
    {
      "unit_id": "guo_jia_ch29",
      "officer_id": "guo_jia",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 4]
    },
    {
      "unit_id": "zhang_he_ch29",
      "officer_id": "zhang_he",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 3]
    },
    {
      "unit_id": "xiahou_dun_ch29",
      "officer_id": "xiahou_dun",
      "team": "player",
      "pos": [1, 5]
    },
    {
      "unit_id": "dian_wei_ch29",
      "officer_id": "dian_wei",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 5]
    },
    {
      "unit_id": "xiahou_yuan_ch29",
      "officer_id": "xiahou_yuan",
      "team": "player",
      "requires_joined": true,
      "pos": [3, 3]
    },
    {
      "unit_id": "cao_ren_ch29",
      "officer_id": "cao_ren",
      "team": "player",
      "requires_joined": true,
      "pos": [3, 4]
    },
    {
      "unit_id": "coalition_vanguard_admiral",
      "name": "Coalition Vanguard Admiral",
      "class_id": "commander",
      "team": "enemy",
      "level": 27,
      "pos": [14, 4],
      "base": { "hp": 110, "mp": 34, "atk": 30, "def": 24, "int": 21, "agi": 17 }
    },
    {
      "unit_id": "red_cliffs_deck_captain",
      "name": "Red Cliffs Deck Captain",
      "class_id": "guard_captain",
      "team": "enemy",
      "level": 26,
      "pos": [12, 4],
      "base": { "hp": 84, "atk": 27, "def": 22 }
    },
    {
      "unit_id": "wu_fire_advisor",
      "name": "Wu Fire Advisor",
      "class_id": "military_advisor",
      "team": "enemy",
      "level": 26,
      "pos": [15, 5],
      "skills": ["blaze", "great_mend"],
      "base": { "hp": 72, "mp": 56, "atk": 7, "def": 13, "int": 29, "agi": 14 }
    },
    {
      "unit_id": "red_cliffs_spear_north",
      "name": "Red Cliffs Spear Guard",
      "class_id": "infantry",
      "team": "enemy",
      "level": 26,
      "pos": [12, 3],
      "base": { "hp": 74, "atk": 27, "def": 19 }
    },
    {
      "unit_id": "red_cliffs_spear_south",
      "name": "Red Cliffs Spear Guard",
      "class_id": "infantry",
      "team": "enemy",
      "level": 26,
      "pos": [12, 5],
      "base": { "hp": 74, "atk": 27, "def": 19 }
    },
    {
      "unit_id": "red_cliffs_archer_north",
      "name": "Red Cliffs Archer",
      "class_id": "marksman",
      "team": "enemy",
      "level": 26,
      "pos": [13, 2],
      "base": { "hp": 66, "atk": 28, "def": 10, "agi": 20 }
    },
    {
      "unit_id": "red_cliffs_archer_south",
      "name": "Red Cliffs Archer",
      "class_id": "marksman",
      "team": "enemy",
      "level": 26,
      "pos": [14, 6],
      "base": { "hp": 66, "atk": 28, "def": 10, "agi": 20 }
    },
    {
      "unit_id": "coalition_fast_boat",
      "name": "Coalition Fast Boat",
      "class_id": "elite_cavalry",
      "team": "enemy",
      "level": 26,
      "pos": [15, 3],
      "base": { "hp": 82, "atk": 28, "def": 16, "agi": 22 }
    }
  ],
  "events": [
    {
      "id": "opening",
      "once": true,
      "when": { "type": "battle_start" },
      "actions": [
        { "type": "log", "text": "At Red Cliffs, the coalition tests Cao Cao's chained fleet before the river campaign becomes open war." }
      ]
    },
    {
      "id": "opening_dialogue",
      "once": true,
      "when": { "type": "battle_begin" },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Guo Jia", "text": "The river changes discipline. Men who would stand on land count waves like omens." },
            { "speaker": "Cao Cao", "text": "Then give them an omen they understand: victory." },
            { "speaker": "Zhang He", "text": "The coalition vanguard is probing the chain line. They want to know whether our fleet moves or merely floats." }
          ]
        }
      ]
    },
    {
      "id": "pressed_fleet_meets_vanguard",
      "once": true,
      "when": { "type": "turn_start", "team": "enemy", "turn": 2, "campaign_flags": { "pressed_red_cliffs_fleet": true } },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Coalition Vanguard Admiral", "text": "Cao Cao pushed his fleet forward before river order took root. Strike the loose ships." },
            { "speaker": "Xiahou Dun", "text": "Loose or chained, they still answer our drums." }
          ]
        },
        {
          "type": "spawn_deployment",
          "deployment": {
            "unit_id": "coalition_probe_boat",
            "name": "Coalition Probe Boat",
            "class_id": "cavalry",
            "team": "enemy",
            "level": 26,
            "pos": [16, 3],
            "base": { "hp": 70, "atk": 26, "def": 14, "agi": 18 }
          }
        }
      ]
    },
    {
      "id": "secured_harbor_steadies_fleet",
      "once": true,
      "when": { "type": "turn_start", "team": "player", "turn": 2, "campaign_flags": { "secured_xiakou_harbor": true } },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Cao Ren", "text": "Xiakou's harbor crews have tied the supply boats into the fleet. The line is steadier than yesterday." },
            { "speaker": "Cao Cao", "text": "Then let the coalition learn that patience also has teeth." }
          ]
        }
      ]
    },
    {
      "id": "turn_4_fire_whispers",
      "once": true,
      "when": { "type": "turn_start", "team": "enemy", "turn": 4 },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Wu Fire Advisor", "text": "Watch the wind. Cao Cao's chains make courage out of weight." },
            { "speaker": "Guo Jia", "text": "They speak of wind too early. That means the river is already part of their plan." }
          ]
        }
      ]
    },
    {
      "id": "fleet_line_reached",
      "once": true,
      "when": { "type": "unit_reaches_tile", "team": "player", "officer_ids": ["cao_cao"], "pos": [10, 4] },
      "actions": [
        {
          "type": "set_objective",
          "victory": "The chained fleet line is reached. Defeat the coalition vanguard.",
          "defeat": "Cao Cao is defeated or the battle reaches Turn 18."
        },
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Cao Cao", "text": "This is the fleet line. Break their vanguard before they teach the river to oppose us." },
            { "speaker": "Coalition Vanguard Admiral", "text": "If Cao Cao's chains hold, the river becomes his road. Cut the road!" }
          ]
        },
        {
          "type": "spawn_deployments",
          "deployments": [
            {
              "unit_id": "coalition_chain_guard",
              "name": "Coalition Chain Guard",
              "class_id": "guard_captain",
              "team": "enemy",
              "level": 26,
              "pos": [16, 4],
              "base": { "hp": 82, "atk": 27, "def": 22 }
            },
            {
              "unit_id": "coalition_fire_archer",
              "name": "Coalition Fire Archer",
              "class_id": "archer",
              "team": "enemy",
              "level": 26,
              "pos": [16, 5],
              "base": { "hp": 60, "atk": 26, "def": 8, "agi": 18 }
            }
          ]
        }
      ]
    },
    {
      "id": "turn_9_fleet_creaks",
      "once": true,
      "when": { "type": "turn_start", "team": "player", "turn": 9 },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Zhang He", "text": "Their boats keep testing the chain line. Every strike asks the same question." },
            { "speaker": "Cao Cao", "text": "Then answer once, and loudly." }
          ]
        }
      ]
    }
  ],
  "rewards": {
    "gold": 5600,
    "items": ["bean", "wine", "war_drum"]
  },
  "post_battle_dialogue": [
    { "speaker": "Guo Jia", "text": "The vanguard is broken, but the coalition now knows where our fleet is stiff and where it breathes." },
    { "speaker": "Zhang He", "text": "The wind changes every hour. Their fire advisor watched it more carefully than our blades." },
    { "speaker": "Cao Cao", "text": "Then decide whether we reinforce the chain line or send a night raid before fire becomes their answer." }
  ],
  "post_battle_choices": [
    {
      "id": "reinforce_chain_line",
      "label": "Reinforce Chain",
      "description": "Cao Cao reinforces the chained fleet line to keep the river army steady before the decisive battle.",
      "set_flags": { "reinforced_chain_line": true, "ordered_night_raid": false },
      "gold": 900,
      "items": ["imperial_seal"]
    },
    {
      "id": "order_night_raid",
      "label": "Night Raid",
      "description": "Cao Cao orders a night attack to disrupt the coalition before their fire plan matures.",
      "set_flags": { "reinforced_chain_line": false, "ordered_night_raid": true },
      "gold": 650,
      "items": ["war_drum"]
    }
  ]
}
