From f26952e39ee9dceeaaaeab9b41c7dfa00ae8fb57 Mon Sep 17 00:00:00 2001 From: Wickedness Date: Fri, 19 Jun 2026 02:37:29 +0900 Subject: [PATCH] Add Bohai remnant camp flow --- data/scenarios/021_bohai_remnants.json | 61 ++++++++ data/scenarios/022_liaoxi_pursuit.json | 2 +- tools/smoke_camp_conversation_rewards.gd | 180 +++++++++++++++++++++++ tools/smoke_visual_assets.gd | 79 ++++++++++ 4 files changed, 321 insertions(+), 1 deletion(-) diff --git a/data/scenarios/021_bohai_remnants.json b/data/scenarios/021_bohai_remnants.json index cc16a6a..9419dbe 100644 --- a/data/scenarios/021_bohai_remnants.json +++ b/data/scenarios/021_bohai_remnants.json @@ -32,9 +32,70 @@ "Bohai's surrendered towns now feed Cao Cao's advance, leaving Yuan loyalists short on safe roads and honest guides." ] } + ], + "camp_conversations": [ + { + "id": "bohai_remnants_exile_council", + "group": "topic", + "label": "Bohai Exile Council", + "speaker": "Cao Cao", + "summary": "Set the order before the Yuan brothers turn Bohai into a road north.", + "lines": [ + { "speaker": "Cao Cao", "side": "left", "text": "Yuan blood no longer holds a city, so it will try to become a road. A road is harder to shame than a gate." }, + { "speaker": "Guo Jia", "side": "right", "text": "Then we do not argue with the bloodline. We cut the road, and the argument ends without witnesses." }, + { "speaker": "Zhang He", "side": "right", "text": "Their guards are not defending Bohai. They are buying hours for Yuan Shang and Yuan Xi to reach northern riders." } + ] + }, + { + "id": "bohai_remnants_zhang_he_escape_road", + "group": "officer", + "officer_id": "zhang_he", + "label": "Zhang He - Escape Road", + "speaker": "Zhang He", + "summary": "Read the remnant camp's escape route before the advance begins.", + "lines": [ + { "speaker": "Zhang He", "side": "right", "text": "The Yuan brothers learned from Nanpi. Their best men stand away from the camp, guarding distance rather than walls." }, + { "speaker": "Cao Cao", "side": "left", "text": "Then we strike the distance and let the camp discover it has nowhere to flee." } + ] + }, + { + "id": "bohai_remnants_fast_column_wine", + "campaign_flags": { "pursued_yuan_brothers": true }, + "group": "topic", + "label": "Fast Column Wine", + "summary": "Claim wine carried by the columns that never let the Yuan brothers breathe.", + "lines": [ + { "speaker": "Xiahou Yuan", "side": "right", "text": "The fast columns kept wine in small skins. They did not stop to drink it, which is either discipline or a crime." }, + { "speaker": "Guo Jia", "side": "left", "text": "Today it becomes discipline. Issue it before the chase turns thin." } + ], + "effects": [ + { "type": "grant_item", "item_id": "wine", "count": 1, "text": "The fast column wine adds a Wine to the field supplies." } + ] + }, + { + "id": "bohai_remnants_commandery_medicine", + "campaign_flags": { "secured_bohai_commandery": true }, + "group": "topic", + "label": "Commandery Medicine", + "summary": "Claim medicine sent by surrendered Bohai towns and road clerks.", + "lines": [ + { "speaker": "Cao Ren", "side": "right", "text": "Bohai towns sent medicine with route tablets. The clerks want our banners to know which doors opened first." }, + { "speaker": "Cao Cao", "side": "left", "text": "A surrendered town that heals our men has already chosen its future." } + ], + "effects": [ + { "type": "grant_item", "item_id": "panacea", "count": 1, "text": "The Bohai commandery medicine adds a Panacea to the field supplies." } + ] + } ] }, "shop": { + "merchant": { + "name": "Bohai Road Sutler", + "lines": [ + "Bohai roads are full of men selling yesterday's loyalty for tomorrow's shoes.", + "Buy before the Yuan brothers borrow northern horses, my lord. Frontier prices run faster than carts." + ] + }, "items": [ "bean", "wine", diff --git a/data/scenarios/022_liaoxi_pursuit.json b/data/scenarios/022_liaoxi_pursuit.json index d0351f4..7c0a5b0 100644 --- a/data/scenarios/022_liaoxi_pursuit.json +++ b/data/scenarios/022_liaoxi_pursuit.json @@ -59,7 +59,7 @@ }, "roster": { "max_units": 7, - "required_officers": ["cao_cao", "guo_jia"] + "required_officers": ["cao_cao", "guo_jia", "zhang_he"] }, "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]] diff --git a/tools/smoke_camp_conversation_rewards.gd b/tools/smoke_camp_conversation_rewards.gd index 5b46cde..a04a74e 100644 --- a/tools/smoke_camp_conversation_rewards.gd +++ b/tools/smoke_camp_conversation_rewards.gd @@ -78,6 +78,10 @@ const NANPI_SURRENDER_PRESSURE_CONVERSATION_ID := "nanpi_surrender_pressure_wine const NANPI_SURRENDER_ADMIN_CONVERSATION_ID := "nanpi_surrender_admin_medicine" const BOHAI_SCENARIO_ID := "021_bohai_remnants" const BOHAI_SCENARIO_PATH := "res://data/scenarios/021_bohai_remnants.json" +const BOHAI_FAST_COLUMN_CONVERSATION_ID := "bohai_remnants_fast_column_wine" +const BOHAI_COMMANDERY_CONVERSATION_ID := "bohai_remnants_commandery_medicine" +const LIAOXI_SCENARIO_ID := "022_liaoxi_pursuit" +const LIAOXI_SCENARIO_PATH := "res://data/scenarios/022_liaoxi_pursuit.json" const SAVE_PATH := "user://campaign_save.json" const MANUAL_SAVE_PATH := "user://campaign_manual_save.json" @@ -107,6 +111,7 @@ func _init() -> void: _check_northern_pursuit_post_battle_choice_bridges_to_nanpi(failures) _check_nanpi_post_battle_choice_bridges_to_surrender(failures) _check_nanpi_surrender_post_battle_choice_bridges_to_bohai(failures) + _check_bohai_post_battle_choice_bridges_to_liaoxi(failures) _check_manual_checkpoint_reverts_claim(failures) _check_completed_replay_cannot_claim(failures) _check_conditional_camp_conversations(failures) @@ -119,6 +124,7 @@ func _init() -> void: _check_northern_pursuit_branch_camp_conversations(failures) _check_nanpi_branch_camp_conversations(failures) _check_nanpi_surrender_branch_camp_conversations(failures) + _check_bohai_branch_camp_conversations(failures) _check_talk_menu_closes_on_cancel_and_reload(failures) if not _restore_user_file(SAVE_PATH, save_backup): @@ -1149,6 +1155,25 @@ func _check_nanpi_surrender_post_battle_choice_bridges_to_bohai(failures: Array[ ) +func _check_bohai_post_battle_choice_bridges_to_liaoxi(failures: Array[String]) -> void: + _check_bohai_choice_branch_to_liaoxi( + failures, + "press_liaoxi_pursuit", + "pressed_liaoxi_pursuit", + "secured_liaoxi_approaches", + "war_drum", + "imperial_seal" + ) + _check_bohai_choice_branch_to_liaoxi( + failures, + "secure_liaoxi_approaches", + "secured_liaoxi_approaches", + "pressed_liaoxi_pursuit", + "imperial_seal", + "war_drum" + ) + + func _check_wuchao_choice_branch_to_cangting( failures: Array[String], choice_id: String, @@ -1733,6 +1758,79 @@ func _check_nanpi_surrender_choice_branch_to_bohai( scene.free() +func _check_bohai_choice_branch_to_liaoxi( + failures: Array[String], + choice_id: String, + expected_flag: String, + cleared_flag: String, + expected_shop_item_id: String, + hidden_shop_item_id: String +) -> void: + var scene = _new_prebattle_scene_for(failures, "Bohai choice bridge %s" % choice_id, BOHAI_SCENARIO_ID, BOHAI_SCENARIO_PATH) + if scene == null: + return + if not scene.campaign_state.joined_officers.has("zhang_he"): + scene.campaign_state.joined_officers.append("zhang_he") + if not scene.state.load_battle( + BOHAI_SCENARIO_PATH, + scene.campaign_state.get_roster_overrides(), + scene.campaign_state.get_inventory_snapshot(), + scene.campaign_state.get_flags_snapshot(), + scene.campaign_state.get_joined_officers_snapshot() + ): + failures.append("Bohai choice bridge %s could not reload Bohai with Zhang He joined" % choice_id) + scene.free() + return + scene.state.battle_status = "victory" + var result: Dictionary = scene.campaign_state.apply_battle_result(scene.state) + if not bool(result.get("saved", false)): + failures.append("Bohai choice bridge %s should save 021 victory" % choice_id) + scene.free() + return + if not scene.campaign_state.get_joined_officers_snapshot().has("zhang_he"): + failures.append("Bohai choice bridge %s should keep Zhang He before Liaoxi" % choice_id) + if bool(result.get("choice_applied", true)): + failures.append("Bohai choice bridge %s should wait for a selected post-battle choice" % choice_id) + if scene.campaign_state.pending_post_battle_choice_scenario_id != BOHAI_SCENARIO_ID: + failures.append("Bohai choice bridge %s should mark Bohai choice pending" % choice_id) + var choice := _find_choice_by_id(result.get("post_battle_choices", []), choice_id) + if choice.is_empty(): + failures.append("Bohai choice bridge missing choice: %s" % choice_id) + scene.free() + return + if not scene.campaign_state.try_apply_post_battle_choice(choice, BOHAI_SCENARIO_ID): + failures.append("Bohai choice bridge %s should save selected choice" % choice_id) + scene.free() + return + var flags: Dictionary = scene.campaign_state.get_flags_snapshot() + if flags.get(expected_flag, false) != true: + failures.append("Bohai choice bridge %s should set %s" % [choice_id, expected_flag]) + if flags.get(cleared_flag, true) != false: + failures.append("Bohai choice bridge %s should clear %s" % [choice_id, cleared_flag]) + if scene.campaign_state.current_scenario_id != LIAOXI_SCENARIO_ID: + failures.append("Bohai choice bridge %s should advance to Liaoxi, got %s" % [choice_id, scene.campaign_state.current_scenario_id]) + if not scene.state.load_battle( + LIAOXI_SCENARIO_PATH, + scene.campaign_state.get_roster_overrides(), + scene.campaign_state.get_inventory_snapshot(), + flags, + scene.campaign_state.get_joined_officers_snapshot() + ): + failures.append("Bohai choice bridge %s could not load Liaoxi" % choice_id) + scene.free() + return + if scene.state.get_unit("zhang_he_ch22").is_empty(): + failures.append("Bohai choice bridge %s should deploy Zhang He in Liaoxi" % choice_id) + elif not scene.state.is_required_deployment("zhang_he_ch22"): + failures.append("Bohai choice bridge %s should require Zhang He in Liaoxi" % choice_id) + var shop_items: Array = scene.state.get_shop_item_ids() + if not shop_items.has(expected_shop_item_id): + failures.append("Bohai choice bridge %s should expose shop item %s" % [choice_id, expected_shop_item_id]) + if shop_items.has(hidden_shop_item_id): + failures.append("Bohai choice bridge %s should hide shop item %s" % [choice_id, hidden_shop_item_id]) + scene.free() + + func _find_choice_by_id(choices, choice_id: String) -> Dictionary: if typeof(choices) != TYPE_ARRAY: return {} @@ -2572,6 +2670,88 @@ func _check_nanpi_surrender_branch_camp_conversations(failures: Array[String]) - admin_scene.free() +func _check_bohai_branch_camp_conversations(failures: Array[String]) -> void: + var base_scene = _new_prebattle_scene_for(failures, "Bohai base camp", BOHAI_SCENARIO_ID, BOHAI_SCENARIO_PATH) + if base_scene != null: + if base_scene._camp_conversation_by_id("bohai_remnants_exile_council").is_empty(): + failures.append("Bohai should expose the exile council conversation") + if base_scene._camp_conversation_by_id("bohai_remnants_zhang_he_escape_road").is_empty(): + failures.append("Bohai should expose Zhang He's escape road conversation") + if not base_scene._camp_conversation_by_id(BOHAI_FAST_COLUMN_CONVERSATION_ID).is_empty(): + failures.append("Bohai fast column wine should be hidden without pursued Yuan brothers flag") + if not base_scene._camp_conversation_by_id(BOHAI_COMMANDERY_CONVERSATION_ID).is_empty(): + failures.append("Bohai commandery medicine should be hidden without secured Bohai flag") + var merchant: Dictionary = base_scene.state.get_shop_merchant() + if str(merchant.get("name", "")) != "Bohai Road Sutler": + failures.append("Bohai shop merchant name should be present") + var merchant_lines: Array = merchant.get("lines", []) + if merchant_lines.size() < 2: + failures.append("Bohai shop merchant should expose flavor lines") + if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics": + failures.append("Bohai base talk status should summarize two non-supply topics") + base_scene.free() + + var pursued_scene = _new_prebattle_scene_for( + failures, + "Bohai pursued camp", + BOHAI_SCENARIO_ID, + BOHAI_SCENARIO_PATH, + {"pursued_yuan_brothers": true} + ) + if pursued_scene != null: + var fast_wine: Dictionary = pursued_scene._camp_conversation_by_id(BOHAI_FAST_COLUMN_CONVERSATION_ID) + if fast_wine.is_empty(): + failures.append("pursued Yuan brothers flag should expose Bohai fast column wine") + if not pursued_scene._camp_conversation_by_id(BOHAI_COMMANDERY_CONVERSATION_ID).is_empty(): + failures.append("pursued Yuan brothers flag should not expose Bohai commandery medicine") + if not fast_wine.is_empty(): + if pursued_scene._format_talk_status_text(pursued_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": + failures.append("Bohai pursued talk status should show one ready supply") + if not pursued_scene._format_camp_conversation_button_text(fast_wine).contains("Supply Wine"): + failures.append("Bohai fast column wine button should show Wine supply") + var before_wine := int(pursued_scene.campaign_state.get_inventory_snapshot().get("wine", 0)) + pursued_scene._apply_camp_conversation_effects(fast_wine) + if int(pursued_scene.campaign_state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1: + failures.append("Bohai fast column wine should add Wine to campaign inventory") + if int(pursued_scene.state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1: + failures.append("Bohai fast column wine should refresh battle Wine inventory") + if not pursued_scene.campaign_state.has_claimed_camp_conversation_effects(BOHAI_SCENARIO_ID, BOHAI_FAST_COLUMN_CONVERSATION_ID): + failures.append("Bohai fast column wine claim should be saved") + if pursued_scene._format_talk_status_text(pursued_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": + failures.append("Bohai pursued talk status should show claimed supply after claim") + pursued_scene.free() + + var secured_scene = _new_prebattle_scene_for( + failures, + "Bohai secured camp", + BOHAI_SCENARIO_ID, + BOHAI_SCENARIO_PATH, + {"secured_bohai_commandery": true} + ) + if secured_scene != null: + var commandery_medicine: Dictionary = secured_scene._camp_conversation_by_id(BOHAI_COMMANDERY_CONVERSATION_ID) + if commandery_medicine.is_empty(): + failures.append("secured Bohai flag should expose Bohai commandery medicine") + if not secured_scene._camp_conversation_by_id(BOHAI_FAST_COLUMN_CONVERSATION_ID).is_empty(): + failures.append("secured Bohai flag should not expose Bohai fast column wine") + if not commandery_medicine.is_empty(): + if secured_scene._format_talk_status_text(secured_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": + failures.append("Bohai secured talk status should show one ready supply") + if not secured_scene._format_camp_conversation_button_text(commandery_medicine).contains("Supply Panacea"): + failures.append("Bohai commandery medicine button should show Panacea supply") + var before_panacea := int(secured_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) + secured_scene._apply_camp_conversation_effects(commandery_medicine) + if int(secured_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: + failures.append("Bohai commandery medicine should add Panacea to campaign inventory") + if int(secured_scene.state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: + failures.append("Bohai commandery medicine should refresh battle Panacea inventory") + if not secured_scene.campaign_state.has_claimed_camp_conversation_effects(BOHAI_SCENARIO_ID, BOHAI_COMMANDERY_CONVERSATION_ID): + failures.append("Bohai commandery medicine claim should be saved") + if secured_scene._format_talk_status_text(secured_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": + failures.append("Bohai secured talk status should show claimed supply after claim") + secured_scene.free() + + func _check_talk_menu_closes_on_cancel_and_reload(failures: Array[String]) -> void: var scene = _new_prebattle_scene(failures, "talk menu close guards") if scene == null: diff --git a/tools/smoke_visual_assets.gd b/tools/smoke_visual_assets.gd index 0364630..140f89f 100644 --- a/tools/smoke_visual_assets.gd +++ b/tools/smoke_visual_assets.gd @@ -1265,6 +1265,85 @@ func _check_battle_visual_data(failures: Array[String]) -> void: ).is_empty(): failures.append("020 old Nanpi Pressure flags should not expose admin medicine") + var bohai_state = BattleStateScript.new() + if not bohai_state.load_battle("res://data/scenarios/021_bohai_remnants.json"): + failures.append("could not load Bohai camp data") + else: + _check_shop_items_unique(failures, bohai_state, "021 base") + var bohai_conversations: Array = bohai_state.get_briefing().get("camp_conversations", []) + if bohai_conversations.size() != 2: + failures.append("021 base briefing should expose exactly two camp conversations") + else: + _check_camp_conversation(failures, bohai_conversations[0], "bohai_remnants_exile_council", "topic", "") + _check_camp_conversation(failures, bohai_conversations[1], "bohai_remnants_zhang_he_escape_road", "officer", "zhang_he") + var bohai_merchant := bohai_state.get_shop_merchant() + if str(bohai_merchant.get("name", "")) != "Bohai Road Sutler": + failures.append("021 shop should expose Bohai Road merchant name") + if (bohai_merchant.get("lines", []) as Array).size() < 2: + failures.append("021 shop should expose merchant flavor lines") + _check_shop_item_visibility(failures, bohai_state, "war_drum", false, "021 base") + _check_shop_item_visibility(failures, bohai_state, "imperial_seal", false, "021 base") + _check_shop_item_visibility(failures, bohai_state, "iron_armor", true, "021 base") + + var bohai_pursued_state = BattleStateScript.new() + if not bohai_pursued_state.load_battle("res://data/scenarios/021_bohai_remnants.json", {}, {}, {"pursued_yuan_brothers": true}): + failures.append("could not load Bohai pursued Yuan brothers camp data") + else: + _check_shop_items_unique(failures, bohai_pursued_state, "021 pursued Yuan brothers") + var fast_wine: Dictionary = _find_camp_conversation( + bohai_pursued_state.get_briefing().get("camp_conversations", []), + "bohai_remnants_fast_column_wine" + ) + if fast_wine.is_empty(): + failures.append("021 pursued Yuan brothers flag should expose fast column wine") + else: + _check_camp_conversation_effect(failures, fast_wine, "wine", 1) + if not _find_camp_conversation( + bohai_pursued_state.get_briefing().get("camp_conversations", []), + "bohai_remnants_commandery_medicine" + ).is_empty(): + failures.append("021 pursued Yuan brothers flag should not expose commandery medicine") + _check_shop_item_visibility(failures, bohai_pursued_state, "war_drum", true, "021 pursued Yuan brothers") + _check_shop_item_visibility(failures, bohai_pursued_state, "imperial_seal", false, "021 pursued Yuan brothers") + + var bohai_secured_state = BattleStateScript.new() + if not bohai_secured_state.load_battle("res://data/scenarios/021_bohai_remnants.json", {}, {}, {"secured_bohai_commandery": true}): + failures.append("could not load Bohai secured commandery camp data") + else: + _check_shop_items_unique(failures, bohai_secured_state, "021 secured Bohai") + var commandery_medicine: Dictionary = _find_camp_conversation( + bohai_secured_state.get_briefing().get("camp_conversations", []), + "bohai_remnants_commandery_medicine" + ) + if commandery_medicine.is_empty(): + failures.append("021 secured Bohai flag should expose commandery medicine") + else: + _check_camp_conversation_effect(failures, commandery_medicine, "panacea", 1) + if not _find_camp_conversation( + bohai_secured_state.get_briefing().get("camp_conversations", []), + "bohai_remnants_fast_column_wine" + ).is_empty(): + failures.append("021 secured Bohai flag should not expose fast column wine") + _check_shop_item_visibility(failures, bohai_secured_state, "war_drum", false, "021 secured Bohai") + _check_shop_item_visibility(failures, bohai_secured_state, "imperial_seal", true, "021 secured Bohai") + + var bohai_old_flags_state = BattleStateScript.new() + if not bohai_old_flags_state.load_battle("res://data/scenarios/021_bohai_remnants.json", {}, {}, {"pressed_yuan_tan_surrender": true, "secured_nanpi_admin": true}): + failures.append("could not load Bohai old Nanpi Surrender flag camp data") + else: + _check_shop_item_visibility(failures, bohai_old_flags_state, "war_drum", false, "021 old Nanpi Surrender flags") + _check_shop_item_visibility(failures, bohai_old_flags_state, "imperial_seal", false, "021 old Nanpi Surrender flags") + if not _find_camp_conversation( + bohai_old_flags_state.get_briefing().get("camp_conversations", []), + "bohai_remnants_fast_column_wine" + ).is_empty(): + failures.append("021 old Nanpi Surrender flags should not expose fast column wine") + if not _find_camp_conversation( + bohai_old_flags_state.get_briefing().get("camp_conversations", []), + "bohai_remnants_commandery_medicine" + ).is_empty(): + failures.append("021 old Nanpi Surrender flags should not expose commandery medicine") + for item_id in ["bronze_sword", "training_spear", "short_bow", "hand_axe", "iron_armor", "panacea"]: var item := state.get_item_def(item_id) if item.is_empty():