extends SceneTree const BattleSceneScript := preload("res://scripts/scenes/battle_scene.gd") const CAMPAIGN_PATH := "res://data/campaign/campaign.json" const SCENARIO_ID := "001_yellow_turbans" const SCENARIO_PATH := "res://data/scenarios/001_yellow_turbans.json" const CONVERSATION_ID := "northern_woods_cache" const SISHUI_SCENARIO_ID := "002_sishui_gate" const SISHUI_SCENARIO_PATH := "res://data/scenarios/002_sishui_gate.json" const SISHUI_CONVERSATION_ID := "sishui_quartermaster_antidote" const BRANCH_SCENARIO_ID := "003_xingyang_ambush" const BRANCH_SCENARIO_PATH := "res://data/scenarios/003_xingyang_ambush.json" const QINGZHOU_SCENARIO_ID := "004_qingzhou_campaign" const QINGZHOU_SCENARIO_PATH := "res://data/scenarios/004_qingzhou_campaign.json" const PUYANG_SCENARIO_ID := "005_puyang_raid" const PUYANG_SCENARIO_PATH := "res://data/scenarios/005_puyang_raid.json" const PUYANG_CONVERSATION_ID := "puyang_raider_stores" const PUYANG_PURSUIT_CONVERSATION_ID := "puyang_hardened_vanguard" const PUYANG_REGROUP_CONVERSATION_ID := "puyang_qingzhou_reserve_wagon" const DINGTAO_SCENARIO_ID := "006_dingtao_counterattack" const DINGTAO_SCENARIO_PATH := "res://data/scenarios/006_dingtao_counterattack.json" const DINGTAO_FORTIFIED_CONVERSATION_ID := "dingtao_fortified_reserves" const DINGTAO_PRESSED_CONVERSATION_ID := "dingtao_pressed_vanguard" const XIAN_SCENARIO_ID := "007_xian_emperor_escort" const XIAN_SCENARIO_PATH := "res://data/scenarios/007_xian_emperor_escort.json" const XIAN_FORTIFIED_CONVERSATION_ID := "xian_fortified_road_supplies" const XIAN_PRESSED_CONVERSATION_ID := "xian_forced_march_canteens" const WAN_SCENARIO_ID := "008_wan_castle_escape" const WAN_SCENARIO_PATH := "res://data/scenarios/008_wan_castle_escape.json" const WAN_COURT_CONVERSATION_ID := "wan_court_seal_postern" const WAN_PURSUIT_CONVERSATION_ID := "wan_hard_pursuit_drums" const XIAPI_SCENARIO_ID := "009_xiapi_siege" const XIAPI_SCENARIO_PATH := "res://data/scenarios/009_xiapi_siege.json" const XIAPI_HELD_CONVERSATION_ID := "xiapi_wan_baggage_dressings" const XIAPI_SWIFT_CONVERSATION_ID := "xiapi_forced_march_rations" const WHITE_HORSE_SCENARIO_ID := "010_white_horse_relief" const WHITE_HORSE_SCENARIO_PATH := "res://data/scenarios/010_white_horse_relief.json" const WHITE_HORSE_XU_CONVERSATION_ID := "white_horse_xu_reserve_medicine" const WHITE_HORSE_PRESSED_CONVERSATION_ID := "white_horse_fast_march_beans" const YAN_FORD_SCENARIO_ID := "011_yan_ford_pursuit" const YAN_FORD_SCENARIO_PATH := "res://data/scenarios/011_yan_ford_pursuit.json" const YAN_FORD_FORTIFIED_CONVERSATION_ID := "yan_ford_fortified_crossing_medicine" const YAN_FORD_RAIDED_CONVERSATION_ID := "yan_ford_raided_supply_beans" const GUANDU_SCENARIO_ID := "012_guandu_showdown" const GUANDU_SCENARIO_PATH := "res://data/scenarios/012_guandu_showdown.json" const GUANDU_SECURED_CONVERSATION_ID := "guandu_secured_line_medicine" const GUANDU_SCOUTED_CONVERSATION_ID := "guandu_wuchao_scout_wine" const WUCHAO_SCENARIO_ID := "013_wuchao_raid" const WUCHAO_SCENARIO_PATH := "res://data/scenarios/013_wuchao_raid.json" const CANGTING_SCENARIO_ID := "014_cangting_pursuit" const CANGTING_SCENARIO_PATH := "res://data/scenarios/014_cangting_pursuit.json" const CANGTING_PRESSED_CONVERSATION_ID := "cangting_fast_pursuit_beans" const CANGTING_STORES_CONVERSATION_ID := "cangting_wuchao_store_medicine" const YE_SCENARIO_ID := "015_ye_campaign" const YE_SCENARIO_PATH := "res://data/scenarios/015_ye_campaign.json" const YE_RAPID_CONVERSATION_ID := "ye_rapid_march_rations" const YE_CROSSING_CONVERSATION_ID := "ye_crossing_medicine" const YE_SIEGE_SCENARIO_ID := "016_ye_siege" const YE_SIEGE_SCENARIO_PATH := "res://data/scenarios/016_ye_siege.json" const YE_SIEGE_PRESSED_CONVERSATION_ID := "ye_siege_ladder_rations" const YE_SIEGE_SPLIT_CONVERSATION_ID := "ye_siege_defector_medicine" const YE_SURRENDER_SCENARIO_ID := "017_ye_surrender" const YE_SURRENDER_SCENARIO_PATH := "res://data/scenarios/017_ye_surrender.json" const YE_SURRENDER_PRESSURE_CONVERSATION_ID := "ye_surrender_pressure_rations" const YE_SURRENDER_DEFECTOR_CONVERSATION_ID := "ye_surrender_defector_medicine" const NORTHERN_PURSUIT_SCENARIO_ID := "018_northern_pursuit" const NORTHERN_PURSUIT_SCENARIO_PATH := "res://data/scenarios/018_northern_pursuit.json" const NORTHERN_PURSUIT_HARD_MARCH_CONVERSATION_ID := "northern_pursuit_hard_march_beans" const NORTHERN_PURSUIT_JI_SUPPLY_CONVERSATION_ID := "northern_pursuit_ji_supply_medicine" const NANPI_SCENARIO_ID := "019_nanpi_pressure" const NANPI_SCENARIO_PATH := "res://data/scenarios/019_nanpi_pressure.json" const NANPI_PRESSURE_HARD_PUSH_CONVERSATION_ID := "nanpi_pressure_hard_push_beans" const NANPI_PRESSURE_ADMIN_SUPPLY_CONVERSATION_ID := "nanpi_pressure_admin_medicine" const NANPI_SURRENDER_SCENARIO_ID := "020_nanpi_surrender" const NANPI_SURRENDER_SCENARIO_PATH := "res://data/scenarios/020_nanpi_surrender.json" 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 LIAOXI_FAST_DRUMS_CONVERSATION_ID := "liaoxi_fast_pursuit_drums" const LIAOXI_APPROACH_MEDICINE_CONVERSATION_ID := "liaoxi_approach_medicine" const WHITE_WOLF_SCENARIO_ID := "023_white_wolf_mountain" const WHITE_WOLF_SCENARIO_PATH := "res://data/scenarios/023_white_wolf_mountain.json" const WHITE_WOLF_CANTEENS_CONVERSATION_ID := "white_wolf_scattered_canteens" const WHITE_WOLF_MEDICINE_CONVERSATION_ID := "white_wolf_route_medicine" const LIAODONG_SCENARIO_ID := "024_liaodong_pursuit" const LIAODONG_SCENARIO_PATH := "res://data/scenarios/024_liaodong_pursuit.json" const LIAODONG_HARD_WINE_CONVERSATION_ID := "liaodong_hard_pursuit_wine" const LIAODONG_GUIDE_MEDICINE_CONVERSATION_ID := "liaodong_wuhuan_guides_medicine" const XINYE_SCENARIO_ID := "025_xinye_advance" const XINYE_SCENARIO_PATH := "res://data/scenarios/025_xinye_advance.json" const XINYE_ORDERED_MEDICINE_CONVERSATION_ID := "xinye_ordered_medicine" const XINYE_AUTHORITY_WINE_CONVERSATION_ID := "xinye_authority_wine" const CHANGBAN_SCENARIO_ID := "026_changban_pursuit" const CHANGBAN_SCENARIO_PATH := "res://data/scenarios/026_changban_pursuit.json" const CHANGBAN_VANGUARD_RATIONS_CONVERSATION_ID := "changban_vanguard_rations" const CHANGBAN_HAN_MEDICINE_CONVERSATION_ID := "changban_han_supply_medicine" const JIANGLING_SCENARIO_ID := "027_jiangling_chase" const JIANGLING_SCENARIO_PATH := "res://data/scenarios/027_jiangling_chase.json" const JIANGLING_FAST_BEANS_CONVERSATION_ID := "jiangling_fast_column_beans" const JIANGLING_CROSSING_MEDICINE_CONVERSATION_ID := "jiangling_crossing_medicine" const XIAKOU_SCENARIO_ID := "028_xiakou_pursuit" const XIAKOU_SCENARIO_PATH := "res://data/scenarios/028_xiakou_pursuit.json" const XIAKOU_ENVOY_BEANS_CONVERSATION_ID := "xiakou_envoy_chase_beans" const XIAKOU_STOREHOUSE_MEDICINE_CONVERSATION_ID := "xiakou_storehouse_medicine" const RED_CLIFFS_SCENARIO_ID := "029_red_cliffs_fleet" const RED_CLIFFS_SCENARIO_PATH := "res://data/scenarios/029_red_cliffs_fleet.json" const SAVE_PATH := "user://campaign_save.json" const MANUAL_SAVE_PATH := "user://campaign_manual_save.json" func _init() -> void: var save_backup := _backup_user_file(SAVE_PATH) var manual_backup := _backup_user_file(MANUAL_SAVE_PATH) var failures: Array[String] = [] _check_claim_updates_campaign_and_battle(failures) _check_shop_and_armory_preserve_claim(failures) _check_sishui_gate_camp_supplies(failures) _check_puyang_raid_camp_supplies(failures) _check_dingtao_branch_camp_conversations(failures) _check_xian_branch_camp_conversations(failures) _check_wan_branch_camp_conversations(failures) _check_xiapi_branch_camp_conversations(failures) _check_white_horse_branch_camp_conversations(failures) _check_yan_ford_branch_camp_conversations(failures) _check_guandu_branch_camp_conversations(failures) _check_guandu_post_battle_choice_bridges_to_wuchao(failures) _check_wuchao_post_battle_choice_bridges_to_cangting(failures) _check_cangting_post_battle_choice_bridges_to_ye(failures) _check_ye_post_battle_choice_bridges_to_ye_siege(failures) _check_ye_siege_post_battle_choice_bridges_to_surrender(failures) _check_ye_surrender_post_battle_choice_bridges_to_northern_pursuit(failures) _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_liaoxi_post_battle_choice_bridges_to_white_wolf(failures) _check_white_wolf_post_battle_choice_bridges_to_liaodong(failures) _check_liaodong_post_battle_choice_bridges_to_xinye(failures) _check_xinye_post_battle_choice_bridges_to_changban(failures) _check_changban_post_battle_choice_bridges_to_jiangling(failures) _check_jiangling_post_battle_choice_bridges_to_xiakou(failures) _check_xiakou_post_battle_choice_bridges_to_red_cliffs(failures) _check_manual_checkpoint_reverts_claim(failures) _check_completed_replay_cannot_claim(failures) _check_conditional_camp_conversations(failures) _check_qingzhou_branch_camp_conversations(failures) _check_wuchao_branch_camp_conversations(failures) _check_cangting_branch_camp_conversations(failures) _check_ye_branch_camp_conversations(failures) _check_ye_siege_branch_camp_conversations(failures) _check_ye_surrender_branch_camp_conversations(failures) _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_liaoxi_branch_camp_conversations(failures) _check_white_wolf_branch_camp_conversations(failures) _check_liaodong_branch_camp_conversations(failures) _check_xinye_branch_camp_conversations(failures) _check_changban_branch_camp_conversations(failures) _check_jiangling_branch_camp_conversations(failures) _check_xiakou_branch_camp_conversations(failures) _check_talk_menu_closes_on_cancel_and_reload(failures) if not _restore_user_file(SAVE_PATH, save_backup): failures.append("could not restore automatic campaign save") if not _restore_user_file(MANUAL_SAVE_PATH, manual_backup): failures.append("could not restore manual campaign save") if failures.is_empty(): print("camp conversation rewards smoke ok") quit(0) return for failure in failures: push_error(failure) quit(1) func _check_claim_updates_campaign_and_battle(failures: Array[String]) -> void: var scene = _new_prebattle_scene(failures, "claim update") if scene == null: return var conversation: Dictionary = scene._camp_conversation_by_id(CONVERSATION_ID) if not _check_cache_conversation(failures, conversation): scene.free() return var before := int(scene.campaign_state.get_inventory_snapshot().get("bean", 0)) if not scene._format_camp_conversation_button_text(conversation).contains("available"): failures.append("camp conversation button should show available before claim") scene._apply_camp_conversation_effects(conversation) var campaign_after := int(scene.campaign_state.get_inventory_snapshot().get("bean", 0)) var battle_after := int(scene.state.get_inventory_snapshot().get("bean", 0)) if campaign_after != before + 1: failures.append("camp conversation should add one Bean to campaign inventory") if battle_after != before + 1: failures.append("camp conversation should refresh loaded battle inventory") if not scene.campaign_state.has_claimed_camp_conversation_effects(SCENARIO_ID, CONVERSATION_ID): failures.append("camp conversation claim should be saved in campaign ledger") if not scene._format_camp_conversation_button_text(conversation).contains("claimed"): failures.append("camp conversation button should show claimed after claim") scene._apply_camp_conversation_effects(conversation) var duplicate_after := int(scene.campaign_state.get_inventory_snapshot().get("bean", 0)) if duplicate_after != campaign_after: failures.append("camp conversation should not duplicate rewards") scene.free() func _check_shop_and_armory_preserve_claim(failures: Array[String]) -> void: var scene = _new_prebattle_scene(failures, "shop and armory preservation") if scene == null: return var conversation: Dictionary = scene._camp_conversation_by_id(CONVERSATION_ID) if not _check_cache_conversation(failures, conversation): scene.free() return scene._apply_camp_conversation_effects(conversation) var claimed_beans := int(scene.campaign_state.get_inventory_snapshot().get("bean", 0)) scene.campaign_state.gold = 1000 var antidote: Dictionary = scene.state.get_item_def("antidote") var price := int(antidote.get("price", 0)) if price <= 0 or not scene.campaign_state.try_buy_item("antidote", price, SCENARIO_ID, scene.state.get_shop_stock_limit("antidote")): failures.append("shop purchase after camp claim should save") else: scene.state.set_inventory_snapshot(scene.campaign_state.get_inventory_snapshot()) var after_buy := int(scene.campaign_state.get_inventory_snapshot().get("bean", 0)) if after_buy != claimed_beans: failures.append("shop purchase should preserve camp-claimed Bean") if not scene.campaign_state.try_save_prebattle_loadout(scene.state.get_player_roster_snapshot(), scene.state.get_inventory_snapshot()): failures.append("armory save after camp claim should save") else: var after_armory := int(scene.campaign_state.get_inventory_snapshot().get("bean", 0)) if after_armory != claimed_beans: failures.append("armory save should preserve camp-claimed Bean") if not scene.campaign_state.has_claimed_camp_conversation_effects(SCENARIO_ID, CONVERSATION_ID): failures.append("armory save should preserve camp claim ledger") scene.free() func _check_sishui_gate_camp_supplies(failures: Array[String]) -> void: var scene = _new_prebattle_scene_for(failures, "Sishui camp supplies", SISHUI_SCENARIO_ID, SISHUI_SCENARIO_PATH) if scene == null: return var conversation: Dictionary = scene._camp_conversation_by_id(SISHUI_CONVERSATION_ID) if conversation.is_empty(): failures.append("Sishui should expose quartermaster antidote conversation") scene.free() return if not scene._format_camp_conversation_button_text(conversation).contains("Supply Antidote"): failures.append("Sishui quartermaster button should preview Antidote supply") var before_antidote := int(scene.campaign_state.get_inventory_snapshot().get("antidote", 0)) scene._apply_camp_conversation_effects(conversation) if int(scene.campaign_state.get_inventory_snapshot().get("antidote", 0)) != before_antidote + 1: failures.append("Sishui quartermaster should add Antidote to campaign inventory") if int(scene.state.get_inventory_snapshot().get("antidote", 0)) != before_antidote + 1: failures.append("Sishui quartermaster should refresh battle Antidote inventory") if not scene.campaign_state.has_claimed_camp_conversation_effects(SISHUI_SCENARIO_ID, SISHUI_CONVERSATION_ID): failures.append("Sishui quartermaster claim should be saved") scene.free() func _check_puyang_raid_camp_supplies(failures: Array[String]) -> void: var scene = _new_prebattle_scene_for(failures, "Puyang raid camp supplies", PUYANG_SCENARIO_ID, PUYANG_SCENARIO_PATH) if scene == null: return if scene._camp_conversation_by_id("puyang_night_raid_council").is_empty(): failures.append("Puyang should expose the night raid council conversation") if scene._camp_conversation_by_id("puyang_dian_wei_shield").is_empty(): failures.append("Puyang should expose Dian Wei's officer conversation") if not scene._camp_conversation_by_id(PUYANG_PURSUIT_CONVERSATION_ID).is_empty(): failures.append("Puyang pursuit supplies should be hidden without pursuit flag") if not scene._camp_conversation_by_id(PUYANG_REGROUP_CONVERSATION_ID).is_empty(): failures.append("Puyang regroup supplies should be hidden without regroup flag") var conversation: Dictionary = scene._camp_conversation_by_id(PUYANG_CONVERSATION_ID) if conversation.is_empty(): failures.append("Puyang should expose raider stores conversation") scene.free() return var merchant: Dictionary = scene.state.get_shop_merchant() if str(merchant.get("name", "")) != "Puyang Night Trader": failures.append("Puyang shop merchant name should be present") var merchant_lines: Array = merchant.get("lines", []) if merchant_lines.size() < 2: failures.append("Puyang shop merchant should expose flavor lines") if scene._format_talk_status_text(scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Puyang talk status should show one ready supply") if not scene._format_camp_conversation_button_text(conversation).contains("Supply Bean"): failures.append("Puyang raider stores button should preview Bean supply") var before_bean := int(scene.campaign_state.get_inventory_snapshot().get("bean", 0)) scene._apply_camp_conversation_effects(conversation) if int(scene.campaign_state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Puyang raider stores should add Bean to campaign inventory") if int(scene.state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Puyang raider stores should refresh battle Bean inventory") if not scene.campaign_state.has_claimed_camp_conversation_effects(PUYANG_SCENARIO_ID, PUYANG_CONVERSATION_ID): failures.append("Puyang raider stores claim should be saved") if scene._format_talk_status_text(scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Puyang talk status should show claimed supply after claim") scene.free() var pursuit_scene = _new_prebattle_scene_for( failures, "Puyang pursuit camp supplies", PUYANG_SCENARIO_ID, PUYANG_SCENARIO_PATH, {"pursued_dong_zhuo": true} ) if pursuit_scene != null: var vanguard: Dictionary = pursuit_scene._camp_conversation_by_id(PUYANG_PURSUIT_CONVERSATION_ID) if vanguard.is_empty(): failures.append("Puyang pursuit flag should expose hardened vanguard supplies") if not pursuit_scene._camp_conversation_by_id(PUYANG_REGROUP_CONVERSATION_ID).is_empty(): failures.append("Puyang pursuit flag should not expose Qingzhou reserve wagon") if not vanguard.is_empty(): if pursuit_scene._format_talk_status_text(pursuit_scene._camp_conversation_entries()) != "Camp conversations | 4 topics | 2 supplies ready": failures.append("Puyang pursuit talk status should show two ready supplies") if not pursuit_scene._format_camp_conversation_button_text(vanguard).contains("Supply Wine"): failures.append("Puyang hardened vanguard button should preview Wine supply") var before_wine := int(pursuit_scene.campaign_state.get_inventory_snapshot().get("wine", 0)) pursuit_scene._apply_camp_conversation_effects(vanguard) if int(pursuit_scene.campaign_state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1: failures.append("Puyang hardened vanguard should add Wine to campaign inventory") if int(pursuit_scene.state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1: failures.append("Puyang hardened vanguard should refresh battle Wine inventory") if not pursuit_scene.campaign_state.has_claimed_camp_conversation_effects(PUYANG_SCENARIO_ID, PUYANG_PURSUIT_CONVERSATION_ID): failures.append("Puyang hardened vanguard claim should be saved") pursuit_scene.free() var regroup_scene = _new_prebattle_scene_for( failures, "Puyang regroup camp supplies", PUYANG_SCENARIO_ID, PUYANG_SCENARIO_PATH, {"regrouped_after_sishui": true} ) if regroup_scene != null: var reserve: Dictionary = regroup_scene._camp_conversation_by_id(PUYANG_REGROUP_CONVERSATION_ID) if reserve.is_empty(): failures.append("Puyang regroup flag should expose Qingzhou reserve wagon") if not regroup_scene._camp_conversation_by_id(PUYANG_PURSUIT_CONVERSATION_ID).is_empty(): failures.append("Puyang regroup flag should not expose hardened vanguard") if not reserve.is_empty(): if regroup_scene._format_talk_status_text(regroup_scene._camp_conversation_entries()) != "Camp conversations | 4 topics | 2 supplies ready": failures.append("Puyang regroup talk status should show two ready supplies") if not regroup_scene._format_camp_conversation_button_text(reserve).contains("Supply Panacea"): failures.append("Puyang Qingzhou reserve button should preview Panacea supply") var before_panacea := int(regroup_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) regroup_scene._apply_camp_conversation_effects(reserve) if int(regroup_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Puyang Qingzhou reserve should add Panacea to campaign inventory") if int(regroup_scene.state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Puyang Qingzhou reserve should refresh battle Panacea inventory") if not regroup_scene.campaign_state.has_claimed_camp_conversation_effects(PUYANG_SCENARIO_ID, PUYANG_REGROUP_CONVERSATION_ID): failures.append("Puyang Qingzhou reserve claim should be saved") regroup_scene.free() func _check_dingtao_branch_camp_conversations(failures: Array[String]) -> void: var base_scene = _new_prebattle_scene_for(failures, "Dingtao base camp", DINGTAO_SCENARIO_ID, DINGTAO_SCENARIO_PATH) if base_scene != null: if base_scene._camp_conversation_by_id("dingtao_countercharge_council").is_empty(): failures.append("Dingtao should expose the countercharge council conversation") if base_scene._camp_conversation_by_id("dingtao_dian_wei_roadblock").is_empty(): failures.append("Dingtao should expose Dian Wei's roadblock conversation") if not base_scene._camp_conversation_by_id(DINGTAO_FORTIFIED_CONVERSATION_ID).is_empty(): failures.append("Dingtao fortified supplies should be hidden without fortified flag") if not base_scene._camp_conversation_by_id(DINGTAO_PRESSED_CONVERSATION_ID).is_empty(): failures.append("Dingtao pressed supplies should be hidden without pressed flag") var merchant: Dictionary = base_scene.state.get_shop_merchant() if str(merchant.get("name", "")) != "Dingtao Field Sutler": failures.append("Dingtao shop merchant name should be present") var merchant_lines: Array = merchant.get("lines", []) if merchant_lines.size() < 2: failures.append("Dingtao shop merchant should expose flavor lines") if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics": failures.append("Dingtao base talk status should summarize two non-supply topics") base_scene.free() var fortified_scene = _new_prebattle_scene_for( failures, "Dingtao fortified camp", DINGTAO_SCENARIO_ID, DINGTAO_SCENARIO_PATH, {"fortified_yan_province": true} ) if fortified_scene != null: var reserves: Dictionary = fortified_scene._camp_conversation_by_id(DINGTAO_FORTIFIED_CONVERSATION_ID) if reserves.is_empty(): failures.append("fortified flag should expose Dingtao fortified reserves") if not fortified_scene._camp_conversation_by_id(DINGTAO_PRESSED_CONVERSATION_ID).is_empty(): failures.append("fortified flag should not expose Dingtao pressed vanguard") if not reserves.is_empty(): if fortified_scene._format_talk_status_text(fortified_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Dingtao fortified talk status should show one ready supply") if not fortified_scene._format_camp_conversation_button_text(reserves).contains("Supply Panacea"): failures.append("Dingtao fortified reserves button should preview Panacea supply") var before_panacea := int(fortified_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) fortified_scene._apply_camp_conversation_effects(reserves) if int(fortified_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Dingtao fortified reserves should add Panacea to campaign inventory") if int(fortified_scene.state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Dingtao fortified reserves should refresh battle Panacea inventory") if not fortified_scene.campaign_state.has_claimed_camp_conversation_effects(DINGTAO_SCENARIO_ID, DINGTAO_FORTIFIED_CONVERSATION_ID): failures.append("Dingtao fortified reserves claim should be saved") if fortified_scene._format_talk_status_text(fortified_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Dingtao fortified talk status should show claimed supply after claim") fortified_scene.free() var pressed_scene = _new_prebattle_scene_for( failures, "Dingtao pressed camp", DINGTAO_SCENARIO_ID, DINGTAO_SCENARIO_PATH, {"pressed_lu_bu": true} ) if pressed_scene != null: var vanguard: Dictionary = pressed_scene._camp_conversation_by_id(DINGTAO_PRESSED_CONVERSATION_ID) if vanguard.is_empty(): failures.append("pressed flag should expose Dingtao pressed vanguard") if not pressed_scene._camp_conversation_by_id(DINGTAO_FORTIFIED_CONVERSATION_ID).is_empty(): failures.append("pressed flag should not expose Dingtao fortified reserves") if not vanguard.is_empty(): if pressed_scene._format_talk_status_text(pressed_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Dingtao pressed talk status should show one ready supply") if not pressed_scene._format_camp_conversation_button_text(vanguard).contains("Supply Wine"): failures.append("Dingtao pressed vanguard button should preview Wine supply") var before_wine := int(pressed_scene.campaign_state.get_inventory_snapshot().get("wine", 0)) pressed_scene._apply_camp_conversation_effects(vanguard) if int(pressed_scene.campaign_state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1: failures.append("Dingtao pressed vanguard should add Wine to campaign inventory") if int(pressed_scene.state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1: failures.append("Dingtao pressed vanguard should refresh battle Wine inventory") if not pressed_scene.campaign_state.has_claimed_camp_conversation_effects(DINGTAO_SCENARIO_ID, DINGTAO_PRESSED_CONVERSATION_ID): failures.append("Dingtao pressed vanguard claim should be saved") if pressed_scene._format_talk_status_text(pressed_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Dingtao pressed talk status should show claimed supply after claim") pressed_scene.free() func _check_xian_branch_camp_conversations(failures: Array[String]) -> void: var base_scene = _new_prebattle_scene_for(failures, "Xian escort base camp", XIAN_SCENARIO_ID, XIAN_SCENARIO_PATH) if base_scene != null: if base_scene._camp_conversation_by_id("xian_escort_council").is_empty(): failures.append("Xian escort should expose the escort council conversation") if base_scene._camp_conversation_by_id("xian_dian_wei_envoy_screen").is_empty(): failures.append("Xian escort should expose Dian Wei's envoy screen conversation") if not base_scene._camp_conversation_by_id(XIAN_FORTIFIED_CONVERSATION_ID).is_empty(): failures.append("Xian fortified supplies should be hidden without fortified flag") if not base_scene._camp_conversation_by_id(XIAN_PRESSED_CONVERSATION_ID).is_empty(): failures.append("Xian pressed supplies should be hidden without pressed flag") var merchant: Dictionary = base_scene.state.get_shop_merchant() if str(merchant.get("name", "")) != "Escort Road Sutler": failures.append("Xian escort shop merchant name should be present") var merchant_lines: Array = merchant.get("lines", []) if merchant_lines.size() < 2: failures.append("Xian escort shop merchant should expose flavor lines") if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics": failures.append("Xian escort base talk status should summarize two non-supply topics") base_scene.free() var fortified_scene = _new_prebattle_scene_for( failures, "Xian escort fortified camp", XIAN_SCENARIO_ID, XIAN_SCENARIO_PATH, {"fortified_yan_province": true} ) if fortified_scene != null: var supplies: Dictionary = fortified_scene._camp_conversation_by_id(XIAN_FORTIFIED_CONVERSATION_ID) if supplies.is_empty(): failures.append("fortified flag should expose Xian fortified road supplies") if not fortified_scene._camp_conversation_by_id(XIAN_PRESSED_CONVERSATION_ID).is_empty(): failures.append("fortified flag should not expose Xian forced march canteens") if not supplies.is_empty(): if fortified_scene._format_talk_status_text(fortified_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Xian fortified talk status should show one ready supply") if not fortified_scene._format_camp_conversation_button_text(supplies).contains("Supply Bean"): failures.append("Xian fortified road supplies button should preview Bean supply") var before_bean := int(fortified_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) fortified_scene._apply_camp_conversation_effects(supplies) if int(fortified_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Xian fortified road supplies should add Bean to campaign inventory") if int(fortified_scene.state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Xian fortified road supplies should refresh battle Bean inventory") if not fortified_scene.campaign_state.has_claimed_camp_conversation_effects(XIAN_SCENARIO_ID, XIAN_FORTIFIED_CONVERSATION_ID): failures.append("Xian fortified road supplies claim should be saved") if fortified_scene._format_talk_status_text(fortified_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Xian fortified talk status should show claimed supply after claim") fortified_scene.free() var pressed_scene = _new_prebattle_scene_for( failures, "Xian escort pressed camp", XIAN_SCENARIO_ID, XIAN_SCENARIO_PATH, {"pressed_lu_bu": true} ) if pressed_scene != null: var canteens: Dictionary = pressed_scene._camp_conversation_by_id(XIAN_PRESSED_CONVERSATION_ID) if canteens.is_empty(): failures.append("pressed flag should expose Xian forced march canteens") if not pressed_scene._camp_conversation_by_id(XIAN_FORTIFIED_CONVERSATION_ID).is_empty(): failures.append("pressed flag should not expose Xian fortified road supplies") if not canteens.is_empty(): if pressed_scene._format_talk_status_text(pressed_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Xian pressed talk status should show one ready supply") if not pressed_scene._format_camp_conversation_button_text(canteens).contains("Supply Wine"): failures.append("Xian forced march canteens button should preview Wine supply") var before_wine := int(pressed_scene.campaign_state.get_inventory_snapshot().get("wine", 0)) pressed_scene._apply_camp_conversation_effects(canteens) if int(pressed_scene.campaign_state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1: failures.append("Xian forced march canteens should add Wine to campaign inventory") if int(pressed_scene.state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1: failures.append("Xian forced march canteens should refresh battle Wine inventory") if not pressed_scene.campaign_state.has_claimed_camp_conversation_effects(XIAN_SCENARIO_ID, XIAN_PRESSED_CONVERSATION_ID): failures.append("Xian forced march canteens claim should be saved") if pressed_scene._format_talk_status_text(pressed_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Xian pressed talk status should show claimed supply after claim") pressed_scene.free() func _check_wan_branch_camp_conversations(failures: Array[String]) -> void: var base_scene = _new_prebattle_scene_for(failures, "Wan Castle base camp", WAN_SCENARIO_ID, WAN_SCENARIO_PATH) if base_scene != null: if base_scene._camp_conversation_by_id("wan_escape_route_council").is_empty(): failures.append("Wan Castle should expose the escape route council conversation") if base_scene._camp_conversation_by_id("wan_dian_wei_rear_guard").is_empty(): failures.append("Wan Castle should expose Dian Wei's rear guard conversation") if not base_scene._camp_conversation_by_id(WAN_COURT_CONVERSATION_ID).is_empty(): failures.append("Wan court seal supplies should be hidden without court flag") if not base_scene._camp_conversation_by_id(WAN_PURSUIT_CONVERSATION_ID).is_empty(): failures.append("Wan hard pursuit supplies should be hidden without pursuit flag") var merchant: Dictionary = base_scene.state.get_shop_merchant() if str(merchant.get("name", "")) != "Wan Castle Sutler": failures.append("Wan Castle shop merchant name should be present") var merchant_lines: Array = merchant.get("lines", []) if merchant_lines.size() < 2: failures.append("Wan Castle shop merchant should expose flavor lines") if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics": failures.append("Wan Castle base talk status should summarize two non-supply topics") base_scene.free() var court_scene = _new_prebattle_scene_for( failures, "Wan Castle court seal camp", WAN_SCENARIO_ID, WAN_SCENARIO_PATH, {"secured_imperial_court": true} ) if court_scene != null: var postern: Dictionary = court_scene._camp_conversation_by_id(WAN_COURT_CONVERSATION_ID) if postern.is_empty(): failures.append("court seal flag should expose Wan postern supplies") if not court_scene._camp_conversation_by_id(WAN_PURSUIT_CONVERSATION_ID).is_empty(): failures.append("court seal flag should not expose Wan hard pursuit drums") if not postern.is_empty(): if court_scene._format_talk_status_text(court_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Wan court seal talk status should show one ready supply") if not court_scene._format_camp_conversation_button_text(postern).contains("Supply Bean"): failures.append("Wan court seal postern button should preview Bean supply") var before_bean := int(court_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) court_scene._apply_camp_conversation_effects(postern) if int(court_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Wan court seal postern should add Bean to campaign inventory") if int(court_scene.state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Wan court seal postern should refresh battle Bean inventory") if not court_scene.campaign_state.has_claimed_camp_conversation_effects(WAN_SCENARIO_ID, WAN_COURT_CONVERSATION_ID): failures.append("Wan court seal postern claim should be saved") if court_scene._format_talk_status_text(court_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Wan court seal talk status should show claimed supply after claim") court_scene.free() var pursuit_scene = _new_prebattle_scene_for( failures, "Wan Castle hard pursuit camp", WAN_SCENARIO_ID, WAN_SCENARIO_PATH, {"pursued_li_jue_remnants": true} ) if pursuit_scene != null: var drums: Dictionary = pursuit_scene._camp_conversation_by_id(WAN_PURSUIT_CONVERSATION_ID) if drums.is_empty(): failures.append("hard pursuit flag should expose Wan hard pursuit drums") if not pursuit_scene._camp_conversation_by_id(WAN_COURT_CONVERSATION_ID).is_empty(): failures.append("hard pursuit flag should not expose Wan postern supplies") if not drums.is_empty(): if pursuit_scene._format_talk_status_text(pursuit_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Wan hard pursuit talk status should show one ready supply") if not pursuit_scene._format_camp_conversation_button_text(drums).contains("Supply Wine"): failures.append("Wan hard pursuit drums button should preview Wine supply") var before_wine := int(pursuit_scene.campaign_state.get_inventory_snapshot().get("wine", 0)) pursuit_scene._apply_camp_conversation_effects(drums) if int(pursuit_scene.campaign_state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1: failures.append("Wan hard pursuit drums should add Wine to campaign inventory") if int(pursuit_scene.state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1: failures.append("Wan hard pursuit drums should refresh battle Wine inventory") if not pursuit_scene.campaign_state.has_claimed_camp_conversation_effects(WAN_SCENARIO_ID, WAN_PURSUIT_CONVERSATION_ID): failures.append("Wan hard pursuit drums claim should be saved") if pursuit_scene._format_talk_status_text(pursuit_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Wan hard pursuit talk status should show claimed supply after claim") pursuit_scene.free() func _check_xiapi_branch_camp_conversations(failures: Array[String]) -> void: var base_scene = _new_prebattle_scene_for(failures, "Xiapi base camp", XIAPI_SCENARIO_ID, XIAPI_SCENARIO_PATH) if base_scene != null: if base_scene._camp_conversation_by_id("xiapi_floodgate_council").is_empty(): failures.append("Xiapi should expose the floodgate council conversation") if base_scene._camp_conversation_by_id("xiapi_dian_wei_siege_road").is_empty(): failures.append("Xiapi should expose Dian Wei's siege road conversation") if not base_scene._camp_conversation_by_id(XIAPI_HELD_CONVERSATION_ID).is_empty(): failures.append("Xiapi Wan baggage dressings should be hidden without held Wan gate flag") if not base_scene._camp_conversation_by_id(XIAPI_SWIFT_CONVERSATION_ID).is_empty(): failures.append("Xiapi forced march rations should be hidden without swift Wan escape flag") var merchant: Dictionary = base_scene.state.get_shop_merchant() if str(merchant.get("name", "")) != "Xiapi Flood-Gate Sutler": failures.append("Xiapi shop merchant name should be present") var merchant_lines: Array = merchant.get("lines", []) if merchant_lines.size() < 2: failures.append("Xiapi shop merchant should expose flavor lines") if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics": failures.append("Xiapi base talk status should summarize two non-supply topics") base_scene.free() var held_scene = _new_prebattle_scene_for( failures, "Xiapi held Wan gate camp", XIAPI_SCENARIO_ID, XIAPI_SCENARIO_PATH, {"held_wan_gate": true} ) if held_scene != null: var dressings: Dictionary = held_scene._camp_conversation_by_id(XIAPI_HELD_CONVERSATION_ID) if dressings.is_empty(): failures.append("held Wan gate flag should expose Xiapi Wan baggage dressings") if not held_scene._camp_conversation_by_id(XIAPI_SWIFT_CONVERSATION_ID).is_empty(): failures.append("held Wan gate flag should not expose Xiapi forced march rations") if not dressings.is_empty(): if held_scene._format_talk_status_text(held_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Xiapi held Wan gate talk status should show one ready supply") if not held_scene._format_camp_conversation_button_text(dressings).contains("Supply Panacea"): failures.append("Xiapi Wan baggage dressings button should preview Panacea supply") var before_panacea := int(held_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) held_scene._apply_camp_conversation_effects(dressings) if int(held_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Xiapi Wan baggage dressings should add Panacea to campaign inventory") if int(held_scene.state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Xiapi Wan baggage dressings should refresh battle Panacea inventory") if not held_scene.campaign_state.has_claimed_camp_conversation_effects(XIAPI_SCENARIO_ID, XIAPI_HELD_CONVERSATION_ID): failures.append("Xiapi Wan baggage dressings claim should be saved") if held_scene._format_talk_status_text(held_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Xiapi held Wan gate talk status should show claimed supply after claim") held_scene.free() var swift_scene = _new_prebattle_scene_for( failures, "Xiapi swift Wan escape camp", XIAPI_SCENARIO_ID, XIAPI_SCENARIO_PATH, {"swift_wan_escape": true} ) if swift_scene != null: var rations: Dictionary = swift_scene._camp_conversation_by_id(XIAPI_SWIFT_CONVERSATION_ID) if rations.is_empty(): failures.append("swift Wan escape flag should expose Xiapi forced march rations") if not swift_scene._camp_conversation_by_id(XIAPI_HELD_CONVERSATION_ID).is_empty(): failures.append("swift Wan escape flag should not expose Xiapi Wan baggage dressings") if not rations.is_empty(): if swift_scene._format_talk_status_text(swift_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Xiapi swift Wan escape talk status should show one ready supply") if not swift_scene._format_camp_conversation_button_text(rations).contains("Supply Bean"): failures.append("Xiapi forced march rations button should preview Bean supply") var before_bean := int(swift_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) swift_scene._apply_camp_conversation_effects(rations) if int(swift_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Xiapi forced march rations should add Bean to campaign inventory") if int(swift_scene.state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Xiapi forced march rations should refresh battle Bean inventory") if not swift_scene.campaign_state.has_claimed_camp_conversation_effects(XIAPI_SCENARIO_ID, XIAPI_SWIFT_CONVERSATION_ID): failures.append("Xiapi forced march rations claim should be saved") if swift_scene._format_talk_status_text(swift_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Xiapi swift Wan escape talk status should show claimed supply after claim") swift_scene.free() func _check_white_horse_branch_camp_conversations(failures: Array[String]) -> void: var base_scene = _new_prebattle_scene_for(failures, "White Horse base camp", WHITE_HORSE_SCENARIO_ID, WHITE_HORSE_SCENARIO_PATH) if base_scene != null: if base_scene._camp_conversation_by_id("white_horse_decoy_council").is_empty(): failures.append("White Horse should expose the decoy council conversation") if base_scene._camp_conversation_by_id("white_horse_xiahou_dun_false_retreat").is_empty(): failures.append("White Horse should expose Xiahou Dun's false retreat conversation") if not base_scene._camp_conversation_by_id(WHITE_HORSE_XU_CONVERSATION_ID).is_empty(): failures.append("White Horse Xu reserve medicine should be hidden without integrated Xu flag") if not base_scene._camp_conversation_by_id(WHITE_HORSE_PRESSED_CONVERSATION_ID).is_empty(): failures.append("White Horse fast march beans should be hidden without pressed north flag") var merchant: Dictionary = base_scene.state.get_shop_merchant() if str(merchant.get("name", "")) != "White Horse Road Sutler": failures.append("White Horse shop merchant name should be present") var merchant_lines: Array = merchant.get("lines", []) if merchant_lines.size() < 2: failures.append("White Horse shop merchant should expose flavor lines") if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics": failures.append("White Horse base talk status should summarize two non-supply topics") base_scene.free() var xu_scene = _new_prebattle_scene_for( failures, "White Horse integrated Xu camp", WHITE_HORSE_SCENARIO_ID, WHITE_HORSE_SCENARIO_PATH, {"integrated_xu_province": true} ) if xu_scene != null: var medicine: Dictionary = xu_scene._camp_conversation_by_id(WHITE_HORSE_XU_CONVERSATION_ID) if medicine.is_empty(): failures.append("integrated Xu flag should expose White Horse reserve medicine") if not xu_scene._camp_conversation_by_id(WHITE_HORSE_PRESSED_CONVERSATION_ID).is_empty(): failures.append("integrated Xu flag should not expose White Horse fast march beans") if not medicine.is_empty(): if xu_scene._format_talk_status_text(xu_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("White Horse integrated Xu talk status should show one ready supply") if not xu_scene._format_camp_conversation_button_text(medicine).contains("Supply Panacea"): failures.append("White Horse Xu reserve medicine button should preview Panacea supply") var before_panacea := int(xu_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) xu_scene._apply_camp_conversation_effects(medicine) if int(xu_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("White Horse Xu reserve medicine should add Panacea to campaign inventory") if int(xu_scene.state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("White Horse Xu reserve medicine should refresh battle Panacea inventory") if not xu_scene.campaign_state.has_claimed_camp_conversation_effects(WHITE_HORSE_SCENARIO_ID, WHITE_HORSE_XU_CONVERSATION_ID): failures.append("White Horse Xu reserve medicine claim should be saved") if xu_scene._format_talk_status_text(xu_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("White Horse integrated Xu talk status should show claimed supply after claim") xu_scene.free() var pressed_scene = _new_prebattle_scene_for( failures, "White Horse pressed north camp", WHITE_HORSE_SCENARIO_ID, WHITE_HORSE_SCENARIO_PATH, {"pressed_northern_campaign": true} ) if pressed_scene != null: var beans: Dictionary = pressed_scene._camp_conversation_by_id(WHITE_HORSE_PRESSED_CONVERSATION_ID) if beans.is_empty(): failures.append("pressed north flag should expose White Horse fast march beans") if not pressed_scene._camp_conversation_by_id(WHITE_HORSE_XU_CONVERSATION_ID).is_empty(): failures.append("pressed north flag should not expose White Horse reserve medicine") if not beans.is_empty(): if pressed_scene._format_talk_status_text(pressed_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("White Horse pressed north talk status should show one ready supply") if not pressed_scene._format_camp_conversation_button_text(beans).contains("Supply Bean"): failures.append("White Horse fast march beans button should preview Bean supply") var before_bean := int(pressed_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) pressed_scene._apply_camp_conversation_effects(beans) if int(pressed_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("White Horse fast march beans should add Bean to campaign inventory") if int(pressed_scene.state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("White Horse fast march beans should refresh battle Bean inventory") if not pressed_scene.campaign_state.has_claimed_camp_conversation_effects(WHITE_HORSE_SCENARIO_ID, WHITE_HORSE_PRESSED_CONVERSATION_ID): failures.append("White Horse fast march beans claim should be saved") if pressed_scene._format_talk_status_text(pressed_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("White Horse pressed north talk status should show claimed supply after claim") pressed_scene.free() func _check_yan_ford_branch_camp_conversations(failures: Array[String]) -> void: var base_scene = _new_prebattle_scene_for(failures, "Yan Ford base camp", YAN_FORD_SCENARIO_ID, YAN_FORD_SCENARIO_PATH) if base_scene != null: if base_scene._camp_conversation_by_id("yan_ford_pursuit_council").is_empty(): failures.append("Yan Ford should expose the pursuit council conversation") if base_scene._camp_conversation_by_id("yan_ford_xiahou_yuan_banks").is_empty(): failures.append("Yan Ford should expose Xiahou Yuan's river banks conversation") if not base_scene._camp_conversation_by_id(YAN_FORD_FORTIFIED_CONVERSATION_ID).is_empty(): failures.append("Yan Ford fortified crossing medicine should be hidden without fortified White Horse flag") if not base_scene._camp_conversation_by_id(YAN_FORD_RAIDED_CONVERSATION_ID).is_empty(): failures.append("Yan Ford raided supply beans should be hidden without raided Yuan supplies flag") var merchant: Dictionary = base_scene.state.get_shop_merchant() if str(merchant.get("name", "")) != "Yan Ford Bank Sutler": failures.append("Yan Ford shop merchant name should be present") var merchant_lines: Array = merchant.get("lines", []) if merchant_lines.size() < 2: failures.append("Yan Ford shop merchant should expose flavor lines") if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics": failures.append("Yan Ford base talk status should summarize two non-supply topics") base_scene.free() var fortified_scene = _new_prebattle_scene_for( failures, "Yan Ford fortified White Horse camp", YAN_FORD_SCENARIO_ID, YAN_FORD_SCENARIO_PATH, {"fortified_white_horse": true} ) if fortified_scene != null: var medicine: Dictionary = fortified_scene._camp_conversation_by_id(YAN_FORD_FORTIFIED_CONVERSATION_ID) if medicine.is_empty(): failures.append("fortified White Horse flag should expose Yan Ford crossing medicine") if not fortified_scene._camp_conversation_by_id(YAN_FORD_RAIDED_CONVERSATION_ID).is_empty(): failures.append("fortified White Horse flag should not expose Yan Ford raided supply beans") if not medicine.is_empty(): if fortified_scene._format_talk_status_text(fortified_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Yan Ford fortified talk status should show one ready supply") if not fortified_scene._format_camp_conversation_button_text(medicine).contains("Supply Panacea"): failures.append("Yan Ford crossing medicine button should preview Panacea supply") var before_panacea := int(fortified_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) fortified_scene._apply_camp_conversation_effects(medicine) if int(fortified_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Yan Ford crossing medicine should add Panacea to campaign inventory") if int(fortified_scene.state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Yan Ford crossing medicine should refresh battle Panacea inventory") if not fortified_scene.campaign_state.has_claimed_camp_conversation_effects(YAN_FORD_SCENARIO_ID, YAN_FORD_FORTIFIED_CONVERSATION_ID): failures.append("Yan Ford crossing medicine claim should be saved") if fortified_scene._format_talk_status_text(fortified_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Yan Ford fortified talk status should show claimed supply after claim") fortified_scene.free() var raided_scene = _new_prebattle_scene_for( failures, "Yan Ford raided Yuan supplies camp", YAN_FORD_SCENARIO_ID, YAN_FORD_SCENARIO_PATH, {"raided_yuan_supplies": true} ) if raided_scene != null: var beans: Dictionary = raided_scene._camp_conversation_by_id(YAN_FORD_RAIDED_CONVERSATION_ID) if beans.is_empty(): failures.append("raided Yuan supplies flag should expose Yan Ford raided supply beans") if not raided_scene._camp_conversation_by_id(YAN_FORD_FORTIFIED_CONVERSATION_ID).is_empty(): failures.append("raided Yuan supplies flag should not expose Yan Ford crossing medicine") if not beans.is_empty(): if raided_scene._format_talk_status_text(raided_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Yan Ford raided supplies talk status should show one ready supply") if not raided_scene._format_camp_conversation_button_text(beans).contains("Supply Bean"): failures.append("Yan Ford raided supply beans button should preview Bean supply") var before_bean := int(raided_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) raided_scene._apply_camp_conversation_effects(beans) if int(raided_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Yan Ford raided supply beans should add Bean to campaign inventory") if int(raided_scene.state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Yan Ford raided supply beans should refresh battle Bean inventory") if not raided_scene.campaign_state.has_claimed_camp_conversation_effects(YAN_FORD_SCENARIO_ID, YAN_FORD_RAIDED_CONVERSATION_ID): failures.append("Yan Ford raided supply beans claim should be saved") if raided_scene._format_talk_status_text(raided_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Yan Ford raided supplies talk status should show claimed supply after claim") raided_scene.free() func _check_guandu_branch_camp_conversations(failures: Array[String]) -> void: var base_scene = _new_prebattle_scene_for(failures, "Guandu base camp", GUANDU_SCENARIO_ID, GUANDU_SCENARIO_PATH) if base_scene != null: if base_scene._camp_conversation_by_id("guandu_main_line_council").is_empty(): failures.append("Guandu should expose the main line council conversation") if base_scene._camp_conversation_by_id("guandu_guo_jia_supply_wound").is_empty(): failures.append("Guandu should expose Guo Jia's supply wound conversation") if not base_scene._camp_conversation_by_id(GUANDU_SECURED_CONVERSATION_ID).is_empty(): failures.append("Guandu secured line medicine should be hidden without secured line flag") if not base_scene._camp_conversation_by_id(GUANDU_SCOUTED_CONVERSATION_ID).is_empty(): failures.append("Guandu Wuchao scout wine should be hidden without scouted Wuchao flag") var merchant: Dictionary = base_scene.state.get_shop_merchant() if str(merchant.get("name", "")) != "Guandu Camp Sutler": failures.append("Guandu shop merchant name should be present") var merchant_lines: Array = merchant.get("lines", []) if merchant_lines.size() < 2: failures.append("Guandu shop merchant should expose flavor lines") if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics": failures.append("Guandu base talk status should summarize two non-supply topics") base_scene.free() var secured_scene = _new_prebattle_scene_for( failures, "Guandu secured line camp", GUANDU_SCENARIO_ID, GUANDU_SCENARIO_PATH, {"secured_guandu_line": true} ) if secured_scene != null: var medicine: Dictionary = secured_scene._camp_conversation_by_id(GUANDU_SECURED_CONVERSATION_ID) if medicine.is_empty(): failures.append("secured Guandu line flag should expose Guandu secured line medicine") if not secured_scene._camp_conversation_by_id(GUANDU_SCOUTED_CONVERSATION_ID).is_empty(): failures.append("secured Guandu line flag should not expose Guandu Wuchao scout wine") if not medicine.is_empty(): if secured_scene._format_talk_status_text(secured_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Guandu secured line talk status should show one ready supply") if not secured_scene._format_camp_conversation_button_text(medicine).contains("Supply Panacea"): failures.append("Guandu secured line medicine button should preview Panacea supply") var before_panacea := int(secured_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) secured_scene._apply_camp_conversation_effects(medicine) if int(secured_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Guandu secured line medicine should add Panacea to campaign inventory") if int(secured_scene.state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Guandu secured line medicine should refresh battle Panacea inventory") if not secured_scene.campaign_state.has_claimed_camp_conversation_effects(GUANDU_SCENARIO_ID, GUANDU_SECURED_CONVERSATION_ID): failures.append("Guandu secured line 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("Guandu secured line talk status should show claimed supply after claim") secured_scene.free() var scouted_scene = _new_prebattle_scene_for( failures, "Guandu scouted Wuchao camp", GUANDU_SCENARIO_ID, GUANDU_SCENARIO_PATH, {"scouted_wuchao_depots": true} ) if scouted_scene != null: var wine: Dictionary = scouted_scene._camp_conversation_by_id(GUANDU_SCOUTED_CONVERSATION_ID) if wine.is_empty(): failures.append("scouted Wuchao flag should expose Guandu Wuchao scout wine") if not scouted_scene._camp_conversation_by_id(GUANDU_SECURED_CONVERSATION_ID).is_empty(): failures.append("scouted Wuchao flag should not expose Guandu secured line medicine") if not wine.is_empty(): if scouted_scene._format_talk_status_text(scouted_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Guandu scouted Wuchao talk status should show one ready supply") if not scouted_scene._format_camp_conversation_button_text(wine).contains("Supply Wine"): failures.append("Guandu Wuchao scout wine button should preview Wine supply") var before_wine := int(scouted_scene.campaign_state.get_inventory_snapshot().get("wine", 0)) scouted_scene._apply_camp_conversation_effects(wine) if int(scouted_scene.campaign_state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1: failures.append("Guandu Wuchao scout wine should add Wine to campaign inventory") if int(scouted_scene.state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1: failures.append("Guandu Wuchao scout wine should refresh battle Wine inventory") if not scouted_scene.campaign_state.has_claimed_camp_conversation_effects(GUANDU_SCENARIO_ID, GUANDU_SCOUTED_CONVERSATION_ID): failures.append("Guandu Wuchao scout wine claim should be saved") if scouted_scene._format_talk_status_text(scouted_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Guandu scouted Wuchao talk status should show claimed supply after claim") scouted_scene.free() func _check_guandu_post_battle_choice_bridges_to_wuchao(failures: Array[String]) -> void: _check_guandu_choice_branch_to_wuchao( failures, "prepare_wuchao_raid", "prepared_wuchao_raid", "strengthened_guandu_defense", "wuchao_fast_raid_supplies", "wuchao_guandu_reserve_wagon", "war_drum", "imperial_seal" ) _check_guandu_choice_branch_to_wuchao( failures, "strengthen_guandu_defense", "strengthened_guandu_defense", "prepared_wuchao_raid", "wuchao_guandu_reserve_wagon", "wuchao_fast_raid_supplies", "imperial_seal", "war_drum" ) func _check_guandu_choice_branch_to_wuchao( failures: Array[String], choice_id: String, expected_flag: String, cleared_flag: String, expected_conversation_id: String, hidden_conversation_id: String, expected_shop_item_id: String, hidden_shop_item_id: String ) -> void: var scene = _new_prebattle_scene_for(failures, "Guandu choice bridge %s" % choice_id, GUANDU_SCENARIO_ID, GUANDU_SCENARIO_PATH) if scene == null: 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("Guandu choice bridge %s should save 012 victory" % choice_id) scene.free() return if bool(result.get("choice_applied", true)): failures.append("Guandu choice bridge %s should wait for a selected post-battle choice" % choice_id) if scene.campaign_state.pending_post_battle_choice_scenario_id != GUANDU_SCENARIO_ID: failures.append("Guandu choice bridge %s should mark Guandu choice pending" % choice_id) var choice := _find_choice_by_id(result.get("post_battle_choices", []), choice_id) if choice.is_empty(): failures.append("Guandu choice bridge missing choice: %s" % choice_id) scene.free() return if not scene.campaign_state.try_apply_post_battle_choice(choice, GUANDU_SCENARIO_ID): failures.append("Guandu 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("Guandu choice bridge %s should set %s" % [choice_id, expected_flag]) if flags.get(cleared_flag, true) != false: failures.append("Guandu choice bridge %s should clear %s" % [choice_id, cleared_flag]) if scene.campaign_state.current_scenario_id != WUCHAO_SCENARIO_ID: failures.append("Guandu choice bridge %s should advance to Wuchao, got %s" % [choice_id, scene.campaign_state.current_scenario_id]) if not scene.state.load_battle( WUCHAO_SCENARIO_PATH, scene.campaign_state.get_roster_overrides(), scene.campaign_state.get_inventory_snapshot(), flags, scene.campaign_state.get_joined_officers_snapshot() ): failures.append("Guandu choice bridge %s could not load Wuchao" % choice_id) scene.free() return if scene._camp_conversation_by_id(expected_conversation_id).is_empty(): failures.append("Guandu choice bridge %s should expose %s" % [choice_id, expected_conversation_id]) if not scene._camp_conversation_by_id(hidden_conversation_id).is_empty(): failures.append("Guandu choice bridge %s should hide %s" % [choice_id, hidden_conversation_id]) var shop_items: Array = scene.state.get_shop_item_ids() if not shop_items.has(expected_shop_item_id): failures.append("Guandu choice bridge %s should expose shop item %s" % [choice_id, expected_shop_item_id]) if shop_items.has(hidden_shop_item_id): failures.append("Guandu choice bridge %s should hide shop item %s" % [choice_id, hidden_shop_item_id]) scene.free() func _check_wuchao_post_battle_choice_bridges_to_cangting(failures: Array[String]) -> void: _check_wuchao_choice_branch_to_cangting( failures, "press_yuan_rout", "pressed_yuan_rout", "secured_wuchao_stores", CANGTING_PRESSED_CONVERSATION_ID, CANGTING_STORES_CONVERSATION_ID, "war_drum", "imperial_seal" ) _check_wuchao_choice_branch_to_cangting( failures, "secure_wuchao_stores", "secured_wuchao_stores", "pressed_yuan_rout", CANGTING_STORES_CONVERSATION_ID, CANGTING_PRESSED_CONVERSATION_ID, "imperial_seal", "war_drum" ) func _check_cangting_post_battle_choice_bridges_to_ye(failures: Array[String]) -> void: _check_cangting_choice_branch_to_ye( failures, "advance_to_ye", "advanced_to_ye", "secured_hebei_crossings", YE_RAPID_CONVERSATION_ID, YE_CROSSING_CONVERSATION_ID, "war_drum", "imperial_seal" ) _check_cangting_choice_branch_to_ye( failures, "secure_hebei_crossings", "secured_hebei_crossings", "advanced_to_ye", YE_CROSSING_CONVERSATION_ID, YE_RAPID_CONVERSATION_ID, "imperial_seal", "war_drum" ) func _check_ye_post_battle_choice_bridges_to_ye_siege(failures: Array[String]) -> void: _check_ye_choice_branch_to_ye_siege( failures, "press_ye_siege", "pressed_ye_siege", "split_yuan_heirs", YE_SIEGE_PRESSED_CONVERSATION_ID, YE_SIEGE_SPLIT_CONVERSATION_ID, "war_drum", "imperial_seal" ) _check_ye_choice_branch_to_ye_siege( failures, "split_yuan_heirs", "split_yuan_heirs", "pressed_ye_siege", YE_SIEGE_SPLIT_CONVERSATION_ID, YE_SIEGE_PRESSED_CONVERSATION_ID, "imperial_seal", "war_drum" ) func _check_ye_siege_post_battle_choice_bridges_to_surrender(failures: Array[String]) -> void: _check_ye_siege_choice_branch_to_surrender( failures, "force_ye_surrender", "forced_ye_surrender", "negotiated_yuan_defections", YE_SURRENDER_PRESSURE_CONVERSATION_ID, YE_SURRENDER_DEFECTOR_CONVERSATION_ID, "war_drum", "imperial_seal" ) _check_ye_siege_choice_branch_to_surrender( failures, "negotiate_yuan_defections", "negotiated_yuan_defections", "forced_ye_surrender", YE_SURRENDER_DEFECTOR_CONVERSATION_ID, YE_SURRENDER_PRESSURE_CONVERSATION_ID, "imperial_seal", "war_drum" ) func _check_ye_surrender_post_battle_choice_bridges_to_northern_pursuit(failures: Array[String]) -> void: _check_ye_surrender_choice_branch_to_northern_pursuit( failures, "pursue_yuan_shang", "pursued_yuan_shang", "stabilized_ye", NORTHERN_PURSUIT_HARD_MARCH_CONVERSATION_ID, NORTHERN_PURSUIT_JI_SUPPLY_CONVERSATION_ID, "war_drum", "imperial_seal" ) _check_ye_surrender_choice_branch_to_northern_pursuit( failures, "stabilize_ye", "stabilized_ye", "pursued_yuan_shang", NORTHERN_PURSUIT_JI_SUPPLY_CONVERSATION_ID, NORTHERN_PURSUIT_HARD_MARCH_CONVERSATION_ID, "imperial_seal", "war_drum" ) func _check_northern_pursuit_post_battle_choice_bridges_to_nanpi(failures: Array[String]) -> void: _check_northern_pursuit_choice_branch_to_nanpi( failures, "press_north_to_nanpi", "pressed_north_to_nanpi", "secured_ji_province", "war_drum", "imperial_seal" ) _check_northern_pursuit_choice_branch_to_nanpi( failures, "secure_ji_province", "secured_ji_province", "pressed_north_to_nanpi", "imperial_seal", "war_drum" ) func _check_nanpi_post_battle_choice_bridges_to_surrender(failures: Array[String]) -> void: _check_nanpi_choice_branch_to_surrender( failures, "press_yuan_tan_surrender", "pressed_yuan_tan_surrender", "secured_nanpi_admin", "war_drum", "imperial_seal" ) _check_nanpi_choice_branch_to_surrender( failures, "secure_nanpi_admin", "secured_nanpi_admin", "pressed_yuan_tan_surrender", "imperial_seal", "war_drum" ) func _check_nanpi_surrender_post_battle_choice_bridges_to_bohai(failures: Array[String]) -> void: _check_nanpi_surrender_choice_branch_to_bohai( failures, "pursue_yuan_brothers", "pursued_yuan_brothers", "secured_bohai_commandery", "war_drum", "imperial_seal" ) _check_nanpi_surrender_choice_branch_to_bohai( failures, "secure_bohai_commandery", "secured_bohai_commandery", "pursued_yuan_brothers", "imperial_seal", "war_drum" ) 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_liaoxi_post_battle_choice_bridges_to_white_wolf(failures: Array[String]) -> void: _check_liaoxi_choice_branch_to_white_wolf( failures, "strike_wuhuan_vanguard", "struck_wuhuan_vanguard", "fortified_white_wolf_route", "war_drum", "imperial_seal" ) _check_liaoxi_choice_branch_to_white_wolf( failures, "fortify_white_wolf_route", "fortified_white_wolf_route", "struck_wuhuan_vanguard", "imperial_seal", "war_drum" ) func _check_white_wolf_post_battle_choice_bridges_to_liaodong(failures: Array[String]) -> void: _check_white_wolf_choice_branch_to_liaodong( failures, "press_liaodong_pursuit", "pressed_liaodong_pursuit", "secured_wuhuan_submission", "war_drum", "imperial_seal" ) _check_white_wolf_choice_branch_to_liaodong( failures, "secure_wuhuan_submission", "secured_wuhuan_submission", "pressed_liaodong_pursuit", "imperial_seal", "war_drum" ) func _check_liaodong_post_battle_choice_bridges_to_xinye(failures: Array[String]) -> void: _check_liaodong_choice_branch_to_xinye( failures, "accept_liaodong_terms", "accepted_liaodong_terms", "pressed_liaodong_authority", "imperial_seal", "war_drum" ) _check_liaodong_choice_branch_to_xinye( failures, "press_liaodong_authority", "pressed_liaodong_authority", "accepted_liaodong_terms", "war_drum", "imperial_seal" ) func _check_xinye_post_battle_choice_bridges_to_changban(failures: Array[String]) -> void: _check_xinye_choice_branch_to_changban( failures, "press_xinye_vanguard", "pressed_xinye_vanguard", "secured_han_river_supply", "war_drum", "imperial_seal" ) _check_xinye_choice_branch_to_changban( failures, "secure_han_river_supply", "secured_han_river_supply", "pressed_xinye_vanguard", "imperial_seal", "war_drum" ) func _check_changban_post_battle_choice_bridges_to_jiangling(failures: Array[String]) -> void: _check_changban_choice_branch_to_jiangling( failures, "press_jiangling_chase", "pressed_jiangling_chase", "secured_changban_crossings", "war_drum", "imperial_seal" ) _check_changban_choice_branch_to_jiangling( failures, "secure_changban_crossings", "secured_changban_crossings", "pressed_jiangling_chase", "imperial_seal", "war_drum" ) func _check_jiangling_post_battle_choice_bridges_to_xiakou(failures: Array[String]) -> void: _check_jiangling_choice_branch_to_xiakou( failures, "press_xiakou_pursuit", "pressed_xiakou_pursuit", "secured_jiangling_storehouses", "war_drum", "imperial_seal" ) _check_jiangling_choice_branch_to_xiakou( failures, "secure_jiangling_storehouses", "secured_jiangling_storehouses", "pressed_xiakou_pursuit", "imperial_seal", "war_drum" ) func _check_xiakou_post_battle_choice_bridges_to_red_cliffs(failures: Array[String]) -> void: _check_xiakou_choice_branch_to_red_cliffs( failures, "press_red_cliffs_fleet", "pressed_red_cliffs_fleet", "secured_xiakou_harbor", "war_drum", "imperial_seal" ) _check_xiakou_choice_branch_to_red_cliffs( failures, "secure_xiakou_harbor", "secured_xiakou_harbor", "pressed_red_cliffs_fleet", "imperial_seal", "war_drum" ) func _check_wuchao_choice_branch_to_cangting( failures: Array[String], choice_id: String, expected_flag: String, cleared_flag: String, expected_conversation_id: String, hidden_conversation_id: String, expected_shop_item_id: String, hidden_shop_item_id: String ) -> void: var scene = _new_prebattle_scene_for(failures, "Wuchao choice bridge %s" % choice_id, WUCHAO_SCENARIO_ID, WUCHAO_SCENARIO_PATH) if scene == null: 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("Wuchao choice bridge %s should save 013 victory" % choice_id) scene.free() return if bool(result.get("choice_applied", true)): failures.append("Wuchao choice bridge %s should wait for a selected post-battle choice" % choice_id) if scene.campaign_state.pending_post_battle_choice_scenario_id != WUCHAO_SCENARIO_ID: failures.append("Wuchao choice bridge %s should mark Wuchao choice pending" % choice_id) var choice := _find_choice_by_id(result.get("post_battle_choices", []), choice_id) if choice.is_empty(): failures.append("Wuchao choice bridge missing choice: %s" % choice_id) scene.free() return if not scene.campaign_state.try_apply_post_battle_choice(choice, WUCHAO_SCENARIO_ID): failures.append("Wuchao 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("Wuchao choice bridge %s should set %s" % [choice_id, expected_flag]) if flags.get(cleared_flag, true) != false: failures.append("Wuchao choice bridge %s should clear %s" % [choice_id, cleared_flag]) if scene.campaign_state.current_scenario_id != CANGTING_SCENARIO_ID: failures.append("Wuchao choice bridge %s should advance to Cangting, got %s" % [choice_id, scene.campaign_state.current_scenario_id]) if not scene.state.load_battle( CANGTING_SCENARIO_PATH, scene.campaign_state.get_roster_overrides(), scene.campaign_state.get_inventory_snapshot(), flags, scene.campaign_state.get_joined_officers_snapshot() ): failures.append("Wuchao choice bridge %s could not load Cangting" % choice_id) scene.free() return if scene._camp_conversation_by_id(expected_conversation_id).is_empty(): failures.append("Wuchao choice bridge %s should expose %s" % [choice_id, expected_conversation_id]) if not scene._camp_conversation_by_id(hidden_conversation_id).is_empty(): failures.append("Wuchao choice bridge %s should hide %s" % [choice_id, hidden_conversation_id]) var shop_items: Array = scene.state.get_shop_item_ids() if not shop_items.has(expected_shop_item_id): failures.append("Wuchao choice bridge %s should expose shop item %s" % [choice_id, expected_shop_item_id]) if shop_items.has(hidden_shop_item_id): failures.append("Wuchao choice bridge %s should hide shop item %s" % [choice_id, hidden_shop_item_id]) scene.free() func _check_cangting_choice_branch_to_ye( failures: Array[String], choice_id: String, expected_flag: String, cleared_flag: String, expected_conversation_id: String, hidden_conversation_id: String, expected_shop_item_id: String, hidden_shop_item_id: String ) -> void: var scene = _new_prebattle_scene_for(failures, "Cangting choice bridge %s" % choice_id, CANGTING_SCENARIO_ID, CANGTING_SCENARIO_PATH) if scene == null: 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("Cangting choice bridge %s should save 014 victory" % choice_id) scene.free() return if not scene.campaign_state.get_joined_officers_snapshot().has("zhang_he"): failures.append("Cangting choice bridge %s should add Zhang He before Ye" % choice_id) if bool(result.get("choice_applied", true)): failures.append("Cangting choice bridge %s should wait for a selected post-battle choice" % choice_id) if scene.campaign_state.pending_post_battle_choice_scenario_id != CANGTING_SCENARIO_ID: failures.append("Cangting choice bridge %s should mark Cangting choice pending" % choice_id) var choice := _find_choice_by_id(result.get("post_battle_choices", []), choice_id) if choice.is_empty(): failures.append("Cangting choice bridge missing choice: %s" % choice_id) scene.free() return if not scene.campaign_state.try_apply_post_battle_choice(choice, CANGTING_SCENARIO_ID): failures.append("Cangting 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("Cangting choice bridge %s should set %s" % [choice_id, expected_flag]) if flags.get(cleared_flag, true) != false: failures.append("Cangting choice bridge %s should clear %s" % [choice_id, cleared_flag]) if scene.campaign_state.current_scenario_id != YE_SCENARIO_ID: failures.append("Cangting choice bridge %s should advance to Ye, got %s" % [choice_id, scene.campaign_state.current_scenario_id]) if not scene.state.load_battle( YE_SCENARIO_PATH, scene.campaign_state.get_roster_overrides(), scene.campaign_state.get_inventory_snapshot(), flags, scene.campaign_state.get_joined_officers_snapshot() ): failures.append("Cangting choice bridge %s could not load Ye" % choice_id) scene.free() return if scene.state.get_unit("zhang_he_ch15").is_empty(): failures.append("Cangting choice bridge %s should deploy Zhang He in Ye" % choice_id) elif not scene.state.is_required_deployment("zhang_he_ch15"): failures.append("Cangting choice bridge %s should require Zhang He in Ye" % choice_id) if scene._camp_conversation_by_id(expected_conversation_id).is_empty(): failures.append("Cangting choice bridge %s should expose %s" % [choice_id, expected_conversation_id]) if not scene._camp_conversation_by_id(hidden_conversation_id).is_empty(): failures.append("Cangting choice bridge %s should hide %s" % [choice_id, hidden_conversation_id]) var shop_items: Array = scene.state.get_shop_item_ids() if not shop_items.has(expected_shop_item_id): failures.append("Cangting choice bridge %s should expose shop item %s" % [choice_id, expected_shop_item_id]) if shop_items.has(hidden_shop_item_id): failures.append("Cangting choice bridge %s should hide shop item %s" % [choice_id, hidden_shop_item_id]) scene.free() func _check_ye_choice_branch_to_ye_siege( failures: Array[String], choice_id: String, expected_flag: String, cleared_flag: String, expected_conversation_id: String, hidden_conversation_id: String, expected_shop_item_id: String, hidden_shop_item_id: String ) -> void: var scene = _new_prebattle_scene_for(failures, "Ye choice bridge %s" % choice_id, YE_SCENARIO_ID, YE_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( YE_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("Ye choice bridge %s could not reload Ye 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("Ye choice bridge %s should save 015 victory" % choice_id) scene.free() return if not scene.campaign_state.get_joined_officers_snapshot().has("zhang_he"): failures.append("Ye choice bridge %s should keep Zhang He before Ye Siege" % choice_id) if bool(result.get("choice_applied", true)): failures.append("Ye choice bridge %s should wait for a selected post-battle choice" % choice_id) if scene.campaign_state.pending_post_battle_choice_scenario_id != YE_SCENARIO_ID: failures.append("Ye choice bridge %s should mark Ye choice pending" % choice_id) var choice := _find_choice_by_id(result.get("post_battle_choices", []), choice_id) if choice.is_empty(): failures.append("Ye choice bridge missing choice: %s" % choice_id) scene.free() return if not scene.campaign_state.try_apply_post_battle_choice(choice, YE_SCENARIO_ID): failures.append("Ye 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("Ye choice bridge %s should set %s" % [choice_id, expected_flag]) if flags.get(cleared_flag, true) != false: failures.append("Ye choice bridge %s should clear %s" % [choice_id, cleared_flag]) if scene.campaign_state.current_scenario_id != YE_SIEGE_SCENARIO_ID: failures.append("Ye choice bridge %s should advance to Ye Siege, got %s" % [choice_id, scene.campaign_state.current_scenario_id]) if not scene.state.load_battle( YE_SIEGE_SCENARIO_PATH, scene.campaign_state.get_roster_overrides(), scene.campaign_state.get_inventory_snapshot(), flags, scene.campaign_state.get_joined_officers_snapshot() ): failures.append("Ye choice bridge %s could not load Ye Siege" % choice_id) scene.free() return if scene.state.get_unit("zhang_he_ch16").is_empty(): failures.append("Ye choice bridge %s should deploy Zhang He in Ye Siege" % choice_id) elif not scene.state.is_required_deployment("zhang_he_ch16"): failures.append("Ye choice bridge %s should require Zhang He in Ye Siege" % choice_id) if scene._camp_conversation_by_id(expected_conversation_id).is_empty(): failures.append("Ye choice bridge %s should expose %s" % [choice_id, expected_conversation_id]) if not scene._camp_conversation_by_id(hidden_conversation_id).is_empty(): failures.append("Ye choice bridge %s should hide %s" % [choice_id, hidden_conversation_id]) var shop_items: Array = scene.state.get_shop_item_ids() if not shop_items.has(expected_shop_item_id): failures.append("Ye choice bridge %s should expose shop item %s" % [choice_id, expected_shop_item_id]) if shop_items.has(hidden_shop_item_id): failures.append("Ye choice bridge %s should hide shop item %s" % [choice_id, hidden_shop_item_id]) scene.free() func _check_ye_siege_choice_branch_to_surrender( failures: Array[String], choice_id: String, expected_flag: String, cleared_flag: String, expected_conversation_id: String, hidden_conversation_id: String, expected_shop_item_id: String, hidden_shop_item_id: String ) -> void: var scene = _new_prebattle_scene_for(failures, "Ye Siege choice bridge %s" % choice_id, YE_SIEGE_SCENARIO_ID, YE_SIEGE_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( YE_SIEGE_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("Ye Siege choice bridge %s could not reload Ye Siege 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("Ye Siege choice bridge %s should save 016 victory" % choice_id) scene.free() return if not scene.campaign_state.get_joined_officers_snapshot().has("zhang_he"): failures.append("Ye Siege choice bridge %s should keep Zhang He before Ye surrender" % choice_id) if bool(result.get("choice_applied", true)): failures.append("Ye Siege choice bridge %s should wait for a selected post-battle choice" % choice_id) if scene.campaign_state.pending_post_battle_choice_scenario_id != YE_SIEGE_SCENARIO_ID: failures.append("Ye Siege choice bridge %s should mark Ye Siege choice pending" % choice_id) var choice := _find_choice_by_id(result.get("post_battle_choices", []), choice_id) if choice.is_empty(): failures.append("Ye Siege choice bridge missing choice: %s" % choice_id) scene.free() return if not scene.campaign_state.try_apply_post_battle_choice(choice, YE_SIEGE_SCENARIO_ID): failures.append("Ye Siege 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("Ye Siege choice bridge %s should set %s" % [choice_id, expected_flag]) if flags.get(cleared_flag, true) != false: failures.append("Ye Siege choice bridge %s should clear %s" % [choice_id, cleared_flag]) if scene.campaign_state.current_scenario_id != YE_SURRENDER_SCENARIO_ID: failures.append("Ye Siege choice bridge %s should advance to Ye Surrender, got %s" % [choice_id, scene.campaign_state.current_scenario_id]) if not scene.state.load_battle( YE_SURRENDER_SCENARIO_PATH, scene.campaign_state.get_roster_overrides(), scene.campaign_state.get_inventory_snapshot(), flags, scene.campaign_state.get_joined_officers_snapshot() ): failures.append("Ye Siege choice bridge %s could not load Ye Surrender" % choice_id) scene.free() return if scene.state.get_unit("zhang_he_ch17").is_empty(): failures.append("Ye Siege choice bridge %s should deploy Zhang He in Ye Surrender" % choice_id) elif not scene.state.is_required_deployment("zhang_he_ch17"): failures.append("Ye Siege choice bridge %s should require Zhang He in Ye Surrender" % choice_id) if scene._camp_conversation_by_id(expected_conversation_id).is_empty(): failures.append("Ye Siege choice bridge %s should expose %s" % [choice_id, expected_conversation_id]) if not scene._camp_conversation_by_id(hidden_conversation_id).is_empty(): failures.append("Ye Siege choice bridge %s should hide %s" % [choice_id, hidden_conversation_id]) var shop_items: Array = scene.state.get_shop_item_ids() if not shop_items.has(expected_shop_item_id): failures.append("Ye Siege choice bridge %s should expose shop item %s" % [choice_id, expected_shop_item_id]) if shop_items.has(hidden_shop_item_id): failures.append("Ye Siege choice bridge %s should hide shop item %s" % [choice_id, hidden_shop_item_id]) scene.free() func _check_ye_surrender_choice_branch_to_northern_pursuit( failures: Array[String], choice_id: String, expected_flag: String, cleared_flag: String, expected_conversation_id: String, hidden_conversation_id: String, expected_shop_item_id: String, hidden_shop_item_id: String ) -> void: var scene = _new_prebattle_scene_for(failures, "Ye Surrender choice bridge %s" % choice_id, YE_SURRENDER_SCENARIO_ID, YE_SURRENDER_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( YE_SURRENDER_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("Ye Surrender choice bridge %s could not reload Ye Surrender 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("Ye Surrender choice bridge %s should save 017 victory" % choice_id) scene.free() return if not scene.campaign_state.get_joined_officers_snapshot().has("zhang_he"): failures.append("Ye Surrender choice bridge %s should keep Zhang He before Northern Pursuit" % choice_id) if bool(result.get("choice_applied", true)): failures.append("Ye Surrender choice bridge %s should wait for a selected post-battle choice" % choice_id) if scene.campaign_state.pending_post_battle_choice_scenario_id != YE_SURRENDER_SCENARIO_ID: failures.append("Ye Surrender choice bridge %s should mark Ye Surrender choice pending" % choice_id) var choice := _find_choice_by_id(result.get("post_battle_choices", []), choice_id) if choice.is_empty(): failures.append("Ye Surrender choice bridge missing choice: %s" % choice_id) scene.free() return if not scene.campaign_state.try_apply_post_battle_choice(choice, YE_SURRENDER_SCENARIO_ID): failures.append("Ye Surrender 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("Ye Surrender choice bridge %s should set %s" % [choice_id, expected_flag]) if flags.get(cleared_flag, true) != false: failures.append("Ye Surrender choice bridge %s should clear %s" % [choice_id, cleared_flag]) if scene.campaign_state.current_scenario_id != NORTHERN_PURSUIT_SCENARIO_ID: failures.append("Ye Surrender choice bridge %s should advance to Northern Pursuit, got %s" % [choice_id, scene.campaign_state.current_scenario_id]) if not scene.state.load_battle( NORTHERN_PURSUIT_SCENARIO_PATH, scene.campaign_state.get_roster_overrides(), scene.campaign_state.get_inventory_snapshot(), flags, scene.campaign_state.get_joined_officers_snapshot() ): failures.append("Ye Surrender choice bridge %s could not load Northern Pursuit" % choice_id) scene.free() return if scene.state.get_unit("zhang_he_ch18").is_empty(): failures.append("Ye Surrender choice bridge %s should deploy Zhang He in Northern Pursuit" % choice_id) elif not scene.state.is_required_deployment("zhang_he_ch18"): failures.append("Ye Surrender choice bridge %s should require Zhang He in Northern Pursuit" % choice_id) if scene._camp_conversation_by_id(expected_conversation_id).is_empty(): failures.append("Ye Surrender choice bridge %s should expose %s" % [choice_id, expected_conversation_id]) if not scene._camp_conversation_by_id(hidden_conversation_id).is_empty(): failures.append("Ye Surrender choice bridge %s should hide %s" % [choice_id, hidden_conversation_id]) var shop_items: Array = scene.state.get_shop_item_ids() if not shop_items.has(expected_shop_item_id): failures.append("Ye Surrender choice bridge %s should expose shop item %s" % [choice_id, expected_shop_item_id]) if shop_items.has(hidden_shop_item_id): failures.append("Ye Surrender choice bridge %s should hide shop item %s" % [choice_id, hidden_shop_item_id]) scene.free() func _check_northern_pursuit_choice_branch_to_nanpi( 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, "Northern Pursuit choice bridge %s" % choice_id, NORTHERN_PURSUIT_SCENARIO_ID, NORTHERN_PURSUIT_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( NORTHERN_PURSUIT_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("Northern Pursuit choice bridge %s could not reload Northern Pursuit 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("Northern Pursuit choice bridge %s should save 018 victory" % choice_id) scene.free() return if not scene.campaign_state.get_joined_officers_snapshot().has("zhang_he"): failures.append("Northern Pursuit choice bridge %s should keep Zhang He before Nanpi" % choice_id) if bool(result.get("choice_applied", true)): failures.append("Northern Pursuit choice bridge %s should wait for a selected post-battle choice" % choice_id) if scene.campaign_state.pending_post_battle_choice_scenario_id != NORTHERN_PURSUIT_SCENARIO_ID: failures.append("Northern Pursuit choice bridge %s should mark Northern Pursuit choice pending" % choice_id) var choice := _find_choice_by_id(result.get("post_battle_choices", []), choice_id) if choice.is_empty(): failures.append("Northern Pursuit choice bridge missing choice: %s" % choice_id) scene.free() return if not scene.campaign_state.try_apply_post_battle_choice(choice, NORTHERN_PURSUIT_SCENARIO_ID): failures.append("Northern Pursuit 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("Northern Pursuit choice bridge %s should set %s" % [choice_id, expected_flag]) if flags.get(cleared_flag, true) != false: failures.append("Northern Pursuit choice bridge %s should clear %s" % [choice_id, cleared_flag]) if scene.campaign_state.current_scenario_id != NANPI_SCENARIO_ID: failures.append("Northern Pursuit choice bridge %s should advance to Nanpi, got %s" % [choice_id, scene.campaign_state.current_scenario_id]) if not scene.state.load_battle( NANPI_SCENARIO_PATH, scene.campaign_state.get_roster_overrides(), scene.campaign_state.get_inventory_snapshot(), flags, scene.campaign_state.get_joined_officers_snapshot() ): failures.append("Northern Pursuit choice bridge %s could not load Nanpi" % choice_id) scene.free() return if scene.state.get_unit("zhang_he_ch19").is_empty(): failures.append("Northern Pursuit choice bridge %s should deploy Zhang He in Nanpi" % choice_id) elif not scene.state.is_required_deployment("zhang_he_ch19"): failures.append("Northern Pursuit choice bridge %s should require Zhang He in Nanpi" % choice_id) var shop_items: Array = scene.state.get_shop_item_ids() if not shop_items.has(expected_shop_item_id): failures.append("Northern Pursuit choice bridge %s should expose shop item %s" % [choice_id, expected_shop_item_id]) if shop_items.has(hidden_shop_item_id): failures.append("Northern Pursuit choice bridge %s should hide shop item %s" % [choice_id, hidden_shop_item_id]) scene.free() func _check_nanpi_choice_branch_to_surrender( 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, "Nanpi choice bridge %s" % choice_id, NANPI_SCENARIO_ID, NANPI_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( NANPI_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("Nanpi choice bridge %s could not reload Nanpi 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("Nanpi choice bridge %s should save 019 victory" % choice_id) scene.free() return if not scene.campaign_state.get_joined_officers_snapshot().has("zhang_he"): failures.append("Nanpi choice bridge %s should keep Zhang He before Nanpi Surrender" % choice_id) if bool(result.get("choice_applied", true)): failures.append("Nanpi choice bridge %s should wait for a selected post-battle choice" % choice_id) if scene.campaign_state.pending_post_battle_choice_scenario_id != NANPI_SCENARIO_ID: failures.append("Nanpi choice bridge %s should mark Nanpi choice pending" % choice_id) var choice := _find_choice_by_id(result.get("post_battle_choices", []), choice_id) if choice.is_empty(): failures.append("Nanpi choice bridge missing choice: %s" % choice_id) scene.free() return if not scene.campaign_state.try_apply_post_battle_choice(choice, NANPI_SCENARIO_ID): failures.append("Nanpi 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("Nanpi choice bridge %s should set %s" % [choice_id, expected_flag]) if flags.get(cleared_flag, true) != false: failures.append("Nanpi choice bridge %s should clear %s" % [choice_id, cleared_flag]) if scene.campaign_state.current_scenario_id != NANPI_SURRENDER_SCENARIO_ID: failures.append("Nanpi choice bridge %s should advance to Nanpi Surrender, got %s" % [choice_id, scene.campaign_state.current_scenario_id]) if not scene.state.load_battle( NANPI_SURRENDER_SCENARIO_PATH, scene.campaign_state.get_roster_overrides(), scene.campaign_state.get_inventory_snapshot(), flags, scene.campaign_state.get_joined_officers_snapshot() ): failures.append("Nanpi choice bridge %s could not load Nanpi Surrender" % choice_id) scene.free() return if scene.state.get_unit("zhang_he_ch20").is_empty(): failures.append("Nanpi choice bridge %s should deploy Zhang He in Nanpi Surrender" % choice_id) elif not scene.state.is_required_deployment("zhang_he_ch20"): failures.append("Nanpi choice bridge %s should require Zhang He in Nanpi Surrender" % choice_id) var shop_items: Array = scene.state.get_shop_item_ids() if not shop_items.has(expected_shop_item_id): failures.append("Nanpi choice bridge %s should expose shop item %s" % [choice_id, expected_shop_item_id]) if shop_items.has(hidden_shop_item_id): failures.append("Nanpi choice bridge %s should hide shop item %s" % [choice_id, hidden_shop_item_id]) scene.free() func _check_nanpi_surrender_choice_branch_to_bohai( 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, "Nanpi Surrender choice bridge %s" % choice_id, NANPI_SURRENDER_SCENARIO_ID, NANPI_SURRENDER_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( NANPI_SURRENDER_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("Nanpi Surrender choice bridge %s could not reload Nanpi Surrender 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("Nanpi Surrender choice bridge %s should save 020 victory" % choice_id) scene.free() return if not scene.campaign_state.get_joined_officers_snapshot().has("zhang_he"): failures.append("Nanpi Surrender choice bridge %s should keep Zhang He before Bohai" % choice_id) if bool(result.get("choice_applied", true)): failures.append("Nanpi Surrender choice bridge %s should wait for a selected post-battle choice" % choice_id) if scene.campaign_state.pending_post_battle_choice_scenario_id != NANPI_SURRENDER_SCENARIO_ID: failures.append("Nanpi Surrender choice bridge %s should mark Nanpi Surrender choice pending" % choice_id) var choice := _find_choice_by_id(result.get("post_battle_choices", []), choice_id) if choice.is_empty(): failures.append("Nanpi Surrender choice bridge missing choice: %s" % choice_id) scene.free() return if not scene.campaign_state.try_apply_post_battle_choice(choice, NANPI_SURRENDER_SCENARIO_ID): failures.append("Nanpi Surrender 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("Nanpi Surrender choice bridge %s should set %s" % [choice_id, expected_flag]) if flags.get(cleared_flag, true) != false: failures.append("Nanpi Surrender choice bridge %s should clear %s" % [choice_id, cleared_flag]) if scene.campaign_state.current_scenario_id != BOHAI_SCENARIO_ID: failures.append("Nanpi Surrender choice bridge %s should advance to Bohai, got %s" % [choice_id, scene.campaign_state.current_scenario_id]) if not scene.state.load_battle( BOHAI_SCENARIO_PATH, scene.campaign_state.get_roster_overrides(), scene.campaign_state.get_inventory_snapshot(), flags, scene.campaign_state.get_joined_officers_snapshot() ): failures.append("Nanpi Surrender choice bridge %s could not load Bohai" % choice_id) scene.free() return if scene.state.get_unit("zhang_he_ch21").is_empty(): failures.append("Nanpi Surrender choice bridge %s should deploy Zhang He in Bohai" % choice_id) elif not scene.state.is_required_deployment("zhang_he_ch21"): failures.append("Nanpi Surrender choice bridge %s should require Zhang He in Bohai" % choice_id) var shop_items: Array = scene.state.get_shop_item_ids() if not shop_items.has(expected_shop_item_id): failures.append("Nanpi Surrender choice bridge %s should expose shop item %s" % [choice_id, expected_shop_item_id]) if shop_items.has(hidden_shop_item_id): failures.append("Nanpi Surrender choice bridge %s should hide shop item %s" % [choice_id, hidden_shop_item_id]) 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 _check_liaoxi_choice_branch_to_white_wolf( 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, "Liaoxi choice bridge %s" % choice_id, LIAOXI_SCENARIO_ID, LIAOXI_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( LIAOXI_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("Liaoxi choice bridge %s could not reload Liaoxi 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("Liaoxi choice bridge %s should save 022 victory" % choice_id) scene.free() return if not scene.campaign_state.get_joined_officers_snapshot().has("zhang_he"): failures.append("Liaoxi choice bridge %s should keep Zhang He before White Wolf" % choice_id) if bool(result.get("choice_applied", true)): failures.append("Liaoxi choice bridge %s should wait for a selected post-battle choice" % choice_id) if scene.campaign_state.pending_post_battle_choice_scenario_id != LIAOXI_SCENARIO_ID: failures.append("Liaoxi choice bridge %s should mark Liaoxi choice pending" % choice_id) var choice := _find_choice_by_id(result.get("post_battle_choices", []), choice_id) if choice.is_empty(): failures.append("Liaoxi choice bridge missing choice: %s" % choice_id) scene.free() return if not scene.campaign_state.try_apply_post_battle_choice(choice, LIAOXI_SCENARIO_ID): failures.append("Liaoxi 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("Liaoxi choice bridge %s should set %s" % [choice_id, expected_flag]) if flags.get(cleared_flag, true) != false: failures.append("Liaoxi choice bridge %s should clear %s" % [choice_id, cleared_flag]) if scene.campaign_state.current_scenario_id != WHITE_WOLF_SCENARIO_ID: failures.append("Liaoxi choice bridge %s should advance to White Wolf, got %s" % [choice_id, scene.campaign_state.current_scenario_id]) if not scene.state.load_battle( WHITE_WOLF_SCENARIO_PATH, scene.campaign_state.get_roster_overrides(), scene.campaign_state.get_inventory_snapshot(), flags, scene.campaign_state.get_joined_officers_snapshot() ): failures.append("Liaoxi choice bridge %s could not load White Wolf" % choice_id) scene.free() return if scene.state.get_unit("zhang_he_ch23").is_empty(): failures.append("Liaoxi choice bridge %s should deploy Zhang He in White Wolf" % choice_id) elif not scene.state.is_required_deployment("zhang_he_ch23"): failures.append("Liaoxi choice bridge %s should require Zhang He in White Wolf" % choice_id) var shop_items: Array = scene.state.get_shop_item_ids() if not shop_items.has(expected_shop_item_id): failures.append("Liaoxi choice bridge %s should expose shop item %s" % [choice_id, expected_shop_item_id]) if shop_items.has(hidden_shop_item_id): failures.append("Liaoxi choice bridge %s should hide shop item %s" % [choice_id, hidden_shop_item_id]) scene.free() func _check_white_wolf_choice_branch_to_liaodong( 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, "White Wolf choice bridge %s" % choice_id, WHITE_WOLF_SCENARIO_ID, WHITE_WOLF_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( WHITE_WOLF_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("White Wolf choice bridge %s could not reload White Wolf 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("White Wolf choice bridge %s should save 023 victory" % choice_id) scene.free() return if not scene.campaign_state.get_joined_officers_snapshot().has("zhang_he"): failures.append("White Wolf choice bridge %s should keep Zhang He before Liaodong" % choice_id) if bool(result.get("choice_applied", true)): failures.append("White Wolf choice bridge %s should wait for a selected post-battle choice" % choice_id) if scene.campaign_state.pending_post_battle_choice_scenario_id != WHITE_WOLF_SCENARIO_ID: failures.append("White Wolf choice bridge %s should mark White Wolf choice pending" % choice_id) var choice := _find_choice_by_id(result.get("post_battle_choices", []), choice_id) if choice.is_empty(): failures.append("White Wolf choice bridge missing choice: %s" % choice_id) scene.free() return if not scene.campaign_state.try_apply_post_battle_choice(choice, WHITE_WOLF_SCENARIO_ID): failures.append("White Wolf 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("White Wolf choice bridge %s should set %s" % [choice_id, expected_flag]) if flags.get(cleared_flag, true) != false: failures.append("White Wolf choice bridge %s should clear %s" % [choice_id, cleared_flag]) if scene.campaign_state.current_scenario_id != LIAODONG_SCENARIO_ID: failures.append("White Wolf choice bridge %s should advance to Liaodong, got %s" % [choice_id, scene.campaign_state.current_scenario_id]) if not scene.state.load_battle( LIAODONG_SCENARIO_PATH, scene.campaign_state.get_roster_overrides(), scene.campaign_state.get_inventory_snapshot(), flags, scene.campaign_state.get_joined_officers_snapshot() ): failures.append("White Wolf choice bridge %s could not load Liaodong" % choice_id) scene.free() return if scene.state.get_unit("zhang_he_ch24").is_empty(): failures.append("White Wolf choice bridge %s should deploy Zhang He in Liaodong" % choice_id) elif not scene.state.is_required_deployment("zhang_he_ch24"): failures.append("White Wolf choice bridge %s should require Zhang He in Liaodong" % choice_id) var shop_items: Array = scene.state.get_shop_item_ids() if not shop_items.has(expected_shop_item_id): failures.append("White Wolf choice bridge %s should expose shop item %s" % [choice_id, expected_shop_item_id]) if shop_items.has(hidden_shop_item_id): failures.append("White Wolf choice bridge %s should hide shop item %s" % [choice_id, hidden_shop_item_id]) scene.free() func _check_liaodong_choice_branch_to_xinye( 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, "Liaodong choice bridge %s" % choice_id, LIAODONG_SCENARIO_ID, LIAODONG_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( LIAODONG_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("Liaodong choice bridge %s could not reload Liaodong 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("Liaodong choice bridge %s should save 024 victory" % choice_id) scene.free() return if not scene.campaign_state.get_joined_officers_snapshot().has("zhang_he"): failures.append("Liaodong choice bridge %s should keep Zhang He before Xinye" % choice_id) if bool(result.get("choice_applied", true)): failures.append("Liaodong choice bridge %s should wait for a selected post-battle choice" % choice_id) if scene.campaign_state.pending_post_battle_choice_scenario_id != LIAODONG_SCENARIO_ID: failures.append("Liaodong choice bridge %s should mark Liaodong choice pending" % choice_id) var choice := _find_choice_by_id(result.get("post_battle_choices", []), choice_id) if choice.is_empty(): failures.append("Liaodong choice bridge missing choice: %s" % choice_id) scene.free() return if not scene.campaign_state.try_apply_post_battle_choice(choice, LIAODONG_SCENARIO_ID): failures.append("Liaodong 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("Liaodong choice bridge %s should set %s" % [choice_id, expected_flag]) if flags.get(cleared_flag, true) != false: failures.append("Liaodong choice bridge %s should clear %s" % [choice_id, cleared_flag]) if scene.campaign_state.current_scenario_id != XINYE_SCENARIO_ID: failures.append("Liaodong choice bridge %s should advance to Xinye, got %s" % [choice_id, scene.campaign_state.current_scenario_id]) if not scene.state.load_battle( XINYE_SCENARIO_PATH, scene.campaign_state.get_roster_overrides(), scene.campaign_state.get_inventory_snapshot(), flags, scene.campaign_state.get_joined_officers_snapshot() ): failures.append("Liaodong choice bridge %s could not load Xinye" % choice_id) scene.free() return if scene.state.get_unit("zhang_he_ch25").is_empty(): failures.append("Liaodong choice bridge %s should deploy Zhang He in Xinye" % choice_id) elif not scene.state.is_required_deployment("zhang_he_ch25"): failures.append("Liaodong choice bridge %s should require Zhang He in Xinye" % choice_id) var shop_items: Array = scene.state.get_shop_item_ids() if not shop_items.has(expected_shop_item_id): failures.append("Liaodong choice bridge %s should expose shop item %s" % [choice_id, expected_shop_item_id]) if shop_items.has(hidden_shop_item_id): failures.append("Liaodong choice bridge %s should hide shop item %s" % [choice_id, hidden_shop_item_id]) scene.free() func _check_xinye_choice_branch_to_changban( 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, "Xinye choice bridge %s" % choice_id, XINYE_SCENARIO_ID, XINYE_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( XINYE_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("Xinye choice bridge %s could not reload Xinye 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("Xinye choice bridge %s should save 025 victory" % choice_id) scene.free() return if not scene.campaign_state.get_joined_officers_snapshot().has("zhang_he"): failures.append("Xinye choice bridge %s should keep Zhang He before Changban" % choice_id) if bool(result.get("choice_applied", true)): failures.append("Xinye choice bridge %s should wait for a selected post-battle choice" % choice_id) if scene.campaign_state.pending_post_battle_choice_scenario_id != XINYE_SCENARIO_ID: failures.append("Xinye choice bridge %s should mark Xinye choice pending" % choice_id) var choice := _find_choice_by_id(result.get("post_battle_choices", []), choice_id) if choice.is_empty(): failures.append("Xinye choice bridge missing choice: %s" % choice_id) scene.free() return if not scene.campaign_state.try_apply_post_battle_choice(choice, XINYE_SCENARIO_ID): failures.append("Xinye 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("Xinye choice bridge %s should set %s" % [choice_id, expected_flag]) if flags.get(cleared_flag, true) != false: failures.append("Xinye choice bridge %s should clear %s" % [choice_id, cleared_flag]) if scene.campaign_state.current_scenario_id != CHANGBAN_SCENARIO_ID: failures.append("Xinye choice bridge %s should advance to Changban, got %s" % [choice_id, scene.campaign_state.current_scenario_id]) if not scene.state.load_battle( CHANGBAN_SCENARIO_PATH, scene.campaign_state.get_roster_overrides(), scene.campaign_state.get_inventory_snapshot(), flags, scene.campaign_state.get_joined_officers_snapshot() ): failures.append("Xinye choice bridge %s could not load Changban" % choice_id) scene.free() return if scene.state.get_unit("zhang_he_ch26").is_empty(): failures.append("Xinye choice bridge %s should deploy Zhang He in Changban" % choice_id) elif not scene.state.is_required_deployment("zhang_he_ch26"): failures.append("Xinye choice bridge %s should require Zhang He in Changban" % choice_id) var shop_items: Array = scene.state.get_shop_item_ids() if not shop_items.has(expected_shop_item_id): failures.append("Xinye choice bridge %s should expose shop item %s" % [choice_id, expected_shop_item_id]) if shop_items.has(hidden_shop_item_id): failures.append("Xinye choice bridge %s should hide shop item %s" % [choice_id, hidden_shop_item_id]) scene.free() func _check_changban_choice_branch_to_jiangling( 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, "Changban choice bridge %s" % choice_id, CHANGBAN_SCENARIO_ID, CHANGBAN_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( CHANGBAN_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("Changban choice bridge %s could not reload Changban 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("Changban choice bridge %s should save 026 victory" % choice_id) scene.free() return if not scene.campaign_state.get_joined_officers_snapshot().has("zhang_he"): failures.append("Changban choice bridge %s should keep Zhang He before Jiangling" % choice_id) if bool(result.get("choice_applied", true)): failures.append("Changban choice bridge %s should wait for a selected post-battle choice" % choice_id) if scene.campaign_state.pending_post_battle_choice_scenario_id != CHANGBAN_SCENARIO_ID: failures.append("Changban choice bridge %s should mark Changban choice pending" % choice_id) var choice := _find_choice_by_id(result.get("post_battle_choices", []), choice_id) if choice.is_empty(): failures.append("Changban choice bridge missing choice: %s" % choice_id) scene.free() return if not scene.campaign_state.try_apply_post_battle_choice(choice, CHANGBAN_SCENARIO_ID): failures.append("Changban 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("Changban choice bridge %s should set %s" % [choice_id, expected_flag]) if flags.get(cleared_flag, true) != false: failures.append("Changban choice bridge %s should clear %s" % [choice_id, cleared_flag]) if scene.campaign_state.current_scenario_id != JIANGLING_SCENARIO_ID: failures.append("Changban choice bridge %s should advance to Jiangling, got %s" % [choice_id, scene.campaign_state.current_scenario_id]) if not scene.state.load_battle( JIANGLING_SCENARIO_PATH, scene.campaign_state.get_roster_overrides(), scene.campaign_state.get_inventory_snapshot(), flags, scene.campaign_state.get_joined_officers_snapshot() ): failures.append("Changban choice bridge %s could not load Jiangling" % choice_id) scene.free() return if scene.state.get_unit("zhang_he_ch27").is_empty(): failures.append("Changban choice bridge %s should deploy Zhang He in Jiangling" % choice_id) elif not scene.state.is_required_deployment("zhang_he_ch27"): failures.append("Changban choice bridge %s should require Zhang He in Jiangling" % choice_id) var shop_items: Array = scene.state.get_shop_item_ids() if not shop_items.has(expected_shop_item_id): failures.append("Changban choice bridge %s should expose shop item %s" % [choice_id, expected_shop_item_id]) if shop_items.has(hidden_shop_item_id): failures.append("Changban choice bridge %s should hide shop item %s" % [choice_id, hidden_shop_item_id]) scene.free() func _check_jiangling_choice_branch_to_xiakou( 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, "Jiangling choice bridge %s" % choice_id, JIANGLING_SCENARIO_ID, JIANGLING_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( JIANGLING_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("Jiangling choice bridge %s could not reload Jiangling 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("Jiangling choice bridge %s should save 027 victory" % choice_id) scene.free() return if not scene.campaign_state.get_joined_officers_snapshot().has("zhang_he"): failures.append("Jiangling choice bridge %s should keep Zhang He before Xiakou" % choice_id) if bool(result.get("choice_applied", true)): failures.append("Jiangling choice bridge %s should wait for a selected post-battle choice" % choice_id) if scene.campaign_state.pending_post_battle_choice_scenario_id != JIANGLING_SCENARIO_ID: failures.append("Jiangling choice bridge %s should mark Jiangling choice pending" % choice_id) var choice := _find_choice_by_id(result.get("post_battle_choices", []), choice_id) if choice.is_empty(): failures.append("Jiangling choice bridge missing choice: %s" % choice_id) scene.free() return if not scene.campaign_state.try_apply_post_battle_choice(choice, JIANGLING_SCENARIO_ID): failures.append("Jiangling 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("Jiangling choice bridge %s should set %s" % [choice_id, expected_flag]) if flags.get(cleared_flag, true) != false: failures.append("Jiangling choice bridge %s should clear %s" % [choice_id, cleared_flag]) if scene.campaign_state.current_scenario_id != XIAKOU_SCENARIO_ID: failures.append("Jiangling choice bridge %s should advance to Xiakou, got %s" % [choice_id, scene.campaign_state.current_scenario_id]) if not scene.state.load_battle( XIAKOU_SCENARIO_PATH, scene.campaign_state.get_roster_overrides(), scene.campaign_state.get_inventory_snapshot(), flags, scene.campaign_state.get_joined_officers_snapshot() ): failures.append("Jiangling choice bridge %s could not load Xiakou" % choice_id) scene.free() return if scene.state.get_unit("zhang_he_ch28").is_empty(): failures.append("Jiangling choice bridge %s should deploy Zhang He in Xiakou" % choice_id) elif not scene.state.is_required_deployment("zhang_he_ch28"): failures.append("Jiangling choice bridge %s should require Zhang He in Xiakou" % choice_id) var shop_items: Array = scene.state.get_shop_item_ids() if not shop_items.has(expected_shop_item_id): failures.append("Jiangling choice bridge %s should expose shop item %s" % [choice_id, expected_shop_item_id]) if shop_items.has(hidden_shop_item_id): failures.append("Jiangling choice bridge %s should hide shop item %s" % [choice_id, hidden_shop_item_id]) scene.free() func _check_xiakou_choice_branch_to_red_cliffs( 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, "Xiakou choice bridge %s" % choice_id, XIAKOU_SCENARIO_ID, XIAKOU_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( XIAKOU_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("Xiakou choice bridge %s could not reload Xiakou 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("Xiakou choice bridge %s should save 028 victory" % choice_id) scene.free() return if not scene.campaign_state.get_joined_officers_snapshot().has("zhang_he"): failures.append("Xiakou choice bridge %s should keep Zhang He before Red Cliffs" % choice_id) if bool(result.get("choice_applied", true)): failures.append("Xiakou choice bridge %s should wait for a selected post-battle choice" % choice_id) if scene.campaign_state.pending_post_battle_choice_scenario_id != XIAKOU_SCENARIO_ID: failures.append("Xiakou choice bridge %s should mark Xiakou choice pending" % choice_id) var choice := _find_choice_by_id(result.get("post_battle_choices", []), choice_id) if choice.is_empty(): failures.append("Xiakou choice bridge missing choice: %s" % choice_id) scene.free() return if not scene.campaign_state.try_apply_post_battle_choice(choice, XIAKOU_SCENARIO_ID): failures.append("Xiakou 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("Xiakou choice bridge %s should set %s" % [choice_id, expected_flag]) if flags.get(cleared_flag, true) != false: failures.append("Xiakou choice bridge %s should clear %s" % [choice_id, cleared_flag]) if scene.campaign_state.current_scenario_id != RED_CLIFFS_SCENARIO_ID: failures.append("Xiakou choice bridge %s should advance to Red Cliffs, got %s" % [choice_id, scene.campaign_state.current_scenario_id]) if not scene.state.load_battle( RED_CLIFFS_SCENARIO_PATH, scene.campaign_state.get_roster_overrides(), scene.campaign_state.get_inventory_snapshot(), flags, scene.campaign_state.get_joined_officers_snapshot() ): failures.append("Xiakou choice bridge %s could not load Red Cliffs" % choice_id) scene.free() return if scene.state.get_unit("zhang_he_ch29").is_empty(): failures.append("Xiakou choice bridge %s should deploy Zhang He in Red Cliffs" % choice_id) elif not scene.state.is_required_deployment("zhang_he_ch29"): failures.append("Xiakou choice bridge %s should require Zhang He in Red Cliffs" % choice_id) var shop_items: Array = scene.state.get_shop_item_ids() if not shop_items.has(expected_shop_item_id): failures.append("Xiakou choice bridge %s should expose shop item %s" % [choice_id, expected_shop_item_id]) if shop_items.has(hidden_shop_item_id): failures.append("Xiakou 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 {} for choice in choices: if typeof(choice) == TYPE_DICTIONARY and str(choice.get("id", "")) == choice_id: return choice return {} func _check_manual_checkpoint_reverts_claim(failures: Array[String]) -> void: var scene = _new_prebattle_scene(failures, "manual checkpoint") if scene == null: return if not scene.campaign_state.save_manual_game(): failures.append("manual checkpoint before camp claim should save") scene.free() return var conversation: Dictionary = scene._camp_conversation_by_id(CONVERSATION_ID) scene._apply_camp_conversation_effects(conversation) if int(scene.campaign_state.get_inventory_snapshot().get("bean", 0)) != 1: failures.append("camp claim should add Bean before manual restore") if not scene.campaign_state.load_manual_game(): failures.append("manual checkpoint should load after camp claim") else: if int(scene.campaign_state.get_inventory_snapshot().get("bean", 0)) != 0: failures.append("loading older manual checkpoint should revert camp reward inventory") if scene.campaign_state.has_claimed_camp_conversation_effects(SCENARIO_ID, CONVERSATION_ID): failures.append("loading older manual checkpoint should revert camp claim ledger") scene.free() func _check_completed_replay_cannot_claim(failures: Array[String]) -> void: var scene = _new_prebattle_scene(failures, "completed replay") if scene == null: return scene.campaign_state.completed_scenarios.append(SCENARIO_ID) var conversation: Dictionary = scene._camp_conversation_by_id(CONVERSATION_ID) scene._apply_camp_conversation_effects(conversation) if int(scene.campaign_state.get_inventory_snapshot().get("bean", 0)) != 0: failures.append("completed replay should not claim camp supplies") if scene.campaign_state.has_claimed_camp_conversation_effects(SCENARIO_ID, CONVERSATION_ID): failures.append("completed replay should not write camp claim ledger") scene.free() func _check_conditional_camp_conversations(failures: Array[String]) -> void: var no_flags_scene = _new_prebattle_scene_for(failures, "conditional camp no flags", BRANCH_SCENARIO_ID, BRANCH_SCENARIO_PATH) if no_flags_scene != null: if no_flags_scene._camp_conversation_by_id("xingyang_war_council").is_empty(): failures.append("Xingyang should expose ungated war council conversation") if not no_flags_scene._camp_conversation_by_id("xingyang_forced_march").is_empty(): failures.append("pursuit camp conversation should be hidden without pursuit flag") if not no_flags_scene._camp_conversation_by_id("xingyang_scout_screen").is_empty(): failures.append("regroup camp conversation should be hidden without regroup flag") no_flags_scene.free() var pursuit_scene = _new_prebattle_scene_for( failures, "conditional camp pursuit", BRANCH_SCENARIO_ID, BRANCH_SCENARIO_PATH, {"pursued_dong_zhuo": true} ) if pursuit_scene != null: if pursuit_scene._camp_conversation_by_id("xingyang_forced_march").is_empty(): failures.append("pursuit flag should expose forced march conversation") if pursuit_scene._camp_conversation_by_id("xingyang_hasty_stores").is_empty(): failures.append("pursuit flag should expose hasty stores conversation") if not pursuit_scene._camp_conversation_by_id("xingyang_scout_screen").is_empty(): failures.append("pursuit flag should not expose regroup scout conversation") var hasty_stores: Dictionary = pursuit_scene._camp_conversation_by_id("xingyang_hasty_stores") var before_wine := int(pursuit_scene.campaign_state.get_inventory_snapshot().get("wine", 0)) pursuit_scene._apply_camp_conversation_effects(hasty_stores) if int(pursuit_scene.campaign_state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1: failures.append("pursuit hasty stores should add Wine to campaign inventory") if int(pursuit_scene.state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1: failures.append("pursuit hasty stores should refresh battle Wine inventory") pursuit_scene.free() var regroup_scene = _new_prebattle_scene_for( failures, "conditional camp regroup", BRANCH_SCENARIO_ID, BRANCH_SCENARIO_PATH, {"regrouped_after_sishui": true} ) if regroup_scene != null: if regroup_scene._camp_conversation_by_id("xingyang_scout_screen").is_empty(): failures.append("regroup flag should expose scout screen conversation") if regroup_scene._camp_conversation_by_id("xingyang_sishui_supply_train").is_empty(): failures.append("regroup flag should expose Sishui supply train conversation") if not regroup_scene._camp_conversation_by_id("xingyang_forced_march").is_empty(): failures.append("regroup flag should not expose pursuit forced march conversation") var supply_train: Dictionary = regroup_scene._camp_conversation_by_id("xingyang_sishui_supply_train") var before_panacea := int(regroup_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) regroup_scene._apply_camp_conversation_effects(supply_train) if int(regroup_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("regroup Sishui supply train should add Panacea to campaign inventory") if int(regroup_scene.state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("regroup Sishui supply train should refresh battle Panacea inventory") regroup_scene.free() func _check_qingzhou_branch_camp_conversations(failures: Array[String]) -> void: var base_scene = _new_prebattle_scene_for(failures, "Qingzhou base camp", QINGZHOU_SCENARIO_ID, QINGZHOU_SCENARIO_PATH) if base_scene != null: if base_scene._camp_conversation_by_id("qingzhou_settlement_council").is_empty(): failures.append("Qingzhou should expose lasting army officer conversation") if base_scene._camp_conversation_by_id("qingzhou_village_screen").is_empty(): failures.append("Qingzhou should expose village screen officer conversation") if not base_scene._camp_conversation_by_id("qingzhou_hardened_veterans").is_empty(): failures.append("Qingzhou pursuit supplies should be hidden without pursuit flag") if not base_scene._camp_conversation_by_id("qingzhou_sishui_stores").is_empty(): failures.append("Qingzhou Sishui stores should be hidden without regroup flag") var merchant: Dictionary = base_scene.state.get_shop_merchant() if str(merchant.get("name", "")) != "Qingzhou Road Merchant": failures.append("Qingzhou shop merchant name should be present") var merchant_lines: Array = merchant.get("lines", []) if merchant_lines.size() < 2: failures.append("Qingzhou shop merchant should expose flavor lines") if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics": failures.append("Qingzhou base talk status should summarize two non-supply topics") base_scene.free() var pursuit_scene = _new_prebattle_scene_for( failures, "Qingzhou pursuit camp", QINGZHOU_SCENARIO_ID, QINGZHOU_SCENARIO_PATH, {"pursued_dong_zhuo": true} ) if pursuit_scene != null: var veterans: Dictionary = pursuit_scene._camp_conversation_by_id("qingzhou_hardened_veterans") if veterans.is_empty(): failures.append("pursuit flag should expose Qingzhou hardened veterans") if not pursuit_scene._camp_conversation_by_id("qingzhou_sishui_stores").is_empty(): failures.append("pursuit flag should not expose Qingzhou Sishui stores") if not veterans.is_empty(): if pursuit_scene._format_talk_status_text(pursuit_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Qingzhou pursuit talk status should show one ready supply") if not pursuit_scene._format_camp_conversation_button_text(veterans).contains("Supply Wine"): failures.append("Qingzhou hardened veterans button should show Wine supply") var before_wine := int(pursuit_scene.campaign_state.get_inventory_snapshot().get("wine", 0)) pursuit_scene._apply_camp_conversation_effects(veterans) if int(pursuit_scene.campaign_state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1: failures.append("Qingzhou hardened veterans should add Wine to campaign inventory") if int(pursuit_scene.state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1: failures.append("Qingzhou hardened veterans should refresh battle Wine inventory") if not pursuit_scene.campaign_state.has_claimed_camp_conversation_effects(QINGZHOU_SCENARIO_ID, "qingzhou_hardened_veterans"): failures.append("Qingzhou hardened veterans claim should be saved") if pursuit_scene._format_talk_status_text(pursuit_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Qingzhou pursuit talk status should show claimed supply after claim") pursuit_scene.free() var regroup_scene = _new_prebattle_scene_for( failures, "Qingzhou regroup camp", QINGZHOU_SCENARIO_ID, QINGZHOU_SCENARIO_PATH, {"regrouped_after_sishui": true} ) if regroup_scene != null: var stores: Dictionary = regroup_scene._camp_conversation_by_id("qingzhou_sishui_stores") if stores.is_empty(): failures.append("regroup flag should expose Qingzhou Sishui stores") if not regroup_scene._camp_conversation_by_id("qingzhou_hardened_veterans").is_empty(): failures.append("regroup flag should not expose Qingzhou hardened veterans") if not stores.is_empty(): if regroup_scene._format_talk_status_text(regroup_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Qingzhou regroup talk status should show one ready supply") if not regroup_scene._format_camp_conversation_button_text(stores).contains("Supply Bean"): failures.append("Qingzhou Sishui stores button should show Bean supply") var before_bean := int(regroup_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) regroup_scene._apply_camp_conversation_effects(stores) if int(regroup_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Qingzhou Sishui stores should add Bean to campaign inventory") if int(regroup_scene.state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Qingzhou Sishui stores should refresh battle Bean inventory") if not regroup_scene.campaign_state.has_claimed_camp_conversation_effects(QINGZHOU_SCENARIO_ID, "qingzhou_sishui_stores"): failures.append("Qingzhou Sishui stores claim should be saved") if regroup_scene._format_talk_status_text(regroup_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Qingzhou regroup talk status should show claimed supply after claim") regroup_scene.free() func _check_wuchao_branch_camp_conversations(failures: Array[String]) -> void: var base_scene = _new_prebattle_scene_for(failures, "Wuchao base camp", WUCHAO_SCENARIO_ID, WUCHAO_SCENARIO_PATH) if base_scene != null: if base_scene._camp_conversation_by_id("wuchao_night_raid_council").is_empty(): failures.append("Wuchao should expose the night raid council conversation") if base_scene._camp_conversation_by_id("wuchao_guo_jia_empty_bowl").is_empty(): failures.append("Wuchao should expose Guo Jia's officer conversation") if not base_scene._camp_conversation_by_id("wuchao_fast_raid_supplies").is_empty(): failures.append("Wuchao fast raid supplies should be hidden without the prepared raid flag") if not base_scene._camp_conversation_by_id("wuchao_guandu_reserve_wagon").is_empty(): failures.append("Wuchao reserve wagon should be hidden without the strengthened defense flag") var merchant: Dictionary = base_scene.state.get_shop_merchant() if str(merchant.get("name", "")) != "Wuchao Night Trader": failures.append("Wuchao shop merchant name should be present") var merchant_lines: Array = merchant.get("lines", []) if merchant_lines.size() < 2: failures.append("Wuchao shop merchant should expose flavor lines") if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics": failures.append("Wuchao base talk status should summarize two non-supply topics") base_scene.free() var raid_scene = _new_prebattle_scene_for( failures, "Wuchao prepared raid camp", WUCHAO_SCENARIO_ID, WUCHAO_SCENARIO_PATH, {"prepared_wuchao_raid": true} ) if raid_scene != null: var fast_supplies: Dictionary = raid_scene._camp_conversation_by_id("wuchao_fast_raid_supplies") if fast_supplies.is_empty(): failures.append("prepared raid flag should expose Wuchao fast supplies") if not raid_scene._camp_conversation_by_id("wuchao_guandu_reserve_wagon").is_empty(): failures.append("prepared raid flag should not expose Wuchao reserve wagon") if not fast_supplies.is_empty(): if raid_scene._format_talk_status_text(raid_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Wuchao prepared raid talk status should show one ready supply") if not raid_scene._format_camp_conversation_button_text(fast_supplies).contains("Supply Bean"): failures.append("Wuchao fast supplies button should show Bean supply") var before_bean := int(raid_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) raid_scene._apply_camp_conversation_effects(fast_supplies) if int(raid_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Wuchao fast supplies should add Bean to campaign inventory") if int(raid_scene.state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Wuchao fast supplies should refresh battle Bean inventory") if not raid_scene.campaign_state.has_claimed_camp_conversation_effects(WUCHAO_SCENARIO_ID, "wuchao_fast_raid_supplies"): failures.append("Wuchao fast supplies claim should be saved") if raid_scene._format_talk_status_text(raid_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Wuchao prepared raid talk status should show claimed supply after claim") raid_scene.free() var defense_scene = _new_prebattle_scene_for( failures, "Wuchao strengthened defense camp", WUCHAO_SCENARIO_ID, WUCHAO_SCENARIO_PATH, {"strengthened_guandu_defense": true} ) if defense_scene != null: var reserve_wagon: Dictionary = defense_scene._camp_conversation_by_id("wuchao_guandu_reserve_wagon") if reserve_wagon.is_empty(): failures.append("strengthened defense flag should expose Wuchao reserve wagon") if not defense_scene._camp_conversation_by_id("wuchao_fast_raid_supplies").is_empty(): failures.append("strengthened defense flag should not expose Wuchao fast supplies") if not reserve_wagon.is_empty(): if defense_scene._format_talk_status_text(defense_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Wuchao strengthened defense talk status should show one ready supply") if not defense_scene._format_camp_conversation_button_text(reserve_wagon).contains("Supply Panacea"): failures.append("Wuchao reserve wagon button should show Panacea supply") var before_panacea := int(defense_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) defense_scene._apply_camp_conversation_effects(reserve_wagon) if int(defense_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Wuchao reserve wagon should add Panacea to campaign inventory") if int(defense_scene.state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Wuchao reserve wagon should refresh battle Panacea inventory") if not defense_scene.campaign_state.has_claimed_camp_conversation_effects(WUCHAO_SCENARIO_ID, "wuchao_guandu_reserve_wagon"): failures.append("Wuchao reserve wagon claim should be saved") defense_scene.free() func _check_cangting_branch_camp_conversations(failures: Array[String]) -> void: var base_scene = _new_prebattle_scene_for(failures, "Cangting base camp", CANGTING_SCENARIO_ID, CANGTING_SCENARIO_PATH) if base_scene != null: if base_scene._camp_conversation_by_id("cangting_pursuit_council").is_empty(): failures.append("Cangting should expose the pursuit council conversation") if base_scene._camp_conversation_by_id("cangting_guo_jia_rearguard").is_empty(): failures.append("Cangting should expose Guo Jia's rear guard conversation") if not base_scene._camp_conversation_by_id(CANGTING_PRESSED_CONVERSATION_ID).is_empty(): failures.append("Cangting fast pursuit rations should be hidden without pressed rout flag") if not base_scene._camp_conversation_by_id(CANGTING_STORES_CONVERSATION_ID).is_empty(): failures.append("Cangting Wuchao store medicine should be hidden without secured stores flag") var merchant: Dictionary = base_scene.state.get_shop_merchant() if str(merchant.get("name", "")) != "Cangting Road Sutler": failures.append("Cangting shop merchant name should be present") var merchant_lines: Array = merchant.get("lines", []) if merchant_lines.size() < 2: failures.append("Cangting shop merchant should expose flavor lines") if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics": failures.append("Cangting base talk status should summarize two non-supply topics") base_scene.free() var pressed_scene = _new_prebattle_scene_for( failures, "Cangting pressed rout camp", CANGTING_SCENARIO_ID, CANGTING_SCENARIO_PATH, {"pressed_yuan_rout": true} ) if pressed_scene != null: var fast_rations: Dictionary = pressed_scene._camp_conversation_by_id(CANGTING_PRESSED_CONVERSATION_ID) if fast_rations.is_empty(): failures.append("pressed Yuan rout flag should expose Cangting fast pursuit rations") if not pressed_scene._camp_conversation_by_id(CANGTING_STORES_CONVERSATION_ID).is_empty(): failures.append("pressed Yuan rout flag should not expose Cangting Wuchao store medicine") if not fast_rations.is_empty(): if pressed_scene._format_talk_status_text(pressed_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Cangting pressed rout talk status should show one ready supply") if not pressed_scene._format_camp_conversation_button_text(fast_rations).contains("Supply Bean"): failures.append("Cangting fast pursuit rations button should show Bean supply") var before_bean := int(pressed_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) pressed_scene._apply_camp_conversation_effects(fast_rations) if int(pressed_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Cangting fast pursuit rations should add Bean to campaign inventory") if int(pressed_scene.state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Cangting fast pursuit rations should refresh battle Bean inventory") if not pressed_scene.campaign_state.has_claimed_camp_conversation_effects(CANGTING_SCENARIO_ID, CANGTING_PRESSED_CONVERSATION_ID): failures.append("Cangting fast pursuit rations claim should be saved") if pressed_scene._format_talk_status_text(pressed_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Cangting pressed rout talk status should show claimed supply after claim") pressed_scene.free() var stores_scene = _new_prebattle_scene_for( failures, "Cangting secured Wuchao stores camp", CANGTING_SCENARIO_ID, CANGTING_SCENARIO_PATH, {"secured_wuchao_stores": true} ) if stores_scene != null: var store_medicine: Dictionary = stores_scene._camp_conversation_by_id(CANGTING_STORES_CONVERSATION_ID) if store_medicine.is_empty(): failures.append("secured Wuchao stores flag should expose Cangting store medicine") if not stores_scene._camp_conversation_by_id(CANGTING_PRESSED_CONVERSATION_ID).is_empty(): failures.append("secured Wuchao stores flag should not expose Cangting fast pursuit rations") if not store_medicine.is_empty(): if stores_scene._format_talk_status_text(stores_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Cangting secured stores talk status should show one ready supply") if not stores_scene._format_camp_conversation_button_text(store_medicine).contains("Supply Panacea"): failures.append("Cangting store medicine button should show Panacea supply") var before_panacea := int(stores_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) stores_scene._apply_camp_conversation_effects(store_medicine) if int(stores_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Cangting store medicine should add Panacea to campaign inventory") if int(stores_scene.state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Cangting store medicine should refresh battle Panacea inventory") if not stores_scene.campaign_state.has_claimed_camp_conversation_effects(CANGTING_SCENARIO_ID, CANGTING_STORES_CONVERSATION_ID): failures.append("Cangting store medicine claim should be saved") if stores_scene._format_talk_status_text(stores_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Cangting secured stores talk status should show claimed supply after claim") stores_scene.free() func _check_ye_branch_camp_conversations(failures: Array[String]) -> void: var base_scene = _new_prebattle_scene_for(failures, "Ye base camp", YE_SCENARIO_ID, YE_SCENARIO_PATH) if base_scene != null: if base_scene._camp_conversation_by_id("ye_outer_council").is_empty(): failures.append("Ye should expose the outer defense council conversation") if base_scene._camp_conversation_by_id("ye_zhang_he_city_map").is_empty(): failures.append("Ye should expose Zhang He's city map conversation") if not base_scene._camp_conversation_by_id(YE_RAPID_CONVERSATION_ID).is_empty(): failures.append("Ye rapid march rations should be hidden without advanced flag") if not base_scene._camp_conversation_by_id(YE_CROSSING_CONVERSATION_ID).is_empty(): failures.append("Ye crossing medicine should be hidden without crossings flag") var merchant: Dictionary = base_scene.state.get_shop_merchant() if str(merchant.get("name", "")) != "Ye Outskirts Sutler": failures.append("Ye shop merchant name should be present") var merchant_lines: Array = merchant.get("lines", []) if merchant_lines.size() < 2: failures.append("Ye shop merchant should expose flavor lines") if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics": failures.append("Ye base talk status should summarize two non-supply topics") base_scene.free() var advanced_scene = _new_prebattle_scene_for( failures, "Ye advanced camp", YE_SCENARIO_ID, YE_SCENARIO_PATH, {"advanced_to_ye": true} ) if advanced_scene != null: var rapid_rations: Dictionary = advanced_scene._camp_conversation_by_id(YE_RAPID_CONVERSATION_ID) if rapid_rations.is_empty(): failures.append("advanced to Ye flag should expose rapid march rations") if not advanced_scene._camp_conversation_by_id(YE_CROSSING_CONVERSATION_ID).is_empty(): failures.append("advanced to Ye flag should not expose crossing medicine") if not rapid_rations.is_empty(): if advanced_scene._format_talk_status_text(advanced_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Ye advanced talk status should show one ready supply") if not advanced_scene._format_camp_conversation_button_text(rapid_rations).contains("Supply Bean"): failures.append("Ye rapid rations button should show Bean supply") var before_bean := int(advanced_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) advanced_scene._apply_camp_conversation_effects(rapid_rations) if int(advanced_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Ye rapid rations should add Bean to campaign inventory") if int(advanced_scene.state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Ye rapid rations should refresh battle Bean inventory") if not advanced_scene.campaign_state.has_claimed_camp_conversation_effects(YE_SCENARIO_ID, YE_RAPID_CONVERSATION_ID): failures.append("Ye rapid rations claim should be saved") if advanced_scene._format_talk_status_text(advanced_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Ye advanced talk status should show claimed supply after claim") advanced_scene.free() var crossing_scene = _new_prebattle_scene_for( failures, "Ye crossings camp", YE_SCENARIO_ID, YE_SCENARIO_PATH, {"secured_hebei_crossings": true} ) if crossing_scene != null: var crossing_medicine: Dictionary = crossing_scene._camp_conversation_by_id(YE_CROSSING_CONVERSATION_ID) if crossing_medicine.is_empty(): failures.append("secured Hebei crossings flag should expose Ye crossing medicine") if not crossing_scene._camp_conversation_by_id(YE_RAPID_CONVERSATION_ID).is_empty(): failures.append("secured Hebei crossings flag should not expose Ye rapid rations") if not crossing_medicine.is_empty(): if crossing_scene._format_talk_status_text(crossing_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Ye crossings talk status should show one ready supply") if not crossing_scene._format_camp_conversation_button_text(crossing_medicine).contains("Supply Panacea"): failures.append("Ye crossing medicine button should show Panacea supply") var before_panacea := int(crossing_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) crossing_scene._apply_camp_conversation_effects(crossing_medicine) if int(crossing_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Ye crossing medicine should add Panacea to campaign inventory") if int(crossing_scene.state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Ye crossing medicine should refresh battle Panacea inventory") if not crossing_scene.campaign_state.has_claimed_camp_conversation_effects(YE_SCENARIO_ID, YE_CROSSING_CONVERSATION_ID): failures.append("Ye crossing medicine claim should be saved") if crossing_scene._format_talk_status_text(crossing_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Ye crossings talk status should show claimed supply after claim") crossing_scene.free() func _check_ye_siege_branch_camp_conversations(failures: Array[String]) -> void: var base_scene = _new_prebattle_scene_for(failures, "Ye Siege base camp", YE_SIEGE_SCENARIO_ID, YE_SIEGE_SCENARIO_PATH) if base_scene != null: if base_scene._camp_conversation_by_id("ye_siege_inner_gate_council").is_empty(): failures.append("Ye Siege should expose the inner gate council conversation") if base_scene._camp_conversation_by_id("ye_siege_zhang_he_streets").is_empty(): failures.append("Ye Siege should expose Zhang He's inner streets conversation") if not base_scene._camp_conversation_by_id(YE_SIEGE_PRESSED_CONVERSATION_ID).is_empty(): failures.append("Ye Siege ladder rations should be hidden without pressed siege flag") if not base_scene._camp_conversation_by_id(YE_SIEGE_SPLIT_CONVERSATION_ID).is_empty(): failures.append("Ye Siege defector medicine should be hidden without split heirs flag") var merchant: Dictionary = base_scene.state.get_shop_merchant() if str(merchant.get("name", "")) != "Ye Gate Sutler": failures.append("Ye Siege shop merchant name should be present") var merchant_lines: Array = merchant.get("lines", []) if merchant_lines.size() < 2: failures.append("Ye Siege shop merchant should expose flavor lines") if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics": failures.append("Ye Siege base talk status should summarize two non-supply topics") base_scene.free() var pressed_scene = _new_prebattle_scene_for( failures, "Ye Siege pressed camp", YE_SIEGE_SCENARIO_ID, YE_SIEGE_SCENARIO_PATH, {"pressed_ye_siege": true} ) if pressed_scene != null: var ladder_rations: Dictionary = pressed_scene._camp_conversation_by_id(YE_SIEGE_PRESSED_CONVERSATION_ID) if ladder_rations.is_empty(): failures.append("pressed Ye siege flag should expose ladder rations") if not pressed_scene._camp_conversation_by_id(YE_SIEGE_SPLIT_CONVERSATION_ID).is_empty(): failures.append("pressed Ye siege flag should not expose defector medicine") if not ladder_rations.is_empty(): if pressed_scene._format_talk_status_text(pressed_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Ye Siege pressed talk status should show one ready supply") if not pressed_scene._format_camp_conversation_button_text(ladder_rations).contains("Supply Bean"): failures.append("Ye Siege ladder rations button should show Bean supply") var before_bean := int(pressed_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) pressed_scene._apply_camp_conversation_effects(ladder_rations) if int(pressed_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Ye Siege ladder rations should add Bean to campaign inventory") if int(pressed_scene.state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Ye Siege ladder rations should refresh battle Bean inventory") if not pressed_scene.campaign_state.has_claimed_camp_conversation_effects(YE_SIEGE_SCENARIO_ID, YE_SIEGE_PRESSED_CONVERSATION_ID): failures.append("Ye Siege ladder rations claim should be saved") if pressed_scene._format_talk_status_text(pressed_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Ye Siege pressed talk status should show claimed supply after claim") pressed_scene.free() var split_scene = _new_prebattle_scene_for( failures, "Ye Siege split heirs camp", YE_SIEGE_SCENARIO_ID, YE_SIEGE_SCENARIO_PATH, {"split_yuan_heirs": true} ) if split_scene != null: var defector_medicine: Dictionary = split_scene._camp_conversation_by_id(YE_SIEGE_SPLIT_CONVERSATION_ID) if defector_medicine.is_empty(): failures.append("split Yuan heirs flag should expose Ye Siege defector medicine") if not split_scene._camp_conversation_by_id(YE_SIEGE_PRESSED_CONVERSATION_ID).is_empty(): failures.append("split Yuan heirs flag should not expose ladder rations") if not defector_medicine.is_empty(): if split_scene._format_talk_status_text(split_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Ye Siege split heirs talk status should show one ready supply") if not split_scene._format_camp_conversation_button_text(defector_medicine).contains("Supply Panacea"): failures.append("Ye Siege defector medicine button should show Panacea supply") var before_panacea := int(split_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) split_scene._apply_camp_conversation_effects(defector_medicine) if int(split_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Ye Siege defector medicine should add Panacea to campaign inventory") if int(split_scene.state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Ye Siege defector medicine should refresh battle Panacea inventory") if not split_scene.campaign_state.has_claimed_camp_conversation_effects(YE_SIEGE_SCENARIO_ID, YE_SIEGE_SPLIT_CONVERSATION_ID): failures.append("Ye Siege defector medicine claim should be saved") if split_scene._format_talk_status_text(split_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Ye Siege split heirs talk status should show claimed supply after claim") split_scene.free() func _check_ye_surrender_branch_camp_conversations(failures: Array[String]) -> void: var base_scene = _new_prebattle_scene_for(failures, "Ye Surrender base camp", YE_SURRENDER_SCENARIO_ID, YE_SURRENDER_SCENARIO_PATH) if base_scene != null: if base_scene._camp_conversation_by_id("ye_surrender_palace_road_council").is_empty(): failures.append("Ye Surrender should expose the palace road council conversation") if base_scene._camp_conversation_by_id("ye_surrender_zhang_he_last_loyalists").is_empty(): failures.append("Ye Surrender should expose Zhang He's last loyalists conversation") if not base_scene._camp_conversation_by_id(YE_SURRENDER_PRESSURE_CONVERSATION_ID).is_empty(): failures.append("Ye Surrender pressure rations should be hidden without forced surrender flag") if not base_scene._camp_conversation_by_id(YE_SURRENDER_DEFECTOR_CONVERSATION_ID).is_empty(): failures.append("Ye Surrender defector medicine should be hidden without negotiated defections flag") var merchant: Dictionary = base_scene.state.get_shop_merchant() if str(merchant.get("name", "")) != "Ye Palace Road Sutler": failures.append("Ye Surrender shop merchant name should be present") var merchant_lines: Array = merchant.get("lines", []) if merchant_lines.size() < 2: failures.append("Ye Surrender shop merchant should expose flavor lines") if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics": failures.append("Ye Surrender base talk status should summarize two non-supply topics") base_scene.free() var forced_scene = _new_prebattle_scene_for( failures, "Ye Surrender forced camp", YE_SURRENDER_SCENARIO_ID, YE_SURRENDER_SCENARIO_PATH, {"forced_ye_surrender": true} ) if forced_scene != null: var pressure_rations: Dictionary = forced_scene._camp_conversation_by_id(YE_SURRENDER_PRESSURE_CONVERSATION_ID) if pressure_rations.is_empty(): failures.append("forced Ye surrender flag should expose pressure rations") if not forced_scene._camp_conversation_by_id(YE_SURRENDER_DEFECTOR_CONVERSATION_ID).is_empty(): failures.append("forced Ye surrender flag should not expose defector medicine") if not pressure_rations.is_empty(): if forced_scene._format_talk_status_text(forced_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Ye Surrender forced talk status should show one ready supply") if not forced_scene._format_camp_conversation_button_text(pressure_rations).contains("Supply Bean"): failures.append("Ye Surrender pressure rations button should show Bean supply") var before_bean := int(forced_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) forced_scene._apply_camp_conversation_effects(pressure_rations) if int(forced_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Ye Surrender pressure rations should add Bean to campaign inventory") if int(forced_scene.state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Ye Surrender pressure rations should refresh battle Bean inventory") if not forced_scene.campaign_state.has_claimed_camp_conversation_effects(YE_SURRENDER_SCENARIO_ID, YE_SURRENDER_PRESSURE_CONVERSATION_ID): failures.append("Ye Surrender pressure rations claim should be saved") if forced_scene._format_talk_status_text(forced_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Ye Surrender forced talk status should show claimed supply after claim") forced_scene.free() var negotiated_scene = _new_prebattle_scene_for( failures, "Ye Surrender negotiated camp", YE_SURRENDER_SCENARIO_ID, YE_SURRENDER_SCENARIO_PATH, {"negotiated_yuan_defections": true} ) if negotiated_scene != null: var defector_medicine: Dictionary = negotiated_scene._camp_conversation_by_id(YE_SURRENDER_DEFECTOR_CONVERSATION_ID) if defector_medicine.is_empty(): failures.append("negotiated Yuan defections flag should expose Ye Surrender defector medicine") if not negotiated_scene._camp_conversation_by_id(YE_SURRENDER_PRESSURE_CONVERSATION_ID).is_empty(): failures.append("negotiated Yuan defections flag should not expose pressure rations") if not defector_medicine.is_empty(): if negotiated_scene._format_talk_status_text(negotiated_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Ye Surrender negotiated talk status should show one ready supply") if not negotiated_scene._format_camp_conversation_button_text(defector_medicine).contains("Supply Panacea"): failures.append("Ye Surrender defector medicine button should show Panacea supply") var before_panacea := int(negotiated_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) negotiated_scene._apply_camp_conversation_effects(defector_medicine) if int(negotiated_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Ye Surrender defector medicine should add Panacea to campaign inventory") if int(negotiated_scene.state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Ye Surrender defector medicine should refresh battle Panacea inventory") if not negotiated_scene.campaign_state.has_claimed_camp_conversation_effects(YE_SURRENDER_SCENARIO_ID, YE_SURRENDER_DEFECTOR_CONVERSATION_ID): failures.append("Ye Surrender defector medicine claim should be saved") if negotiated_scene._format_talk_status_text(negotiated_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Ye Surrender negotiated talk status should show claimed supply after claim") negotiated_scene.free() func _check_northern_pursuit_branch_camp_conversations(failures: Array[String]) -> void: var base_scene = _new_prebattle_scene_for(failures, "Northern Pursuit base camp", NORTHERN_PURSUIT_SCENARIO_ID, NORTHERN_PURSUIT_SCENARIO_PATH) if base_scene != null: if base_scene._camp_conversation_by_id("northern_pursuit_road_council").is_empty(): failures.append("Northern Pursuit should expose the road council conversation") if base_scene._camp_conversation_by_id("northern_pursuit_zhang_he_retreat_road").is_empty(): failures.append("Northern Pursuit should expose Zhang He's retreat road conversation") if not base_scene._camp_conversation_by_id(NORTHERN_PURSUIT_HARD_MARCH_CONVERSATION_ID).is_empty(): failures.append("Northern Pursuit hard march beans should be hidden without pursued Yuan Shang flag") if not base_scene._camp_conversation_by_id(NORTHERN_PURSUIT_JI_SUPPLY_CONVERSATION_ID).is_empty(): failures.append("Northern Pursuit Ji supply medicine should be hidden without stabilized Ye flag") var merchant: Dictionary = base_scene.state.get_shop_merchant() if str(merchant.get("name", "")) != "Northern Road Sutler": failures.append("Northern Pursuit shop merchant name should be present") var merchant_lines: Array = merchant.get("lines", []) if merchant_lines.size() < 2: failures.append("Northern Pursuit shop merchant should expose flavor lines") if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics": failures.append("Northern Pursuit base talk status should summarize two non-supply topics") base_scene.free() var pursued_scene = _new_prebattle_scene_for( failures, "Northern Pursuit pursued camp", NORTHERN_PURSUIT_SCENARIO_ID, NORTHERN_PURSUIT_SCENARIO_PATH, {"pursued_yuan_shang": true} ) if pursued_scene != null: var hard_march_beans: Dictionary = pursued_scene._camp_conversation_by_id(NORTHERN_PURSUIT_HARD_MARCH_CONVERSATION_ID) if hard_march_beans.is_empty(): failures.append("pursued Yuan Shang flag should expose Northern Pursuit hard march beans") if not pursued_scene._camp_conversation_by_id(NORTHERN_PURSUIT_JI_SUPPLY_CONVERSATION_ID).is_empty(): failures.append("pursued Yuan Shang flag should not expose Ji supply medicine") if not hard_march_beans.is_empty(): if pursued_scene._format_talk_status_text(pursued_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Northern Pursuit pursued talk status should show one ready supply") if not pursued_scene._format_camp_conversation_button_text(hard_march_beans).contains("Supply Bean"): failures.append("Northern Pursuit hard march beans button should show Bean supply") var before_bean := int(pursued_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) pursued_scene._apply_camp_conversation_effects(hard_march_beans) if int(pursued_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Northern Pursuit hard march beans should add Bean to campaign inventory") if int(pursued_scene.state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Northern Pursuit hard march beans should refresh battle Bean inventory") if not pursued_scene.campaign_state.has_claimed_camp_conversation_effects(NORTHERN_PURSUIT_SCENARIO_ID, NORTHERN_PURSUIT_HARD_MARCH_CONVERSATION_ID): failures.append("Northern Pursuit hard march beans claim should be saved") if pursued_scene._format_talk_status_text(pursued_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Northern Pursuit pursued talk status should show claimed supply after claim") pursued_scene.free() var stabilized_scene = _new_prebattle_scene_for( failures, "Northern Pursuit stabilized camp", NORTHERN_PURSUIT_SCENARIO_ID, NORTHERN_PURSUIT_SCENARIO_PATH, {"stabilized_ye": true} ) if stabilized_scene != null: var ji_supply_medicine: Dictionary = stabilized_scene._camp_conversation_by_id(NORTHERN_PURSUIT_JI_SUPPLY_CONVERSATION_ID) if ji_supply_medicine.is_empty(): failures.append("stabilized Ye flag should expose Northern Pursuit Ji supply medicine") if not stabilized_scene._camp_conversation_by_id(NORTHERN_PURSUIT_HARD_MARCH_CONVERSATION_ID).is_empty(): failures.append("stabilized Ye flag should not expose hard march beans") if not ji_supply_medicine.is_empty(): if stabilized_scene._format_talk_status_text(stabilized_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Northern Pursuit stabilized talk status should show one ready supply") if not stabilized_scene._format_camp_conversation_button_text(ji_supply_medicine).contains("Supply Panacea"): failures.append("Northern Pursuit Ji supply medicine button should show Panacea supply") var before_panacea := int(stabilized_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) stabilized_scene._apply_camp_conversation_effects(ji_supply_medicine) if int(stabilized_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Northern Pursuit Ji supply medicine should add Panacea to campaign inventory") if int(stabilized_scene.state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Northern Pursuit Ji supply medicine should refresh battle Panacea inventory") if not stabilized_scene.campaign_state.has_claimed_camp_conversation_effects(NORTHERN_PURSUIT_SCENARIO_ID, NORTHERN_PURSUIT_JI_SUPPLY_CONVERSATION_ID): failures.append("Northern Pursuit Ji supply medicine claim should be saved") if stabilized_scene._format_talk_status_text(stabilized_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Northern Pursuit stabilized talk status should show claimed supply after claim") stabilized_scene.free() func _check_nanpi_branch_camp_conversations(failures: Array[String]) -> void: var base_scene = _new_prebattle_scene_for(failures, "Nanpi base camp", NANPI_SCENARIO_ID, NANPI_SCENARIO_PATH) if base_scene != null: if base_scene._camp_conversation_by_id("nanpi_pressure_gate_council").is_empty(): failures.append("Nanpi should expose the gate council conversation") if base_scene._camp_conversation_by_id("nanpi_pressure_zhang_he_gate_names").is_empty(): failures.append("Nanpi should expose Zhang He's gate names conversation") if not base_scene._camp_conversation_by_id(NANPI_PRESSURE_HARD_PUSH_CONVERSATION_ID).is_empty(): failures.append("Nanpi hard push beans should be hidden without pressed north flag") if not base_scene._camp_conversation_by_id(NANPI_PRESSURE_ADMIN_SUPPLY_CONVERSATION_ID).is_empty(): failures.append("Nanpi admin medicine should be hidden without secured Ji flag") var merchant: Dictionary = base_scene.state.get_shop_merchant() if str(merchant.get("name", "")) != "Nanpi Gate Sutler": failures.append("Nanpi shop merchant name should be present") var merchant_lines: Array = merchant.get("lines", []) if merchant_lines.size() < 2: failures.append("Nanpi shop merchant should expose flavor lines") if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics": failures.append("Nanpi base talk status should summarize two non-supply topics") base_scene.free() var pressed_scene = _new_prebattle_scene_for( failures, "Nanpi pressed camp", NANPI_SCENARIO_ID, NANPI_SCENARIO_PATH, {"pressed_north_to_nanpi": true} ) if pressed_scene != null: var hard_push_beans: Dictionary = pressed_scene._camp_conversation_by_id(NANPI_PRESSURE_HARD_PUSH_CONVERSATION_ID) if hard_push_beans.is_empty(): failures.append("pressed north flag should expose Nanpi hard push beans") if not pressed_scene._camp_conversation_by_id(NANPI_PRESSURE_ADMIN_SUPPLY_CONVERSATION_ID).is_empty(): failures.append("pressed north flag should not expose Nanpi admin medicine") if not hard_push_beans.is_empty(): if pressed_scene._format_talk_status_text(pressed_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Nanpi pressed talk status should show one ready supply") if not pressed_scene._format_camp_conversation_button_text(hard_push_beans).contains("Supply Bean"): failures.append("Nanpi hard push beans button should show Bean supply") var before_bean := int(pressed_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) pressed_scene._apply_camp_conversation_effects(hard_push_beans) if int(pressed_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Nanpi hard push beans should add Bean to campaign inventory") if int(pressed_scene.state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Nanpi hard push beans should refresh battle Bean inventory") if not pressed_scene.campaign_state.has_claimed_camp_conversation_effects(NANPI_SCENARIO_ID, NANPI_PRESSURE_HARD_PUSH_CONVERSATION_ID): failures.append("Nanpi hard push beans claim should be saved") if pressed_scene._format_talk_status_text(pressed_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Nanpi pressed talk status should show claimed supply after claim") pressed_scene.free() var secured_scene = _new_prebattle_scene_for( failures, "Nanpi secured camp", NANPI_SCENARIO_ID, NANPI_SCENARIO_PATH, {"secured_ji_province": true} ) if secured_scene != null: var admin_medicine: Dictionary = secured_scene._camp_conversation_by_id(NANPI_PRESSURE_ADMIN_SUPPLY_CONVERSATION_ID) if admin_medicine.is_empty(): failures.append("secured Ji flag should expose Nanpi admin medicine") if not secured_scene._camp_conversation_by_id(NANPI_PRESSURE_HARD_PUSH_CONVERSATION_ID).is_empty(): failures.append("secured Ji flag should not expose Nanpi hard push beans") if not admin_medicine.is_empty(): if secured_scene._format_talk_status_text(secured_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Nanpi secured talk status should show one ready supply") if not secured_scene._format_camp_conversation_button_text(admin_medicine).contains("Supply Panacea"): failures.append("Nanpi admin 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(admin_medicine) if int(secured_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Nanpi admin medicine should add Panacea to campaign inventory") if int(secured_scene.state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Nanpi admin medicine should refresh battle Panacea inventory") if not secured_scene.campaign_state.has_claimed_camp_conversation_effects(NANPI_SCENARIO_ID, NANPI_PRESSURE_ADMIN_SUPPLY_CONVERSATION_ID): failures.append("Nanpi admin 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("Nanpi secured talk status should show claimed supply after claim") secured_scene.free() func _check_nanpi_surrender_branch_camp_conversations(failures: Array[String]) -> void: var base_scene = _new_prebattle_scene_for(failures, "Nanpi Surrender base camp", NANPI_SURRENDER_SCENARIO_ID, NANPI_SURRENDER_SCENARIO_PATH) if base_scene != null: if base_scene._camp_conversation_by_id("nanpi_surrender_gate_terms").is_empty(): failures.append("Nanpi Surrender should expose the gate terms conversation") if base_scene._camp_conversation_by_id("nanpi_surrender_zhang_he_loyalists").is_empty(): failures.append("Nanpi Surrender should expose Zhang He's loyalists conversation") if not base_scene._camp_conversation_by_id(NANPI_SURRENDER_PRESSURE_CONVERSATION_ID).is_empty(): failures.append("Nanpi Surrender pressure wine should be hidden without direct pressure flag") if not base_scene._camp_conversation_by_id(NANPI_SURRENDER_ADMIN_CONVERSATION_ID).is_empty(): failures.append("Nanpi Surrender admin medicine should be hidden without Nanpi admin flag") var merchant: Dictionary = base_scene.state.get_shop_merchant() if str(merchant.get("name", "")) != "Nanpi Surrender Sutler": failures.append("Nanpi Surrender shop merchant name should be present") var merchant_lines: Array = merchant.get("lines", []) if merchant_lines.size() < 2: failures.append("Nanpi Surrender shop merchant should expose flavor lines") if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics": failures.append("Nanpi Surrender base talk status should summarize two non-supply topics") base_scene.free() var pressure_scene = _new_prebattle_scene_for( failures, "Nanpi Surrender pressure camp", NANPI_SURRENDER_SCENARIO_ID, NANPI_SURRENDER_SCENARIO_PATH, {"pressed_yuan_tan_surrender": true} ) if pressure_scene != null: var pressure_wine: Dictionary = pressure_scene._camp_conversation_by_id(NANPI_SURRENDER_PRESSURE_CONVERSATION_ID) if pressure_wine.is_empty(): failures.append("pressed Yuan Tan surrender flag should expose Nanpi Surrender pressure wine") if not pressure_scene._camp_conversation_by_id(NANPI_SURRENDER_ADMIN_CONVERSATION_ID).is_empty(): failures.append("pressed Yuan Tan surrender flag should not expose Nanpi Surrender admin medicine") if not pressure_wine.is_empty(): if pressure_scene._format_talk_status_text(pressure_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Nanpi Surrender pressure talk status should show one ready supply") if not pressure_scene._format_camp_conversation_button_text(pressure_wine).contains("Supply Wine"): failures.append("Nanpi Surrender pressure wine button should show Wine supply") var before_wine := int(pressure_scene.campaign_state.get_inventory_snapshot().get("wine", 0)) pressure_scene._apply_camp_conversation_effects(pressure_wine) if int(pressure_scene.campaign_state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1: failures.append("Nanpi Surrender pressure wine should add Wine to campaign inventory") if int(pressure_scene.state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1: failures.append("Nanpi Surrender pressure wine should refresh battle Wine inventory") if not pressure_scene.campaign_state.has_claimed_camp_conversation_effects(NANPI_SURRENDER_SCENARIO_ID, NANPI_SURRENDER_PRESSURE_CONVERSATION_ID): failures.append("Nanpi Surrender pressure wine claim should be saved") if pressure_scene._format_talk_status_text(pressure_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Nanpi Surrender pressure talk status should show claimed supply after claim") pressure_scene.free() var admin_scene = _new_prebattle_scene_for( failures, "Nanpi Surrender admin camp", NANPI_SURRENDER_SCENARIO_ID, NANPI_SURRENDER_SCENARIO_PATH, {"secured_nanpi_admin": true} ) if admin_scene != null: var admin_medicine: Dictionary = admin_scene._camp_conversation_by_id(NANPI_SURRENDER_ADMIN_CONVERSATION_ID) if admin_medicine.is_empty(): failures.append("secured Nanpi admin flag should expose Nanpi Surrender admin medicine") if not admin_scene._camp_conversation_by_id(NANPI_SURRENDER_PRESSURE_CONVERSATION_ID).is_empty(): failures.append("secured Nanpi admin flag should not expose Nanpi Surrender pressure wine") if not admin_medicine.is_empty(): if admin_scene._format_talk_status_text(admin_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Nanpi Surrender admin talk status should show one ready supply") if not admin_scene._format_camp_conversation_button_text(admin_medicine).contains("Supply Panacea"): failures.append("Nanpi Surrender admin medicine button should show Panacea supply") var before_panacea := int(admin_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) admin_scene._apply_camp_conversation_effects(admin_medicine) if int(admin_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Nanpi Surrender admin medicine should add Panacea to campaign inventory") if int(admin_scene.state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Nanpi Surrender admin medicine should refresh battle Panacea inventory") if not admin_scene.campaign_state.has_claimed_camp_conversation_effects(NANPI_SURRENDER_SCENARIO_ID, NANPI_SURRENDER_ADMIN_CONVERSATION_ID): failures.append("Nanpi Surrender admin medicine claim should be saved") if admin_scene._format_talk_status_text(admin_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Nanpi Surrender admin talk status should show claimed supply after claim") 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_liaoxi_branch_camp_conversations(failures: Array[String]) -> void: var base_scene = _new_prebattle_scene_for(failures, "Liaoxi base camp", LIAOXI_SCENARIO_ID, LIAOXI_SCENARIO_PATH) if base_scene != null: if base_scene._camp_conversation_by_id("liaoxi_frontier_council").is_empty(): failures.append("Liaoxi should expose the frontier council conversation") if base_scene._camp_conversation_by_id("liaoxi_zhang_he_hill_roads").is_empty(): failures.append("Liaoxi should expose Zhang He's hill roads conversation") if not base_scene._camp_conversation_by_id(LIAOXI_FAST_DRUMS_CONVERSATION_ID).is_empty(): failures.append("Liaoxi fast drums should be hidden without pressed Liaoxi flag") if not base_scene._camp_conversation_by_id(LIAOXI_APPROACH_MEDICINE_CONVERSATION_ID).is_empty(): failures.append("Liaoxi approach medicine should be hidden without secured Liaoxi flag") var merchant: Dictionary = base_scene.state.get_shop_merchant() if str(merchant.get("name", "")) != "Liaoxi Frontier Sutler": failures.append("Liaoxi shop merchant name should be present") var merchant_lines: Array = merchant.get("lines", []) if merchant_lines.size() < 2: failures.append("Liaoxi shop merchant should expose flavor lines") if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics": failures.append("Liaoxi base talk status should summarize two non-supply topics") base_scene.free() var pressed_scene = _new_prebattle_scene_for( failures, "Liaoxi pressed camp", LIAOXI_SCENARIO_ID, LIAOXI_SCENARIO_PATH, {"pressed_liaoxi_pursuit": true} ) if pressed_scene != null: var fast_drums: Dictionary = pressed_scene._camp_conversation_by_id(LIAOXI_FAST_DRUMS_CONVERSATION_ID) if fast_drums.is_empty(): failures.append("pressed Liaoxi flag should expose Liaoxi fast drums") if not pressed_scene._camp_conversation_by_id(LIAOXI_APPROACH_MEDICINE_CONVERSATION_ID).is_empty(): failures.append("pressed Liaoxi flag should not expose Liaoxi approach medicine") if not fast_drums.is_empty(): if pressed_scene._format_talk_status_text(pressed_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Liaoxi pressed talk status should show one ready supply") if not pressed_scene._format_camp_conversation_button_text(fast_drums).contains("Supply War Drum"): failures.append("Liaoxi fast drums button should show War Drum supply") var before_drums := int(pressed_scene.campaign_state.get_inventory_snapshot().get("war_drum", 0)) pressed_scene._apply_camp_conversation_effects(fast_drums) if int(pressed_scene.campaign_state.get_inventory_snapshot().get("war_drum", 0)) != before_drums + 1: failures.append("Liaoxi fast drums should add War Drum to campaign inventory") if int(pressed_scene.state.get_inventory_snapshot().get("war_drum", 0)) != before_drums + 1: failures.append("Liaoxi fast drums should refresh battle War Drum inventory") if not pressed_scene.campaign_state.has_claimed_camp_conversation_effects(LIAOXI_SCENARIO_ID, LIAOXI_FAST_DRUMS_CONVERSATION_ID): failures.append("Liaoxi fast drums claim should be saved") if pressed_scene._format_talk_status_text(pressed_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Liaoxi pressed talk status should show claimed supply after claim") pressed_scene.free() var secured_scene = _new_prebattle_scene_for( failures, "Liaoxi secured camp", LIAOXI_SCENARIO_ID, LIAOXI_SCENARIO_PATH, {"secured_liaoxi_approaches": true} ) if secured_scene != null: var approach_medicine: Dictionary = secured_scene._camp_conversation_by_id(LIAOXI_APPROACH_MEDICINE_CONVERSATION_ID) if approach_medicine.is_empty(): failures.append("secured Liaoxi flag should expose Liaoxi approach medicine") if not secured_scene._camp_conversation_by_id(LIAOXI_FAST_DRUMS_CONVERSATION_ID).is_empty(): failures.append("secured Liaoxi flag should not expose Liaoxi fast drums") if not approach_medicine.is_empty(): if secured_scene._format_talk_status_text(secured_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Liaoxi secured talk status should show one ready supply") if not secured_scene._format_camp_conversation_button_text(approach_medicine).contains("Supply Panacea"): failures.append("Liaoxi approach 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(approach_medicine) if int(secured_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Liaoxi approach medicine should add Panacea to campaign inventory") if int(secured_scene.state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Liaoxi approach medicine should refresh battle Panacea inventory") if not secured_scene.campaign_state.has_claimed_camp_conversation_effects(LIAOXI_SCENARIO_ID, LIAOXI_APPROACH_MEDICINE_CONVERSATION_ID): failures.append("Liaoxi approach 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("Liaoxi secured talk status should show claimed supply after claim") secured_scene.free() func _check_white_wolf_branch_camp_conversations(failures: Array[String]) -> void: var base_scene = _new_prebattle_scene_for(failures, "White Wolf base camp", WHITE_WOLF_SCENARIO_ID, WHITE_WOLF_SCENARIO_PATH) if base_scene != null: if base_scene._camp_conversation_by_id("white_wolf_ridge_council").is_empty(): failures.append("White Wolf should expose the ridge council conversation") if base_scene._camp_conversation_by_id("white_wolf_zhang_he_ridge_wind").is_empty(): failures.append("White Wolf should expose Zhang He's ridge wind conversation") if not base_scene._camp_conversation_by_id(WHITE_WOLF_CANTEENS_CONVERSATION_ID).is_empty(): failures.append("White Wolf canteens should be hidden without struck vanguard flag") if not base_scene._camp_conversation_by_id(WHITE_WOLF_MEDICINE_CONVERSATION_ID).is_empty(): failures.append("White Wolf medicine should be hidden without fortified route flag") var merchant: Dictionary = base_scene.state.get_shop_merchant() if str(merchant.get("name", "")) != "White Wolf Ridge Sutler": failures.append("White Wolf shop merchant name should be present") var merchant_lines: Array = merchant.get("lines", []) if merchant_lines.size() < 2: failures.append("White Wolf shop merchant should expose flavor lines") if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics": failures.append("White Wolf base talk status should summarize two non-supply topics") base_scene.free() var struck_scene = _new_prebattle_scene_for( failures, "White Wolf struck camp", WHITE_WOLF_SCENARIO_ID, WHITE_WOLF_SCENARIO_PATH, {"struck_wuhuan_vanguard": true} ) if struck_scene != null: var canteens: Dictionary = struck_scene._camp_conversation_by_id(WHITE_WOLF_CANTEENS_CONVERSATION_ID) if canteens.is_empty(): failures.append("struck Wuhuan flag should expose White Wolf canteens") if not struck_scene._camp_conversation_by_id(WHITE_WOLF_MEDICINE_CONVERSATION_ID).is_empty(): failures.append("struck Wuhuan flag should not expose White Wolf medicine") if not canteens.is_empty(): if struck_scene._format_talk_status_text(struck_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("White Wolf struck talk status should show one ready supply") if not struck_scene._format_camp_conversation_button_text(canteens).contains("Supply Wine"): failures.append("White Wolf canteens button should show Wine supply") var before_wine := int(struck_scene.campaign_state.get_inventory_snapshot().get("wine", 0)) struck_scene._apply_camp_conversation_effects(canteens) if int(struck_scene.campaign_state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1: failures.append("White Wolf canteens should add Wine to campaign inventory") if int(struck_scene.state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1: failures.append("White Wolf canteens should refresh battle Wine inventory") if not struck_scene.campaign_state.has_claimed_camp_conversation_effects(WHITE_WOLF_SCENARIO_ID, WHITE_WOLF_CANTEENS_CONVERSATION_ID): failures.append("White Wolf canteens claim should be saved") if struck_scene._format_talk_status_text(struck_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("White Wolf struck talk status should show claimed supply after claim") struck_scene.free() var fortified_scene = _new_prebattle_scene_for( failures, "White Wolf fortified camp", WHITE_WOLF_SCENARIO_ID, WHITE_WOLF_SCENARIO_PATH, {"fortified_white_wolf_route": true} ) if fortified_scene != null: var medicine: Dictionary = fortified_scene._camp_conversation_by_id(WHITE_WOLF_MEDICINE_CONVERSATION_ID) if medicine.is_empty(): failures.append("fortified White Wolf flag should expose White Wolf medicine") if not fortified_scene._camp_conversation_by_id(WHITE_WOLF_CANTEENS_CONVERSATION_ID).is_empty(): failures.append("fortified White Wolf flag should not expose White Wolf canteens") if not medicine.is_empty(): if fortified_scene._format_talk_status_text(fortified_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("White Wolf fortified talk status should show one ready supply") if not fortified_scene._format_camp_conversation_button_text(medicine).contains("Supply Panacea"): failures.append("White Wolf medicine button should show Panacea supply") var before_panacea := int(fortified_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) fortified_scene._apply_camp_conversation_effects(medicine) if int(fortified_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("White Wolf medicine should add Panacea to campaign inventory") if int(fortified_scene.state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("White Wolf medicine should refresh battle Panacea inventory") if not fortified_scene.campaign_state.has_claimed_camp_conversation_effects(WHITE_WOLF_SCENARIO_ID, WHITE_WOLF_MEDICINE_CONVERSATION_ID): failures.append("White Wolf medicine claim should be saved") if fortified_scene._format_talk_status_text(fortified_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("White Wolf fortified talk status should show claimed supply after claim") fortified_scene.free() func _check_liaodong_branch_camp_conversations(failures: Array[String]) -> void: var base_scene = _new_prebattle_scene_for(failures, "Liaodong base camp", LIAODONG_SCENARIO_ID, LIAODONG_SCENARIO_PATH) if base_scene != null: if base_scene._camp_conversation_by_id("liaodong_border_council").is_empty(): failures.append("Liaodong should expose the border council conversation") if base_scene._camp_conversation_by_id("liaodong_zhang_he_border_price").is_empty(): failures.append("Liaodong should expose Zhang He's border price conversation") if not base_scene._camp_conversation_by_id(LIAODONG_HARD_WINE_CONVERSATION_ID).is_empty(): failures.append("Liaodong hard wine should be hidden without pressed Liaodong flag") if not base_scene._camp_conversation_by_id(LIAODONG_GUIDE_MEDICINE_CONVERSATION_ID).is_empty(): failures.append("Liaodong guide medicine should be hidden without secured Wuhuan flag") var merchant: Dictionary = base_scene.state.get_shop_merchant() if str(merchant.get("name", "")) != "Liaodong Border Sutler": failures.append("Liaodong shop merchant name should be present") var merchant_lines: Array = merchant.get("lines", []) if merchant_lines.size() < 2: failures.append("Liaodong shop merchant should expose flavor lines") if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics": failures.append("Liaodong base talk status should summarize two non-supply topics") base_scene.free() var pressed_scene = _new_prebattle_scene_for( failures, "Liaodong pressed camp", LIAODONG_SCENARIO_ID, LIAODONG_SCENARIO_PATH, {"pressed_liaodong_pursuit": true} ) if pressed_scene != null: var hard_wine: Dictionary = pressed_scene._camp_conversation_by_id(LIAODONG_HARD_WINE_CONVERSATION_ID) if hard_wine.is_empty(): failures.append("pressed Liaodong flag should expose Liaodong hard wine") if not pressed_scene._camp_conversation_by_id(LIAODONG_GUIDE_MEDICINE_CONVERSATION_ID).is_empty(): failures.append("pressed Liaodong flag should not expose Liaodong guide medicine") if not hard_wine.is_empty(): if pressed_scene._format_talk_status_text(pressed_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Liaodong pressed talk status should show one ready supply") if not pressed_scene._format_camp_conversation_button_text(hard_wine).contains("Supply Wine"): failures.append("Liaodong hard wine button should show Wine supply") var before_wine := int(pressed_scene.campaign_state.get_inventory_snapshot().get("wine", 0)) pressed_scene._apply_camp_conversation_effects(hard_wine) if int(pressed_scene.campaign_state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1: failures.append("Liaodong hard wine should add Wine to campaign inventory") if int(pressed_scene.state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1: failures.append("Liaodong hard wine should refresh battle Wine inventory") if not pressed_scene.campaign_state.has_claimed_camp_conversation_effects(LIAODONG_SCENARIO_ID, LIAODONG_HARD_WINE_CONVERSATION_ID): failures.append("Liaodong hard wine claim should be saved") if pressed_scene._format_talk_status_text(pressed_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Liaodong pressed talk status should show claimed supply after claim") pressed_scene.free() var secured_scene = _new_prebattle_scene_for( failures, "Liaodong secured camp", LIAODONG_SCENARIO_ID, LIAODONG_SCENARIO_PATH, {"secured_wuhuan_submission": true} ) if secured_scene != null: var guide_medicine: Dictionary = secured_scene._camp_conversation_by_id(LIAODONG_GUIDE_MEDICINE_CONVERSATION_ID) if guide_medicine.is_empty(): failures.append("secured Wuhuan flag should expose Liaodong guide medicine") if not secured_scene._camp_conversation_by_id(LIAODONG_HARD_WINE_CONVERSATION_ID).is_empty(): failures.append("secured Wuhuan flag should not expose Liaodong hard wine") if not guide_medicine.is_empty(): if secured_scene._format_talk_status_text(secured_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Liaodong secured talk status should show one ready supply") if not secured_scene._format_camp_conversation_button_text(guide_medicine).contains("Supply Panacea"): failures.append("Liaodong guide 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(guide_medicine) if int(secured_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Liaodong guide medicine should add Panacea to campaign inventory") if int(secured_scene.state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Liaodong guide medicine should refresh battle Panacea inventory") if not secured_scene.campaign_state.has_claimed_camp_conversation_effects(LIAODONG_SCENARIO_ID, LIAODONG_GUIDE_MEDICINE_CONVERSATION_ID): failures.append("Liaodong guide 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("Liaodong secured talk status should show claimed supply after claim") secured_scene.free() func _check_xinye_branch_camp_conversations(failures: Array[String]) -> void: var base_scene = _new_prebattle_scene_for(failures, "Xinye base camp", XINYE_SCENARIO_ID, XINYE_SCENARIO_PATH) if base_scene != null: if not base_scene.campaign_state.joined_officers.has("zhang_he"): base_scene.campaign_state.joined_officers.append("zhang_he") if not base_scene.state.load_battle( XINYE_SCENARIO_PATH, base_scene.campaign_state.get_roster_overrides(), base_scene.campaign_state.get_inventory_snapshot(), base_scene.campaign_state.get_flags_snapshot(), base_scene.campaign_state.get_joined_officers_snapshot() ): failures.append("Xinye base camp should reload with Zhang He joined") else: if base_scene._camp_conversation_by_id("xinye_southern_war_council").is_empty(): failures.append("Xinye should expose the southern war council conversation") if base_scene._camp_conversation_by_id("xinye_zhang_he_south_road").is_empty(): failures.append("Xinye should expose Zhang He's south road conversation") if not base_scene._camp_conversation_by_id(XINYE_ORDERED_MEDICINE_CONVERSATION_ID).is_empty(): failures.append("Xinye ordered medicine should be hidden without accepted Liaodong flag") if not base_scene._camp_conversation_by_id(XINYE_AUTHORITY_WINE_CONVERSATION_ID).is_empty(): failures.append("Xinye authority wine should be hidden without pressed authority flag") var merchant: Dictionary = base_scene.state.get_shop_merchant() if str(merchant.get("name", "")) != "Xinye Road Sutler": failures.append("Xinye shop merchant name should be present") var merchant_lines: Array = merchant.get("lines", []) if merchant_lines.size() < 2: failures.append("Xinye shop merchant should expose flavor lines") if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics": failures.append("Xinye base talk status should summarize two non-supply topics") base_scene.free() var accepted_scene = _new_prebattle_scene_for( failures, "Xinye accepted Liaodong camp", XINYE_SCENARIO_ID, XINYE_SCENARIO_PATH, {"accepted_liaodong_terms": true} ) if accepted_scene != null: var ordered_medicine: Dictionary = accepted_scene._camp_conversation_by_id(XINYE_ORDERED_MEDICINE_CONVERSATION_ID) if ordered_medicine.is_empty(): failures.append("accepted Liaodong flag should expose Xinye ordered medicine") if not accepted_scene._camp_conversation_by_id(XINYE_AUTHORITY_WINE_CONVERSATION_ID).is_empty(): failures.append("accepted Liaodong flag should not expose Xinye authority wine") if not ordered_medicine.is_empty(): if accepted_scene._format_talk_status_text(accepted_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Xinye accepted talk status should show one ready supply") if not accepted_scene._format_camp_conversation_button_text(ordered_medicine).contains("Supply Panacea"): failures.append("Xinye ordered medicine button should show Panacea supply") var before_panacea := int(accepted_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) accepted_scene._apply_camp_conversation_effects(ordered_medicine) if int(accepted_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Xinye ordered medicine should add Panacea to campaign inventory") if int(accepted_scene.state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Xinye ordered medicine should refresh battle Panacea inventory") if not accepted_scene.campaign_state.has_claimed_camp_conversation_effects(XINYE_SCENARIO_ID, XINYE_ORDERED_MEDICINE_CONVERSATION_ID): failures.append("Xinye ordered medicine claim should be saved") if accepted_scene._format_talk_status_text(accepted_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Xinye accepted talk status should show claimed supply after claim") accepted_scene.free() var authority_scene = _new_prebattle_scene_for( failures, "Xinye pressed authority camp", XINYE_SCENARIO_ID, XINYE_SCENARIO_PATH, {"pressed_liaodong_authority": true} ) if authority_scene != null: var authority_wine: Dictionary = authority_scene._camp_conversation_by_id(XINYE_AUTHORITY_WINE_CONVERSATION_ID) if authority_wine.is_empty(): failures.append("pressed Liaodong authority flag should expose Xinye authority wine") if not authority_scene._camp_conversation_by_id(XINYE_ORDERED_MEDICINE_CONVERSATION_ID).is_empty(): failures.append("pressed Liaodong authority flag should not expose Xinye ordered medicine") if not authority_wine.is_empty(): if authority_scene._format_talk_status_text(authority_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Xinye authority talk status should show one ready supply") if not authority_scene._format_camp_conversation_button_text(authority_wine).contains("Supply Wine"): failures.append("Xinye authority wine button should show Wine supply") var before_wine := int(authority_scene.campaign_state.get_inventory_snapshot().get("wine", 0)) authority_scene._apply_camp_conversation_effects(authority_wine) if int(authority_scene.campaign_state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1: failures.append("Xinye authority wine should add Wine to campaign inventory") if int(authority_scene.state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1: failures.append("Xinye authority wine should refresh battle Wine inventory") if not authority_scene.campaign_state.has_claimed_camp_conversation_effects(XINYE_SCENARIO_ID, XINYE_AUTHORITY_WINE_CONVERSATION_ID): failures.append("Xinye authority wine claim should be saved") if authority_scene._format_talk_status_text(authority_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Xinye authority talk status should show claimed supply after claim") authority_scene.free() func _check_changban_branch_camp_conversations(failures: Array[String]) -> void: var base_scene = _new_prebattle_scene_for(failures, "Changban base camp", CHANGBAN_SCENARIO_ID, CHANGBAN_SCENARIO_PATH) if base_scene != null: if not base_scene.campaign_state.joined_officers.has("zhang_he"): base_scene.campaign_state.joined_officers.append("zhang_he") if not base_scene.state.load_battle( CHANGBAN_SCENARIO_PATH, base_scene.campaign_state.get_roster_overrides(), base_scene.campaign_state.get_inventory_snapshot(), base_scene.campaign_state.get_flags_snapshot(), base_scene.campaign_state.get_joined_officers_snapshot() ): failures.append("Changban base camp should reload with Zhang He joined") else: if base_scene._camp_conversation_by_id("changban_bridge_council").is_empty(): failures.append("Changban should expose the bridge council conversation") if base_scene._camp_conversation_by_id("changban_zhang_he_bridge_shadow").is_empty(): failures.append("Changban should expose Zhang He's bridge shadow conversation") if not base_scene._camp_conversation_by_id(CHANGBAN_VANGUARD_RATIONS_CONVERSATION_ID).is_empty(): failures.append("Changban vanguard rations should be hidden without pressed Xinye flag") if not base_scene._camp_conversation_by_id(CHANGBAN_HAN_MEDICINE_CONVERSATION_ID).is_empty(): failures.append("Changban Han medicine should be hidden without secured Han flag") var merchant: Dictionary = base_scene.state.get_shop_merchant() if str(merchant.get("name", "")) != "Changban Bridge Sutler": failures.append("Changban shop merchant name should be present") var merchant_lines: Array = merchant.get("lines", []) if merchant_lines.size() < 2: failures.append("Changban shop merchant should expose flavor lines") if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics": failures.append("Changban base talk status should summarize two non-supply topics") base_scene.free() var vanguard_scene = _new_prebattle_scene_for( failures, "Changban pressed Xinye camp", CHANGBAN_SCENARIO_ID, CHANGBAN_SCENARIO_PATH, {"pressed_xinye_vanguard": true} ) if vanguard_scene != null: if not vanguard_scene.campaign_state.joined_officers.has("zhang_he"): vanguard_scene.campaign_state.joined_officers.append("zhang_he") if not vanguard_scene.state.load_battle( CHANGBAN_SCENARIO_PATH, vanguard_scene.campaign_state.get_roster_overrides(), vanguard_scene.campaign_state.get_inventory_snapshot(), vanguard_scene.campaign_state.get_flags_snapshot(), vanguard_scene.campaign_state.get_joined_officers_snapshot() ): failures.append("Changban pressed camp should reload with Zhang He joined") else: var vanguard_rations: Dictionary = vanguard_scene._camp_conversation_by_id(CHANGBAN_VANGUARD_RATIONS_CONVERSATION_ID) if vanguard_rations.is_empty(): failures.append("pressed Xinye vanguard flag should expose Changban vanguard rations") if not vanguard_scene._camp_conversation_by_id(CHANGBAN_HAN_MEDICINE_CONVERSATION_ID).is_empty(): failures.append("pressed Xinye vanguard flag should not expose Changban Han medicine") if not vanguard_rations.is_empty(): if vanguard_scene._format_talk_status_text(vanguard_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Changban vanguard talk status should show one ready supply") if not vanguard_scene._format_camp_conversation_button_text(vanguard_rations).contains("Supply Bean"): failures.append("Changban vanguard rations button should show Bean supply") var before_bean := int(vanguard_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) vanguard_scene._apply_camp_conversation_effects(vanguard_rations) if int(vanguard_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Changban vanguard rations should add Bean to campaign inventory") if int(vanguard_scene.state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Changban vanguard rations should refresh battle Bean inventory") if not vanguard_scene.campaign_state.has_claimed_camp_conversation_effects(CHANGBAN_SCENARIO_ID, CHANGBAN_VANGUARD_RATIONS_CONVERSATION_ID): failures.append("Changban vanguard rations claim should be saved") if vanguard_scene._format_talk_status_text(vanguard_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Changban vanguard talk status should show claimed supply after claim") vanguard_scene.free() var supply_scene = _new_prebattle_scene_for( failures, "Changban secured Han camp", CHANGBAN_SCENARIO_ID, CHANGBAN_SCENARIO_PATH, {"secured_han_river_supply": true} ) if supply_scene != null: if not supply_scene.campaign_state.joined_officers.has("zhang_he"): supply_scene.campaign_state.joined_officers.append("zhang_he") if not supply_scene.state.load_battle( CHANGBAN_SCENARIO_PATH, supply_scene.campaign_state.get_roster_overrides(), supply_scene.campaign_state.get_inventory_snapshot(), supply_scene.campaign_state.get_flags_snapshot(), supply_scene.campaign_state.get_joined_officers_snapshot() ): failures.append("Changban secured camp should reload with Zhang He joined") else: var han_medicine: Dictionary = supply_scene._camp_conversation_by_id(CHANGBAN_HAN_MEDICINE_CONVERSATION_ID) if han_medicine.is_empty(): failures.append("secured Han supply flag should expose Changban Han medicine") if not supply_scene._camp_conversation_by_id(CHANGBAN_VANGUARD_RATIONS_CONVERSATION_ID).is_empty(): failures.append("secured Han supply flag should not expose Changban vanguard rations") if not han_medicine.is_empty(): if supply_scene._format_talk_status_text(supply_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Changban secured talk status should show one ready supply") if not supply_scene._format_camp_conversation_button_text(han_medicine).contains("Supply Panacea"): failures.append("Changban Han medicine button should show Panacea supply") var before_panacea := int(supply_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) supply_scene._apply_camp_conversation_effects(han_medicine) if int(supply_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Changban Han medicine should add Panacea to campaign inventory") if int(supply_scene.state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Changban Han medicine should refresh battle Panacea inventory") if not supply_scene.campaign_state.has_claimed_camp_conversation_effects(CHANGBAN_SCENARIO_ID, CHANGBAN_HAN_MEDICINE_CONVERSATION_ID): failures.append("Changban Han medicine claim should be saved") if supply_scene._format_talk_status_text(supply_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Changban secured talk status should show claimed supply after claim") supply_scene.free() func _check_jiangling_branch_camp_conversations(failures: Array[String]) -> void: var base_scene = _new_prebattle_scene_for(failures, "Jiangling base camp", JIANGLING_SCENARIO_ID, JIANGLING_SCENARIO_PATH) if base_scene != null: if not base_scene.campaign_state.joined_officers.has("zhang_he"): base_scene.campaign_state.joined_officers.append("zhang_he") if not base_scene.state.load_battle( JIANGLING_SCENARIO_PATH, base_scene.campaign_state.get_roster_overrides(), base_scene.campaign_state.get_inventory_snapshot(), base_scene.campaign_state.get_flags_snapshot(), base_scene.campaign_state.get_joined_officers_snapshot() ): failures.append("Jiangling base camp should reload with Zhang He joined") else: if base_scene._camp_conversation_by_id("jiangling_storehouse_council").is_empty(): failures.append("Jiangling should expose the storehouse council conversation") if base_scene._camp_conversation_by_id("jiangling_zhang_he_granary_road").is_empty(): failures.append("Jiangling should expose Zhang He's granary road conversation") if not base_scene._camp_conversation_by_id(JIANGLING_FAST_BEANS_CONVERSATION_ID).is_empty(): failures.append("Jiangling fast beans should be hidden without pressed Jiangling flag") if not base_scene._camp_conversation_by_id(JIANGLING_CROSSING_MEDICINE_CONVERSATION_ID).is_empty(): failures.append("Jiangling crossing medicine should be hidden without secured crossings flag") var merchant: Dictionary = base_scene.state.get_shop_merchant() if str(merchant.get("name", "")) != "Jiangling Storehouse Sutler": failures.append("Jiangling shop merchant name should be present") var merchant_lines: Array = merchant.get("lines", []) if merchant_lines.size() < 2: failures.append("Jiangling shop merchant should expose flavor lines") if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics": failures.append("Jiangling base talk status should summarize two non-supply topics") base_scene.free() var chase_scene = _new_prebattle_scene_for( failures, "Jiangling pressed chase camp", JIANGLING_SCENARIO_ID, JIANGLING_SCENARIO_PATH, {"pressed_jiangling_chase": true} ) if chase_scene != null: if not chase_scene.campaign_state.joined_officers.has("zhang_he"): chase_scene.campaign_state.joined_officers.append("zhang_he") if not chase_scene.state.load_battle( JIANGLING_SCENARIO_PATH, chase_scene.campaign_state.get_roster_overrides(), chase_scene.campaign_state.get_inventory_snapshot(), chase_scene.campaign_state.get_flags_snapshot(), chase_scene.campaign_state.get_joined_officers_snapshot() ): failures.append("Jiangling pressed chase camp should reload with Zhang He joined") else: var fast_beans: Dictionary = chase_scene._camp_conversation_by_id(JIANGLING_FAST_BEANS_CONVERSATION_ID) if fast_beans.is_empty(): failures.append("pressed Jiangling chase flag should expose Jiangling fast beans") if not chase_scene._camp_conversation_by_id(JIANGLING_CROSSING_MEDICINE_CONVERSATION_ID).is_empty(): failures.append("pressed Jiangling chase flag should not expose Jiangling crossing medicine") if not fast_beans.is_empty(): if chase_scene._format_talk_status_text(chase_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Jiangling chase talk status should show one ready supply") if not chase_scene._format_camp_conversation_button_text(fast_beans).contains("Supply Bean"): failures.append("Jiangling fast beans button should show Bean supply") var before_bean := int(chase_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) chase_scene._apply_camp_conversation_effects(fast_beans) if int(chase_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Jiangling fast beans should add Bean to campaign inventory") if int(chase_scene.state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Jiangling fast beans should refresh battle Bean inventory") if not chase_scene.campaign_state.has_claimed_camp_conversation_effects(JIANGLING_SCENARIO_ID, JIANGLING_FAST_BEANS_CONVERSATION_ID): failures.append("Jiangling fast beans claim should be saved") if chase_scene._format_talk_status_text(chase_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Jiangling chase talk status should show claimed supply after claim") chase_scene.free() var crossings_scene = _new_prebattle_scene_for( failures, "Jiangling secured crossings camp", JIANGLING_SCENARIO_ID, JIANGLING_SCENARIO_PATH, {"secured_changban_crossings": true} ) if crossings_scene != null: if not crossings_scene.campaign_state.joined_officers.has("zhang_he"): crossings_scene.campaign_state.joined_officers.append("zhang_he") if not crossings_scene.state.load_battle( JIANGLING_SCENARIO_PATH, crossings_scene.campaign_state.get_roster_overrides(), crossings_scene.campaign_state.get_inventory_snapshot(), crossings_scene.campaign_state.get_flags_snapshot(), crossings_scene.campaign_state.get_joined_officers_snapshot() ): failures.append("Jiangling secured crossings camp should reload with Zhang He joined") else: var crossing_medicine: Dictionary = crossings_scene._camp_conversation_by_id(JIANGLING_CROSSING_MEDICINE_CONVERSATION_ID) if crossing_medicine.is_empty(): failures.append("secured Changban crossings flag should expose Jiangling crossing medicine") if not crossings_scene._camp_conversation_by_id(JIANGLING_FAST_BEANS_CONVERSATION_ID).is_empty(): failures.append("secured Changban crossings flag should not expose Jiangling fast beans") if not crossing_medicine.is_empty(): if crossings_scene._format_talk_status_text(crossings_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Jiangling crossings talk status should show one ready supply") if not crossings_scene._format_camp_conversation_button_text(crossing_medicine).contains("Supply Panacea"): failures.append("Jiangling crossing medicine button should show Panacea supply") var before_panacea := int(crossings_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) crossings_scene._apply_camp_conversation_effects(crossing_medicine) if int(crossings_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Jiangling crossing medicine should add Panacea to campaign inventory") if int(crossings_scene.state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Jiangling crossing medicine should refresh battle Panacea inventory") if not crossings_scene.campaign_state.has_claimed_camp_conversation_effects(JIANGLING_SCENARIO_ID, JIANGLING_CROSSING_MEDICINE_CONVERSATION_ID): failures.append("Jiangling crossing medicine claim should be saved") if crossings_scene._format_talk_status_text(crossings_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Jiangling crossings talk status should show claimed supply after claim") crossings_scene.free() func _check_xiakou_branch_camp_conversations(failures: Array[String]) -> void: var base_scene = _new_prebattle_scene_for(failures, "Xiakou base camp", XIAKOU_SCENARIO_ID, XIAKOU_SCENARIO_PATH) if base_scene != null: if not base_scene.campaign_state.joined_officers.has("zhang_he"): base_scene.campaign_state.joined_officers.append("zhang_he") if not base_scene.state.load_battle( XIAKOU_SCENARIO_PATH, base_scene.campaign_state.get_roster_overrides(), base_scene.campaign_state.get_inventory_snapshot(), base_scene.campaign_state.get_flags_snapshot(), base_scene.campaign_state.get_joined_officers_snapshot() ): failures.append("Xiakou base camp should reload with Zhang He joined") else: if base_scene._camp_conversation_by_id("xiakou_harbor_council").is_empty(): failures.append("Xiakou should expose the harbor council conversation") if base_scene._camp_conversation_by_id("xiakou_zhang_he_river_mouth").is_empty(): failures.append("Xiakou should expose Zhang He's river mouth conversation") if not base_scene._camp_conversation_by_id(XIAKOU_ENVOY_BEANS_CONVERSATION_ID).is_empty(): failures.append("Xiakou envoy beans should be hidden without pressed Xiakou flag") if not base_scene._camp_conversation_by_id(XIAKOU_STOREHOUSE_MEDICINE_CONVERSATION_ID).is_empty(): failures.append("Xiakou storehouse medicine should be hidden without secured Jiangling flag") var merchant: Dictionary = base_scene.state.get_shop_merchant() if str(merchant.get("name", "")) != "Xiakou Harbor Sutler": failures.append("Xiakou shop merchant name should be present") var merchant_lines: Array = merchant.get("lines", []) if merchant_lines.size() < 2: failures.append("Xiakou shop merchant should expose flavor lines") if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics": failures.append("Xiakou base talk status should summarize two non-supply topics") base_scene.free() var pursuit_scene = _new_prebattle_scene_for( failures, "Xiakou pressed pursuit camp", XIAKOU_SCENARIO_ID, XIAKOU_SCENARIO_PATH, {"pressed_xiakou_pursuit": true} ) if pursuit_scene != null: if not pursuit_scene.campaign_state.joined_officers.has("zhang_he"): pursuit_scene.campaign_state.joined_officers.append("zhang_he") if not pursuit_scene.state.load_battle( XIAKOU_SCENARIO_PATH, pursuit_scene.campaign_state.get_roster_overrides(), pursuit_scene.campaign_state.get_inventory_snapshot(), pursuit_scene.campaign_state.get_flags_snapshot(), pursuit_scene.campaign_state.get_joined_officers_snapshot() ): failures.append("Xiakou pressed pursuit camp should reload with Zhang He joined") else: var envoy_beans: Dictionary = pursuit_scene._camp_conversation_by_id(XIAKOU_ENVOY_BEANS_CONVERSATION_ID) if envoy_beans.is_empty(): failures.append("pressed Xiakou pursuit flag should expose Xiakou envoy beans") if not pursuit_scene._camp_conversation_by_id(XIAKOU_STOREHOUSE_MEDICINE_CONVERSATION_ID).is_empty(): failures.append("pressed Xiakou pursuit flag should not expose Xiakou storehouse medicine") if not envoy_beans.is_empty(): if pursuit_scene._format_talk_status_text(pursuit_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Xiakou pursuit talk status should show one ready supply") if not pursuit_scene._format_camp_conversation_button_text(envoy_beans).contains("Supply Bean"): failures.append("Xiakou envoy beans button should show Bean supply") var before_bean := int(pursuit_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) pursuit_scene._apply_camp_conversation_effects(envoy_beans) if int(pursuit_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Xiakou envoy beans should add Bean to campaign inventory") if int(pursuit_scene.state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1: failures.append("Xiakou envoy beans should refresh battle Bean inventory") if not pursuit_scene.campaign_state.has_claimed_camp_conversation_effects(XIAKOU_SCENARIO_ID, XIAKOU_ENVOY_BEANS_CONVERSATION_ID): failures.append("Xiakou envoy beans claim should be saved") if pursuit_scene._format_talk_status_text(pursuit_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Xiakou pursuit talk status should show claimed supply after claim") pursuit_scene.free() var storehouse_scene = _new_prebattle_scene_for( failures, "Xiakou secured Jiangling camp", XIAKOU_SCENARIO_ID, XIAKOU_SCENARIO_PATH, {"secured_jiangling_storehouses": true} ) if storehouse_scene != null: if not storehouse_scene.campaign_state.joined_officers.has("zhang_he"): storehouse_scene.campaign_state.joined_officers.append("zhang_he") if not storehouse_scene.state.load_battle( XIAKOU_SCENARIO_PATH, storehouse_scene.campaign_state.get_roster_overrides(), storehouse_scene.campaign_state.get_inventory_snapshot(), storehouse_scene.campaign_state.get_flags_snapshot(), storehouse_scene.campaign_state.get_joined_officers_snapshot() ): failures.append("Xiakou secured Jiangling camp should reload with Zhang He joined") else: var storehouse_medicine: Dictionary = storehouse_scene._camp_conversation_by_id(XIAKOU_STOREHOUSE_MEDICINE_CONVERSATION_ID) if storehouse_medicine.is_empty(): failures.append("secured Jiangling storehouses flag should expose Xiakou storehouse medicine") if not storehouse_scene._camp_conversation_by_id(XIAKOU_ENVOY_BEANS_CONVERSATION_ID).is_empty(): failures.append("secured Jiangling storehouses flag should not expose Xiakou envoy beans") if not storehouse_medicine.is_empty(): if storehouse_scene._format_talk_status_text(storehouse_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready": failures.append("Xiakou storehouse talk status should show one ready supply") if not storehouse_scene._format_camp_conversation_button_text(storehouse_medicine).contains("Supply Panacea"): failures.append("Xiakou storehouse medicine button should show Panacea supply") var before_panacea := int(storehouse_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) storehouse_scene._apply_camp_conversation_effects(storehouse_medicine) if int(storehouse_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Xiakou storehouse medicine should add Panacea to campaign inventory") if int(storehouse_scene.state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1: failures.append("Xiakou storehouse medicine should refresh battle Panacea inventory") if not storehouse_scene.campaign_state.has_claimed_camp_conversation_effects(XIAKOU_SCENARIO_ID, XIAKOU_STOREHOUSE_MEDICINE_CONVERSATION_ID): failures.append("Xiakou storehouse medicine claim should be saved") if storehouse_scene._format_talk_status_text(storehouse_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed": failures.append("Xiakou storehouse talk status should show claimed supply after claim") storehouse_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: return scene._create_hud() scene.briefing_panel.visible = true scene.talk_menu.visible = true var cancel_event := InputEventKey.new() cancel_event.keycode = KEY_ESCAPE scene._handle_key(cancel_event) if scene.talk_menu.visible: failures.append("Escape should close the pre-battle talk menu") scene.talk_menu.visible = true scene._reload_from_campaign_state() if scene.talk_menu.visible: failures.append("campaign reload should hide the pre-battle talk menu") scene.free() func _new_prebattle_scene(failures: Array[String], label: String): return _new_prebattle_scene_for(failures, label, SCENARIO_ID, SCENARIO_PATH) func _new_prebattle_scene_for(failures: Array[String], label: String, scenario_id: String, scenario_path: String, flag_overrides := {}): var scene = BattleSceneScript.new() if not scene.campaign_state.load_campaign(CAMPAIGN_PATH): failures.append("%s could not load campaign data" % label) scene.free() return null scene.campaign_state.start_new(scenario_id) if typeof(flag_overrides) == TYPE_DICTIONARY: for flag_name in flag_overrides.keys(): scene.campaign_state.flags[str(flag_name)] = flag_overrides[flag_name] scene.active_scenario_id = scenario_id if not scene.state.load_battle( 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("%s could not load scenario" % label) scene.free() return null return scene func _check_cache_conversation(failures: Array[String], conversation: Dictionary) -> bool: if conversation.is_empty(): failures.append("could not find cache camp conversation") return false var effects: Array = conversation.get("effects", []) if effects.is_empty(): failures.append("cache camp conversation should expose effects") return false var effect: Dictionary = effects[0] if str(effect.get("type", "")) != "grant_item": failures.append("cache camp conversation effect should be grant_item") if str(effect.get("item_id", "")) != "bean": failures.append("cache camp conversation should grant Bean") if int(effect.get("count", 0)) != 1: failures.append("cache camp conversation should grant one Bean") return true func _backup_user_file(path: String) -> Dictionary: var exists := FileAccess.file_exists(path) return { "exists": exists, "content": FileAccess.get_file_as_string(path) if exists else "" } func _restore_user_file(path: String, backup: Dictionary) -> bool: if bool(backup.get("exists", false)): var file := FileAccess.open(path, FileAccess.WRITE) if file == null: return false file.store_string(str(backup.get("content", ""))) return true if FileAccess.file_exists(path): return DirAccess.remove_absolute(ProjectSettings.globalize_path(path)) == OK return true