{
  "id": "046_jingzhou_supply_line",
  "name": "Jingzhou Supply Line",
  "objectives": {
    "victory": "Reach Guan Yu's supply depot with Cao Cao, then defeat the Jingzhou rearguard.",
    "defeat": "Cao Cao is defeated or the battle reaches Turn 18."
  },
  "conditions": {
    "victory": { "type": "all_units_defeated", "team": "enemy", "after_event": "jingzhou_supply_depot_reached" },
    "defeat": [
      { "type": "any_officer_defeated", "team": "player", "officer_ids": ["cao_cao"] },
      { "type": "turn_reached", "turn": 18, "team": "player" }
    ]
  },
  "briefing": {
    "title": "Jingzhou Supply Line",
    "location": "Jingzhou Supply Road, Han River Front, 219 CE",
    "lines": [
      "Fancheng has been relieved, but Guan Yu's siege army still draws strength from the Jingzhou supply road.",
      "Cao Cao's army moves to break the depot line before the enemy can turn another siege into another flood of pressure."
    ],
    "conditional_lines": [
      {
        "campaign_flags": { "reinforced_fancheng": true },
        "lines": [
          "Reinforcing Fancheng leaves Cao Ren secure enough to hold the gate while Cao Cao strikes the supply road."
        ]
      },
      {
        "campaign_flags": { "struck_jingzhou_supply": true },
        "lines": [
          "The first strike against Jingzhou's supply road has rattled Guan Yu's rear, but the rearguard now expects a second blow."
        ]
      }
    ]
  },
  "shop": {
    "items": [
      "bean",
      "wine",
      "iron_sword",
      "training_spear",
      "short_bow",
      "hand_axe",
      "war_axe",
      "leather_armor",
      "iron_armor"
    ],
    "conditional_items": [
      {
        "campaign_flags": { "reinforced_fancheng": true },
        "items": ["imperial_seal"]
      },
      {
        "campaign_flags": { "struck_jingzhou_supply": 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": [
      "GGGGHHGGGGGGHHGGGG",
      "GGFFHHGGRRGGHHFFGG",
      "GGRRRRRRRRRRRRFFGG",
      "GGGFGHGGGGRRGGGGGG",
      "RRRRRRRRRRRRRRRRRR",
      "GGGGGHHGGGRRGFFGGG",
      "GGHHGFFFGGFFFGGHHG",
      "GGHHGFFFGGFFFGGHHG",
      "GGGGGGFFGGHHHGGGGG",
      "GGFFGGGGGGHHHFFGGG",
      "GGGGGGGGGGGGGGGGGG"
    ]
  },
  "deployments": [
    {
      "unit_id": "cao_cao_ch46",
      "officer_id": "cao_cao",
      "team": "player",
      "pos": [1, 4]
    },
    {
      "unit_id": "guo_jia_ch46",
      "officer_id": "guo_jia",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 4]
    },
    {
      "unit_id": "zhang_he_ch46",
      "officer_id": "zhang_he",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 3]
    },
    {
      "unit_id": "xiahou_dun_ch46",
      "officer_id": "xiahou_dun",
      "team": "player",
      "pos": [1, 5]
    },
    {
      "unit_id": "dian_wei_ch46",
      "officer_id": "dian_wei",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 5]
    },
    {
      "unit_id": "xiahou_yuan_ch46",
      "officer_id": "xiahou_yuan",
      "team": "player",
      "requires_joined": true,
      "pos": [3, 3]
    },
    {
      "unit_id": "cao_ren_ch46",
      "officer_id": "cao_ren",
      "team": "player",
      "requires_joined": true,
      "pos": [3, 4]
    },
    {
      "unit_id": "jingzhou_supply_commander",
      "name": "Jingzhou Supply Commander",
      "class_id": "commander",
      "team": "enemy",
      "level": 43,
      "pos": [14, 4],
      "base": { "hp": 142, "mp": 64, "atk": 44, "def": 36, "int": 36, "agi": 24 }
    },
    {
      "unit_id": "guan_yu_rearguard_captain",
      "name": "Guan Yu Rearguard Captain",
      "class_id": "guard_captain",
      "team": "enemy",
      "level": 43,
      "pos": [12, 4],
      "base": { "hp": 118, "atk": 44, "def": 37 }
    },
    {
      "unit_id": "han_river_supply_champion",
      "name": "Han River Supply Champion",
      "class_id": "champion",
      "team": "enemy",
      "level": 43,
      "pos": [15, 3],
      "base": { "hp": 146, "mp": 12, "atk": 46, "def": 33, "int": 13, "agi": 29 }
    },
    {
      "unit_id": "jingzhou_supply_advisor",
      "name": "Jingzhou Supply Advisor",
      "class_id": "military_advisor",
      "team": "enemy",
      "level": 43,
      "pos": [13, 5],
      "skills": ["blaze", "great_mend"],
      "base": { "hp": 106, "mp": 90, "atk": 8, "def": 24, "int": 46, "agi": 22 }
    },
    {
      "unit_id": "jingzhou_supply_spear_north",
      "name": "Jingzhou Supply Spear",
      "class_id": "infantry",
      "team": "enemy",
      "level": 43,
      "pos": [12, 3],
      "base": { "hp": 108, "atk": 44, "def": 34 }
    },
    {
      "unit_id": "jingzhou_supply_spear_south",
      "name": "Jingzhou Supply Spear",
      "class_id": "infantry",
      "team": "enemy",
      "level": 43,
      "pos": [12, 5],
      "base": { "hp": 108, "atk": 44, "def": 34 }
    },
    {
      "unit_id": "jingzhou_supply_marksman",
      "name": "Jingzhou Supply Marksman",
      "class_id": "marksman",
      "team": "enemy",
      "level": 43,
      "pos": [13, 2],
      "base": { "hp": 100, "atk": 45, "def": 20, "agi": 32 }
    }
  ],
  "events": [
    {
      "id": "opening",
      "once": true,
      "when": { "type": "battle_start" },
      "actions": [
        { "type": "log", "text": "Cao Cao's army moves against Jingzhou's supply road after relieving Fancheng." }
      ]
    },
    {
      "id": "opening_dialogue",
      "once": true,
      "when": { "type": "battle_begin" },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Cao Ren", "text": "Fancheng breathes again, but Guan Yu's supply road still feeds the siege army's pride." },
            { "speaker": "Guo Jia", "text": "Cut the road and courage becomes a hungry thing." },
            { "speaker": "Cao Cao", "text": "Then we do not chase banners. We cut what lets them stand." }
          ]
        }
      ]
    },
    {
      "id": "reinforced_fancheng_holds_gate",
      "once": true,
      "when": { "type": "turn_start", "team": "player", "turn": 2, "campaign_flags": { "reinforced_fancheng": true } },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Cao Ren", "text": "Fancheng's reinforcement holds. I can keep the gate while you break the road." },
            { "speaker": "Cao Cao", "text": "Good. A held wall lets a moving army strike harder." }
          ]
        }
      ]
    },
    {
      "id": "supply_strike_rouses_rearguard",
      "once": true,
      "when": { "type": "turn_start", "team": "enemy", "turn": 2, "campaign_flags": { "struck_jingzhou_supply": true } },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Jingzhou Supply Commander", "text": "Cao Cao strikes the supply road again. Call the rear riders before the depot burns." },
            { "speaker": "Zhang He", "text": "They expected us. That means they know where the wound is." }
          ]
        },
        {
          "type": "spawn_deployment",
          "deployment": {
            "unit_id": "jingzhou_rear_riders",
            "name": "Jingzhou Rear Riders",
            "class_id": "cavalry",
            "team": "enemy",
            "level": 43,
            "pos": [16, 3],
            "base": { "hp": 98, "atk": 40, "def": 24, "agi": 30 }
          }
        }
      ]
    },
    {
      "id": "turn_4_depot_pressure",
      "once": true,
      "when": { "type": "turn_start", "team": "enemy", "turn": 4 },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Jingzhou Supply Advisor", "text": "Do not let them touch the depot. If the road falls, Guan Yu's siege hears hunger before orders." },
            { "speaker": "Guo Jia", "text": "They know the depot is the army's throat." }
          ]
        }
      ]
    },
    {
      "id": "jingzhou_supply_depot_reached",
      "once": true,
      "when": { "type": "unit_reaches_tile", "team": "player", "officer_ids": ["cao_cao"], "pos": [10, 4] },
      "actions": [
        {
          "type": "set_objective",
          "victory": "Guan Yu's supply depot is reached. Defeat the Jingzhou rearguard.",
          "defeat": "Cao Cao is defeated or the battle reaches Turn 18."
        },
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Cao Cao", "text": "This is the depot. Break the guard and Guan Yu's siege must count every mouth." },
            { "speaker": "Jingzhou Supply Commander", "text": "The road feeds loyalty. Defend it!" }
          ]
        },
        {
          "type": "spawn_deployments",
          "deployments": [
            {
              "unit_id": "jingzhou_depot_guard",
              "name": "Jingzhou Depot Guard",
              "class_id": "guard_captain",
              "team": "enemy",
              "level": 43,
              "pos": [16, 4],
              "base": { "hp": 116, "atk": 44, "def": 37 }
            },
            {
              "unit_id": "jingzhou_depot_arrow_screen",
              "name": "Jingzhou Depot Arrow Screen",
              "class_id": "archer",
              "team": "enemy",
              "level": 43,
              "pos": [16, 5],
              "base": { "hp": 92, "atk": 43, "def": 17, "agi": 31 }
            }
          ]
        }
      ]
    },
    {
      "id": "turn_9_supply_line_breaks",
      "once": true,
      "when": { "type": "turn_start", "team": "player", "turn": 9 },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Xiahou Yuan", "text": "Their depot guard is wavering. The supply road is starting to sound empty." },
            { "speaker": "Cao Cao", "text": "Then finish the silence." }
          ]
        }
      ]
    }
  ],
  "rewards": {
    "gold": 9000,
    "items": ["bean", "wine", "imperial_seal"]
  },
  "post_battle_dialogue": [
    { "speaker": "Guo Jia", "text": "The Jingzhou supply line is cut. Guan Yu's siege still has teeth, but the jaw is weaker." },
    { "speaker": "Cao Ren", "text": "We can secure Fancheng's road and let the siege starve, or pursue Guan Yu's rearguard while it reels." },
    { "speaker": "Cao Cao", "text": "A hungry enemy can retreat or rage. Choose which answer we force." }
  ],
  "post_battle_choices": [
    {
      "id": "secure_fancheng_line",
      "label": "Secure Line",
      "description": "Cao Cao secures Fancheng's line and lets Guan Yu's siege lose strength.",
      "set_flags": { "secured_fancheng_line": true, "pursued_guan_yu_rearguard": false },
      "gold": 1550,
      "items": ["imperial_seal"]
    },
    {
      "id": "pursue_guan_yu_rearguard",
      "label": "Pursue Rearguard",
      "description": "Cao Cao pursues Guan Yu's rearguard before it can recover from the supply loss.",
      "set_flags": { "secured_fancheng_line": false, "pursued_guan_yu_rearguard": true },
      "gold": 1350,
      "items": ["war_drum"]
    }
  ]
}
