{
  "id": "044_ruxu_crossing",
  "name": "Ruxu Crossing",
  "objectives": {
    "victory": "Reach the Ruxu crossing with Cao Cao, then defeat the Wu crossing guard.",
    "defeat": "Cao Cao is defeated or the battle reaches Turn 18."
  },
  "conditions": {
    "victory": { "type": "all_units_defeated", "team": "enemy", "after_event": "ruxu_crossing_reached" },
    "defeat": [
      { "type": "any_officer_defeated", "team": "player", "officer_ids": ["cao_cao"] },
      { "type": "turn_reached", "turn": 18, "team": "player" }
    ]
  },
  "briefing": {
    "title": "Ruxu Crossing",
    "location": "Ruxu Crossing, Eastern Front, 217 CE",
    "lines": [
      "Sun Quan's river line has bent, but the crossing itself remains guarded by boats, stakes, and Wu captains who know the channels.",
      "Cao Cao must decide whether Ruxu becomes a lasting eastern foothold or a hard-won warning before the army turns north again."
    ],
    "conditional_lines": [
      {
        "campaign_flags": { "anchored_ruxu_camps": true },
        "lines": [
          "Anchored Ruxu camps give Cao Cao a firmer bank, steady supply, and time to prepare the crossing under shield cover."
        ]
      },
      {
        "campaign_flags": { "forced_ruxu_crossing": true },
        "lines": [
          "Forcing the crossing has kept Wu off balance, but Sun Quan's captains are sending boats into the current before the camp line settles."
        ]
      }
    ]
  },
  "shop": {
    "items": [
      "bean",
      "wine",
      "iron_sword",
      "training_spear",
      "short_bow",
      "hand_axe",
      "war_axe",
      "leather_armor",
      "iron_armor"
    ],
    "conditional_items": [
      {
        "campaign_flags": { "anchored_ruxu_camps": true },
        "items": ["imperial_seal"]
      },
      {
        "campaign_flags": { "forced_ruxu_crossing": 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_ch44",
      "officer_id": "cao_cao",
      "team": "player",
      "pos": [1, 4]
    },
    {
      "unit_id": "guo_jia_ch44",
      "officer_id": "guo_jia",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 4]
    },
    {
      "unit_id": "zhang_he_ch44",
      "officer_id": "zhang_he",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 3]
    },
    {
      "unit_id": "xiahou_dun_ch44",
      "officer_id": "xiahou_dun",
      "team": "player",
      "pos": [1, 5]
    },
    {
      "unit_id": "dian_wei_ch44",
      "officer_id": "dian_wei",
      "team": "player",
      "requires_joined": true,
      "pos": [2, 5]
    },
    {
      "unit_id": "xiahou_yuan_ch44",
      "officer_id": "xiahou_yuan",
      "team": "player",
      "requires_joined": true,
      "pos": [3, 3]
    },
    {
      "unit_id": "cao_ren_ch44",
      "officer_id": "cao_ren",
      "team": "player",
      "requires_joined": true,
      "pos": [3, 4]
    },
    {
      "unit_id": "wu_crossing_guard",
      "name": "Wu Crossing Guard",
      "class_id": "commander",
      "team": "enemy",
      "level": 41,
      "pos": [14, 4],
      "base": { "hp": 138, "mp": 60, "atk": 42, "def": 34, "int": 34, "agi": 23 }
    },
    {
      "unit_id": "ruxu_crossing_captain",
      "name": "Ruxu Crossing Captain",
      "class_id": "guard_captain",
      "team": "enemy",
      "level": 41,
      "pos": [12, 4],
      "base": { "hp": 114, "atk": 42, "def": 35 }
    },
    {
      "unit_id": "gan_ning_current_boat",
      "name": "Gan Ning Current Boat",
      "class_id": "champion",
      "team": "enemy",
      "move_type": "water",
      "level": 41,
      "pos": [4, 3],
      "base": { "hp": 142, "mp": 12, "atk": 44, "def": 31, "int": 13, "agi": 28 }
    },
    {
      "unit_id": "ruxu_crossing_advisor",
      "name": "Ruxu Crossing Advisor",
      "class_id": "military_advisor",
      "team": "enemy",
      "level": 41,
      "pos": [13, 5],
      "skills": ["blaze", "great_mend"],
      "base": { "hp": 102, "mp": 86, "atk": 8, "def": 22, "int": 44, "agi": 21 }
    },
    {
      "unit_id": "ruxu_crossing_spear_north",
      "name": "Ruxu Crossing Spear",
      "class_id": "infantry",
      "team": "enemy",
      "level": 41,
      "pos": [12, 3],
      "base": { "hp": 104, "atk": 42, "def": 32 }
    },
    {
      "unit_id": "ruxu_crossing_spear_south",
      "name": "Ruxu Crossing Spear",
      "class_id": "infantry",
      "team": "enemy",
      "level": 41,
      "pos": [12, 5],
      "base": { "hp": 104, "atk": 42, "def": 32 }
    },
    {
      "unit_id": "ruxu_current_arrow_boat",
      "name": "Ruxu Current Arrow Boat",
      "class_id": "marksman",
      "team": "enemy",
      "move_type": "water",
      "level": 41,
      "pos": [5, 5],
      "base": { "hp": 96, "atk": 43, "def": 18, "agi": 31 }
    }
  ],
  "events": [
    {
      "id": "opening",
      "once": true,
      "when": { "type": "battle_start" },
      "actions": [
        { "type": "log", "text": "The Ruxu crossing waits under Wu arrows as Cao Cao's army moves between staked camps and hostile channels." }
      ]
    },
    {
      "id": "opening_dialogue",
      "once": true,
      "when": { "type": "battle_begin" },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Cao Ren", "text": "The bank is ours, but the crossing still belongs to the men who know the current." },
            { "speaker": "Guo Jia", "text": "Then we take away their certainty one stake, one boat, one captain at a time." },
            { "speaker": "Cao Cao", "text": "A crossing is not a road until soldiers stop fearing the water beside it." }
          ]
        }
      ]
    },
    {
      "id": "anchored_camps_cover_crossing",
      "once": true,
      "when": { "type": "turn_start", "team": "player", "turn": 2, "campaign_flags": { "anchored_ruxu_camps": true } },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Cao Ren", "text": "The anchored camps are holding. Shield screens can cover the crossing approach." },
            { "speaker": "Cao Cao", "text": "Then the crossing begins under order, not panic." }
          ]
        }
      ]
    },
    {
      "id": "forced_crossing_draws_counterboats",
      "once": true,
      "when": { "type": "turn_start", "team": "enemy", "turn": 2, "campaign_flags": { "forced_ruxu_crossing": true } },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Wu Crossing Guard", "text": "Cao Cao forces the crossing before his camps breathe. Counter through the side current." },
            { "speaker": "Zhang He", "text": "They are gambling on the current. We will make the shore collect the debt." }
          ]
        },
        {
          "type": "spawn_deployment",
          "deployment": {
            "unit_id": "ruxu_counter_current_boat",
            "name": "Ruxu Counter-Current Boat",
            "class_id": "champion",
            "team": "enemy",
            "move_type": "water",
            "level": 41,
            "pos": [5, 3],
            "base": { "hp": 106, "atk": 40, "def": 23, "agi": 29 }
          }
        }
      ]
    },
    {
      "id": "turn_4_crossing_stakes",
      "once": true,
      "when": { "type": "turn_start", "team": "enemy", "turn": 4 },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Ruxu Crossing Advisor", "text": "Let their front step forward and their sides fear the boats. A crossing breaks when men look sideways." },
            { "speaker": "Guo Jia", "text": "Wu is trying to make the water louder than the command drums." }
          ]
        }
      ]
    },
    {
      "id": "ruxu_crossing_reached",
      "once": true,
      "when": { "type": "unit_reaches_tile", "team": "player", "officer_ids": ["cao_cao"], "pos": [10, 4] },
      "actions": [
        {
          "type": "set_objective",
          "victory": "The Ruxu crossing is reached. Defeat the Wu crossing guard.",
          "defeat": "Cao Cao is defeated or the battle reaches Turn 18."
        },
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Cao Cao", "text": "This is the crossing. Hold it until Wu's guard has nowhere left to stand." },
            { "speaker": "Wu Crossing Guard", "text": "Ruxu's water still stands with us." }
          ]
        },
        {
          "type": "spawn_deployments",
          "deployments": [
            {
              "unit_id": "crossing_halberd_guard",
              "name": "Crossing Halberd Guard",
              "class_id": "guard_captain",
              "team": "enemy",
              "level": 41,
              "pos": [16, 4],
              "base": { "hp": 112, "atk": 42, "def": 35 }
            },
            {
              "unit_id": "crossing_arrow_boat",
              "name": "Crossing Arrow Boat",
              "class_id": "marksman",
              "team": "enemy",
              "move_type": "water",
              "level": 41,
              "pos": [10, 1],
              "base": { "hp": 90, "atk": 41, "def": 15, "agi": 30 }
            }
          ]
        }
      ]
    },
    {
      "id": "turn_9_crossing_holds",
      "once": true,
      "when": { "type": "turn_start", "team": "player", "turn": 9 },
      "actions": [
        {
          "type": "dialogue",
          "lines": [
            { "speaker": "Xiahou Dun", "text": "The crossing is holding. Their boats are circling farther from the bank." },
            { "speaker": "Cao Cao", "text": "Then the river has begun to listen. Finish the men still shouting over it." }
          ]
        }
      ]
    }
  ],
  "rewards": {
    "gold": 8600,
    "items": ["bean", "wine", "imperial_seal"]
  },
  "post_battle_dialogue": [
    { "speaker": "Guo Jia", "text": "Ruxu's crossing is broken open, but victory here will grow costly if Wu keeps feeding the river line." },
    { "speaker": "Cao Ren", "text": "We can secure the crossing as an eastern base, or turn north while Wu is still counting the boats it lost." },
    { "speaker": "Cao Cao", "text": "A crossing taken is not always a crossing kept. Choose what the army carries away from Ruxu." }
  ],
  "post_battle_choices": [
    {
      "id": "secure_ruxu_crossing",
      "label": "Secure Crossing",
      "description": "Cao Cao secures the Ruxu crossing as a forward eastern base against Wu.",
      "set_flags": { "secured_ruxu_crossing": true, "prepared_fancheng_relief": false },
      "gold": 1450,
      "items": ["imperial_seal"]
    },
    {
      "id": "prepare_fancheng_relief",
      "label": "Prepare Fancheng",
      "description": "Cao Cao turns from Ruxu to prepare relief for the northern front around Fancheng.",
      "set_flags": { "secured_ruxu_crossing": false, "prepared_fancheng_relief": true },
      "gold": 1250,
      "items": ["war_drum"]
    }
  ]
}
