{
  "id": "067_outer_islands",
  "name": "Outer Islands",
  "objectives": {
    "victory": "Reach the outer island line with Cao Cao, then defeat the island captain.",
    "defeat": "Cao Cao is defeated or the battle reaches Turn 18."
  },
  "conditions": {
    "victory": { "type": "all_units_defeated", "team": "enemy", "after_event": "outer_island_line_reached" },
    "defeat": [
      { "type": "any_officer_defeated", "team": "player", "officer_ids": ["cao_cao"] },
      { "type": "turn_reached", "turn": 18, "team": "player" }
    ]
  },
  "briefing": {
    "title": "Outer Islands",
    "location": "Outer Island Landing, Southern Sea, Eastern Front, 220 CE",
    "lines": [
      "The sea exiles have been broken, but their last shelters lie across the outer islands where hidden coves can still feed refusal.",
      "Cao Cao advances along the landing road to decide whether the islands are secured into Wei's register or pressed toward the hidden coves."
    ],
    "conditional_lines": [
      {
        "campaign_flags": { "settled_sea_exiles": true },
        "lines": [
          "Settling the sea exiles gives Wei pilots who know the island landings and which coves still shelter armed crews."
        ]
      },
      {
        "campaign_flags": { "pressed_outer_islands": true },
        "lines": [
          "Pressing the outer islands early keeps the exiles from resting, but every cove now sends its fastest boat to block Wei's road."
        ]
      }
    ]
  },
  "shop": {
    "items": [
      "bean",
      "wine",
      "iron_sword",
      "training_spear",
      "short_bow",
      "hand_axe",
      "war_axe",
      "leather_armor",
      "iron_armor"
    ],
    "conditional_items": [
      {
        "campaign_flags": { "settled_sea_exiles": true },
        "items": ["imperial_seal"]
      },
      {
        "campaign_flags": { "pressed_outer_islands": 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_ch67",
      "officer_id": "cao_cao",
      "team": "player",
      "pos": [1, 4]
    },
    {
      "unit_id": "guo_jia_ch67",
      "officer_id": "guo_jia",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 4]
    },
    {
      "unit_id": "zhang_he_ch67",
      "officer_id": "zhang_he",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 3]
    },
    {
      "unit_id": "xiahou_dun_ch67",
      "officer_id": "xiahou_dun",
      "team": "player",
      "pos": [1, 5]
    },
    {
      "unit_id": "dian_wei_ch67",
      "officer_id": "dian_wei",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 5]
    },
    {
      "unit_id": "xiahou_yuan_ch67",
      "officer_id": "xiahou_yuan",
      "team": "player",
      "requires_joined": true,
      "pos": [3, 3]
    },
    {
      "unit_id": "cao_ren_ch67",
      "officer_id": "cao_ren",
      "team": "player",
      "requires_joined": true,
      "pos": [3, 4]
    },
    {
      "unit_id": "outer_island_captain",
      "name": "Outer Island Captain",
      "class_id": "commander",
      "team": "enemy",
      "level": 64,
      "pos": [14, 4],
      "base": { "hp": 222, "mp": 108, "atk": 67, "def": 58, "int": 56, "agi": 43 }
    },
    {
      "unit_id": "outer_landing_guard",
      "name": "Outer Landing Guard",
      "class_id": "guard_captain",
      "team": "enemy",
      "level": 64,
      "pos": [12, 4],
      "base": { "hp": 162, "atk": 66, "def": 59 }
    },
    {
      "unit_id": "outer_island_boat",
      "name": "Outer Island Boat",
      "class_id": "champion",
      "team": "enemy",
      "move_type": "water",
      "level": 64,
      "pos": [4, 3],
      "base": { "hp": 190, "mp": 12, "atk": 68, "def": 54, "int": 16, "agi": 50 }
    },
    {
      "unit_id": "outer_island_advisor",
      "name": "Outer Island Advisor",
      "class_id": "military_advisor",
      "team": "enemy",
      "level": 64,
      "pos": [13, 5],
      "skills": ["blaze", "great_mend"],
      "base": { "hp": 148, "mp": 132, "atk": 8, "def": 45, "int": 67, "agi": 40 }
    },
    {
      "unit_id": "outer_island_spear_north",
      "name": "Outer Island Spear",
      "class_id": "infantry",
      "team": "enemy",
      "level": 64,
      "pos": [12, 3],
      "base": { "hp": 150, "atk": 65, "def": 55 }
    },
    {
      "unit_id": "outer_island_spear_south",
      "name": "Outer Island Spear",
      "class_id": "infantry",
      "team": "enemy",
      "level": 64,
      "pos": [12, 5],
      "base": { "hp": 150, "atk": 65, "def": 55 }
    },
    {
      "unit_id": "outer_island_arrow_boat",
      "name": "Outer Island Arrow Boat",
      "class_id": "marksman",
      "team": "enemy",
      "move_type": "water",
      "level": 64,
      "pos": [5, 5],
      "base": { "hp": 142, "atk": 66, "def": 41, "agi": 53 }
    }
  ],
  "events": [
    {
      "id": "opening",
      "once": true,
      "when": { "type": "battle_start" },
      "actions": [
        { "type": "log", "text": "Wei lands on the outer islands to break the last visible exile shelter." }
      ]
    },
    {
      "id": "opening_dialogue",
      "once": true,
      "when": { "type": "battle_begin" },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Xiahou Yuan", "text": "The landing road is narrow. Their boats can strike from either side if we slow down." },
            { "speaker": "Guo Jia", "text": "An island feels like safety to men who forget a road can be carried by ships." },
            { "speaker": "Cao Cao", "text": "Then carry Wei's road across the water." }
          ]
        }
      ]
    },
    {
      "id": "settled_exiles_mark_island_coves",
      "once": true,
      "when": { "type": "turn_start", "team": "player", "turn": 2, "campaign_flags": { "settled_sea_exiles": true } },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Guo Jia", "text": "The settled exiles marked the island coves. Their shelters are now points on our map." },
            { "speaker": "Cao Cao", "text": "A point on a map can be reached. Advance." }
          ]
        }
      ]
    },
    {
      "id": "pressed_islands_launch_cove_boat",
      "once": true,
      "when": { "type": "turn_start", "team": "enemy", "turn": 2, "campaign_flags": { "pressed_outer_islands": true } },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Outer Island Captain", "text": "Wei reaches the islands already. Launch the cove boat and keep the hidden route open." },
            { "speaker": "Cao Ren", "text": "They still have a hidden route. Then we have found the right island." }
          ]
        },
        {
          "type": "spawn_deployment",
          "deployment": {
            "unit_id": "outer_cove_boat",
            "name": "Outer Cove Boat",
            "class_id": "champion",
            "team": "enemy",
            "move_type": "water",
            "level": 64,
            "pos": [5, 3],
            "base": { "hp": 140, "atk": 61, "def": 45, "agi": 51 }
          }
        }
      ]
    },
    {
      "id": "turn_4_island_captain_hides_charts",
      "once": true,
      "when": { "type": "turn_start", "team": "enemy", "turn": 4 },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Outer Island Advisor", "text": "Hide the cove charts. If Wei takes this landing, the hidden shelters must remain nameless." },
            { "speaker": "Guo Jia", "text": "They hide charts because the charts are real. Take the landing." }
          ]
        }
      ]
    },
    {
      "id": "outer_island_line_reached",
      "once": true,
      "when": { "type": "unit_reaches_tile", "team": "player", "officer_ids": ["cao_cao"], "pos": [10, 4] },
      "actions": [
        {
          "type": "set_objective",
          "victory": "The outer island line is reached. Defeat the island captain.",
          "defeat": "Cao Cao is defeated or the battle reaches Turn 18."
        },
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Cao Cao", "text": "This island is no refuge. Its road now belongs to Wei." },
            { "speaker": "Outer Island Captain", "text": "Then we make the coves our road and leave you holding sand." }
          ]
        },
        {
          "type": "spawn_deployments",
          "deployments": [
            {
              "unit_id": "outer_island_last_guard",
              "name": "Outer Island Last Guard",
              "class_id": "guard_captain",
              "team": "enemy",
              "level": 64,
              "pos": [16, 4],
              "base": { "hp": 158, "atk": 65, "def": 58 }
            },
            {
              "unit_id": "outer_island_crossbow_boat",
              "name": "Outer Island Crossbow Boat",
              "class_id": "marksman",
              "team": "enemy",
              "move_type": "water",
              "level": 64,
              "pos": [10, 1],
              "base": { "hp": 134, "atk": 64, "def": 38, "agi": 52 }
            }
          ]
        }
      ]
    },
    {
      "id": "turn_9_island_line_frays",
      "once": true,
      "when": { "type": "turn_start", "team": "player", "turn": 9 },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Dian Wei", "text": "The island line is cracking. The men on shore keep glancing toward the coves." },
            { "speaker": "Cao Cao", "text": "Then take the line before they remember how to run." }
          ]
        }
      ]
    }
  ],
  "rewards": {
    "gold": 13200,
    "items": ["bean", "wine", "war_axe"]
  },
  "post_battle_dialogue": [
    { "speaker": "Guo Jia", "text": "The outer islands are broken. Wei can secure them into the coastal register, or press the hidden coves before the last refuge becomes a new harbor." },
    { "speaker": "Cao Ren", "text": "Securing the islands steadies the sea road. Pressing the coves leaves no place for exile to pretend it is command." },
    { "speaker": "Cao Cao", "text": "A hidden cove is only hidden until the victorious army decides to count it." }
  ],
  "post_battle_choices": [
    {
      "id": "secure_outer_islands",
      "label": "Secure Islands",
      "description": "Cao Cao secures the outer islands into Wei's coastal register.",
      "set_flags": { "secured_outer_islands": true, "pressed_hidden_coves": false },
      "gold": 2600,
      "items": ["imperial_seal"]
    },
    {
      "id": "press_hidden_coves",
      "label": "Press Coves",
      "description": "Cao Cao presses the hidden coves before the last refuge can become a harbor.",
      "set_flags": { "secured_outer_islands": false, "pressed_hidden_coves": true },
      "gold": 2400,
      "items": ["war_drum"]
    }
  ]
}
