From ffdaff5110491b027a44dd5f52c6518ea15a179d Mon Sep 17 00:00:00 2001 From: Wickedness Date: Fri, 19 Jun 2026 03:01:35 +0900 Subject: [PATCH] Add White Wolf camp and Liaodong bridge --- data/scenarios/023_white_wolf_mountain.json | 62 ++++++- data/scenarios/024_liaodong_pursuit.json | 2 +- tools/smoke_camp_conversation_rewards.gd | 180 ++++++++++++++++++++ tools/smoke_visual_assets.gd | 95 +++++++++++ 4 files changed, 337 insertions(+), 2 deletions(-) diff --git a/data/scenarios/023_white_wolf_mountain.json b/data/scenarios/023_white_wolf_mountain.json index cabe99c..df61b75 100644 --- a/data/scenarios/023_white_wolf_mountain.json +++ b/data/scenarios/023_white_wolf_mountain.json @@ -32,6 +32,59 @@ "The fortified White Wolf road keeps supplies close behind the army, giving Cao Cao room to force the hills methodically." ] } + ], + "camp_conversations": [ + { + "id": "white_wolf_ridge_council", + "group": "topic", + "label": "Ridge Council", + "speaker": "Cao Cao", + "summary": "Read the riders' camp before the White Wolf ridge becomes a full frontier host.", + "lines": [ + { "speaker": "Cao Cao", "side": "left", "text": "The mountain gives riders wind, height, and pride. We will take the road that makes all three useless." }, + { "speaker": "Guo Jia", "side": "right", "text": "The Yuan brothers have borrowed a shield that does not know their weight yet. Strike before it learns." }, + { "speaker": "Zhang He", "side": "right", "text": "The Wuhuan chief watches the open slope. His camp trusts speed more than sentries." } + ] + }, + { + "id": "white_wolf_zhang_he_ridge_wind", + "group": "officer", + "officer_id": "zhang_he", + "label": "Zhang He - Ridge Wind", + "summary": "Use Zhang He's reading of the ridge paths before the riders charge.", + "lines": [ + { "speaker": "Zhang He", "side": "right", "text": "Riders climb poorly when the path narrows. Send infantry to the saddle and they must fight as men, not as horses." }, + { "speaker": "Cao Cao", "side": "left", "text": "Then make the mountain choose our formation." } + ] + }, + { + "id": "white_wolf_scattered_canteens", + "group": "topic", + "label": "Scattered Canteens", + "summary": "The early blow against the Wuhuan vanguard leaves captured canteens for the field stores.", + "campaign_flags": { "struck_wuhuan_vanguard": true }, + "effects": [ + { "type": "grant_item", "item_id": "wine", "count": 1, "text": "The scattered Wuhuan canteens add a Wine to the field supplies." } + ], + "lines": [ + { "speaker": "Xiahou Dun", "side": "left", "text": "The forward riders abandoned skins of frontier liquor when they scattered. Strong enough to wake a dead banner." }, + { "speaker": "Cao Cao", "side": "right", "text": "Good. Let one tired unit remember why it climbed." } + ] + }, + { + "id": "white_wolf_route_medicine", + "group": "topic", + "label": "Route Medicine", + "summary": "The fortified White Wolf road keeps frontier medicine close to the ridge.", + "campaign_flags": { "fortified_white_wolf_route": true }, + "effects": [ + { "type": "grant_item", "item_id": "panacea", "count": 1, "text": "The White Wolf route medicine adds a Panacea to the field supplies." } + ], + "lines": [ + { "speaker": "Cao Ren", "side": "left", "text": "The rear road is held. The medicine carts can reach the ridge before the riders circle back." }, + { "speaker": "Cao Cao", "side": "right", "text": "A quiet rear is worth another line of shields." } + ] + } ] }, "shop": { @@ -55,7 +108,14 @@ "campaign_flags": { "fortified_white_wolf_route": true }, "items": ["imperial_seal"] } - ] + ], + "merchant": { + "name": "White Wolf Ridge Sutler", + "lines": [ + "Mountain roads make poor shops, my lord. Every jar that reached this ridge has earned its price.", + "Buy before the Wuhuan riders decide bargaining is slower than arrows." + ] + } }, "roster": { "max_units": 7, diff --git a/data/scenarios/024_liaodong_pursuit.json b/data/scenarios/024_liaodong_pursuit.json index 1ef66e4..3df6552 100644 --- a/data/scenarios/024_liaodong_pursuit.json +++ b/data/scenarios/024_liaodong_pursuit.json @@ -59,7 +59,7 @@ }, "roster": { "max_units": 7, - "required_officers": ["cao_cao", "guo_jia"] + "required_officers": ["cao_cao", "guo_jia", "zhang_he"] }, "formation": { "cells": [[1, 3], [1, 4], [1, 5], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6]] diff --git a/tools/smoke_camp_conversation_rewards.gd b/tools/smoke_camp_conversation_rewards.gd index fef7d07..c3331bf 100644 --- a/tools/smoke_camp_conversation_rewards.gd +++ b/tools/smoke_camp_conversation_rewards.gd @@ -86,6 +86,10 @@ 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 SAVE_PATH := "user://campaign_save.json" const MANUAL_SAVE_PATH := "user://campaign_manual_save.json" @@ -117,6 +121,7 @@ func _init() -> void: _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_manual_checkpoint_reverts_claim(failures) _check_completed_replay_cannot_claim(failures) _check_conditional_camp_conversations(failures) @@ -131,6 +136,7 @@ func _init() -> void: _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_talk_menu_closes_on_cancel_and_reload(failures) if not _restore_user_file(SAVE_PATH, save_backup): @@ -1199,6 +1205,25 @@ func _check_liaoxi_post_battle_choice_bridges_to_white_wolf(failures: Array[Stri ) +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_wuchao_choice_branch_to_cangting( failures: Array[String], choice_id: String, @@ -1929,6 +1954,79 @@ func _check_liaoxi_choice_branch_to_white_wolf( 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 _find_choice_by_id(choices, choice_id: String) -> Dictionary: if typeof(choices) != TYPE_ARRAY: return {} @@ -2932,6 +3030,88 @@ func _check_liaoxi_branch_camp_conversations(failures: Array[String]) -> void: 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_talk_menu_closes_on_cancel_and_reload(failures: Array[String]) -> void: var scene = _new_prebattle_scene(failures, "talk menu close guards") if scene == null: diff --git a/tools/smoke_visual_assets.gd b/tools/smoke_visual_assets.gd index ce910e7..43aa654 100644 --- a/tools/smoke_visual_assets.gd +++ b/tools/smoke_visual_assets.gd @@ -1429,8 +1429,103 @@ func _check_battle_visual_data(failures: Array[String]) -> void: if not white_wolf_state.load_battle("res://data/scenarios/023_white_wolf_mountain.json", {}, {}, {}, ["zhang_he"]): failures.append("could not load White Wolf Mountain data") else: + _check_shop_items_unique(failures, white_wolf_state, "023 base") + var white_wolf_conversations: Array = white_wolf_state.get_briefing().get("camp_conversations", []) + if white_wolf_conversations.size() != 2: + failures.append("023 base briefing should expose exactly two camp conversations") + else: + _check_camp_conversation(failures, white_wolf_conversations[0], "white_wolf_ridge_council", "topic", "") + _check_camp_conversation(failures, white_wolf_conversations[1], "white_wolf_zhang_he_ridge_wind", "officer", "zhang_he") + var white_wolf_merchant := white_wolf_state.get_shop_merchant() + if str(white_wolf_merchant.get("name", "")) != "White Wolf Ridge Sutler": + failures.append("023 shop should expose White Wolf Ridge merchant name") + if (white_wolf_merchant.get("lines", []) as Array).size() < 2: + failures.append("023 shop should expose merchant flavor lines") if white_wolf_state.get_unit("zhang_he_ch23").is_empty() or not white_wolf_state.is_required_deployment("zhang_he_ch23"): failures.append("023 should deploy Zhang He as a required officer") + _check_shop_item_visibility(failures, white_wolf_state, "war_drum", false, "023 base") + _check_shop_item_visibility(failures, white_wolf_state, "imperial_seal", false, "023 base") + _check_shop_item_visibility(failures, white_wolf_state, "iron_armor", true, "023 base") + + var white_wolf_struck_state = BattleStateScript.new() + if not white_wolf_struck_state.load_battle("res://data/scenarios/023_white_wolf_mountain.json", {}, {}, {"struck_wuhuan_vanguard": true}, ["zhang_he"]): + failures.append("could not load White Wolf struck vanguard camp data") + else: + _check_shop_items_unique(failures, white_wolf_struck_state, "023 struck Wuhuan") + var canteens: Dictionary = _find_camp_conversation( + white_wolf_struck_state.get_briefing().get("camp_conversations", []), + "white_wolf_scattered_canteens" + ) + if canteens.is_empty(): + failures.append("023 struck Wuhuan flag should expose scattered canteens") + else: + _check_camp_conversation_effect(failures, canteens, "wine", 1) + if not _find_camp_conversation( + white_wolf_struck_state.get_briefing().get("camp_conversations", []), + "white_wolf_route_medicine" + ).is_empty(): + failures.append("023 struck Wuhuan flag should not expose route medicine") + _check_shop_item_visibility(failures, white_wolf_struck_state, "war_drum", true, "023 struck Wuhuan") + _check_shop_item_visibility(failures, white_wolf_struck_state, "imperial_seal", false, "023 struck Wuhuan") + + var white_wolf_fortified_state = BattleStateScript.new() + if not white_wolf_fortified_state.load_battle("res://data/scenarios/023_white_wolf_mountain.json", {}, {}, {"fortified_white_wolf_route": true}, ["zhang_he"]): + failures.append("could not load White Wolf fortified route camp data") + else: + _check_shop_items_unique(failures, white_wolf_fortified_state, "023 fortified White Wolf") + var route_medicine: Dictionary = _find_camp_conversation( + white_wolf_fortified_state.get_briefing().get("camp_conversations", []), + "white_wolf_route_medicine" + ) + if route_medicine.is_empty(): + failures.append("023 fortified White Wolf flag should expose route medicine") + else: + _check_camp_conversation_effect(failures, route_medicine, "panacea", 1) + if not _find_camp_conversation( + white_wolf_fortified_state.get_briefing().get("camp_conversations", []), + "white_wolf_scattered_canteens" + ).is_empty(): + failures.append("023 fortified White Wolf flag should not expose scattered canteens") + _check_shop_item_visibility(failures, white_wolf_fortified_state, "war_drum", false, "023 fortified White Wolf") + _check_shop_item_visibility(failures, white_wolf_fortified_state, "imperial_seal", true, "023 fortified White Wolf") + + var white_wolf_old_flags_state = BattleStateScript.new() + if not white_wolf_old_flags_state.load_battle("res://data/scenarios/023_white_wolf_mountain.json", {}, {}, {"pressed_liaoxi_pursuit": true, "secured_liaoxi_approaches": true}, ["zhang_he"]): + failures.append("could not load White Wolf old Liaoxi flag camp data") + else: + _check_shop_item_visibility(failures, white_wolf_old_flags_state, "war_drum", false, "023 old Liaoxi flags") + _check_shop_item_visibility(failures, white_wolf_old_flags_state, "imperial_seal", false, "023 old Liaoxi flags") + if not _find_camp_conversation( + white_wolf_old_flags_state.get_briefing().get("camp_conversations", []), + "white_wolf_scattered_canteens" + ).is_empty(): + failures.append("023 old Liaoxi flags should not expose scattered canteens") + if not _find_camp_conversation( + white_wolf_old_flags_state.get_briefing().get("camp_conversations", []), + "white_wolf_route_medicine" + ).is_empty(): + failures.append("023 old Liaoxi flags should not expose route medicine") + + var liaodong_state = BattleStateScript.new() + if not liaodong_state.load_battle("res://data/scenarios/024_liaodong_pursuit.json", {}, {}, {}, ["zhang_he"]): + failures.append("could not load Liaodong Pursuit data") + else: + if liaodong_state.get_unit("zhang_he_ch24").is_empty() or not liaodong_state.is_required_deployment("zhang_he_ch24"): + failures.append("024 should deploy Zhang He as a required officer") + + var liaodong_pressed_state = BattleStateScript.new() + if not liaodong_pressed_state.load_battle("res://data/scenarios/024_liaodong_pursuit.json", {}, {}, {"pressed_liaodong_pursuit": true}, ["zhang_he"]): + failures.append("could not load Liaodong pressed pursuit data") + else: + _check_shop_item_visibility(failures, liaodong_pressed_state, "war_drum", true, "024 pressed Liaodong") + _check_shop_item_visibility(failures, liaodong_pressed_state, "imperial_seal", false, "024 pressed Liaodong") + + var liaodong_secured_state = BattleStateScript.new() + if not liaodong_secured_state.load_battle("res://data/scenarios/024_liaodong_pursuit.json", {}, {}, {"secured_wuhuan_submission": true}, ["zhang_he"]): + failures.append("could not load Liaodong secured Wuhuan data") + else: + _check_shop_item_visibility(failures, liaodong_secured_state, "war_drum", false, "024 secured Wuhuan") + _check_shop_item_visibility(failures, liaodong_secured_state, "imperial_seal", true, "024 secured Wuhuan") for item_id in ["bronze_sword", "training_spear", "short_bow", "hand_axe", "iron_armor", "panacea"]: var item := state.get_item_def(item_id)