diff --git a/data/scenarios/025_xinye_advance.json b/data/scenarios/025_xinye_advance.json index 5dae2b2..834d80d 100644 --- a/data/scenarios/025_xinye_advance.json +++ b/data/scenarios/025_xinye_advance.json @@ -32,6 +32,59 @@ "Cao Cao's hard pressure on Liaodong has traveled ahead of him. Jing officers now know delay may be answered by force." ] } + ], + "camp_conversations": [ + { + "id": "xinye_southern_war_council", + "group": "topic", + "label": "Southern War Council", + "speaker": "Cao Cao", + "summary": "Set the first southern order as Xinye tests Cao Cao's road into Jing Province.", + "lines": [ + { "speaker": "Cao Cao", "side": "left", "text": "The north has stopped burning behind us. Now the south must decide whether order reaches it as a seal or a blade." }, + { "speaker": "Guo Jia", "side": "right", "text": "Xinye will not judge our seal by its ink. It will judge by how quickly Liu Bei's rearguard loses the road." }, + { "speaker": "Zhang He", "side": "right", "text": "They defend hours more than ground. That makes each plank and ford more expensive than a wall." } + ] + }, + { + "id": "xinye_zhang_he_south_road", + "group": "officer", + "officer_id": "zhang_he", + "label": "Zhang He - South Road", + "summary": "Hear Zhang He's reading of Liu Bei's delay line before the Xinye crossing.", + "lines": [ + { "speaker": "Zhang He", "side": "right", "text": "Liu Bei's men are not anchored. They are measuring how much fear can be carried south before we reach Changban." }, + { "speaker": "Cao Cao", "side": "left", "text": "Then break the measure at Xinye." } + ] + }, + { + "id": "xinye_ordered_medicine", + "group": "topic", + "label": "Orderly Medicine", + "summary": "Quiet northern commanderies send clean field medicine into the Xinye march.", + "campaign_flags": { "accepted_liaodong_terms": true }, + "effects": [ + { "type": "grant_item", "item_id": "panacea", "count": 1, "text": "The ordered northern wagons add a Panacea to the field supplies." } + ], + "lines": [ + { "speaker": "Cao Ren", "side": "left", "text": "The Liaodong settlement kept the northern wagons in order. Their medicine chests reached the Xinye road unopened." }, + { "speaker": "Cao Cao", "side": "right", "text": "Good. A quiet rear is worth more than another shout at the front." } + ] + }, + { + "id": "xinye_authority_wine", + "group": "topic", + "label": "Authority Wine", + "summary": "The hard Liaodong reputation brings a harsh wine for the forward column.", + "campaign_flags": { "pressed_liaodong_authority": true }, + "effects": [ + { "type": "grant_item", "item_id": "wine", "count": 1, "text": "The authority wine adds a Wine to the field supplies." } + ], + "lines": [ + { "speaker": "Xiahou Dun", "side": "left", "text": "The men heard Liaodong bent after pressure. They kept a hard jar for the first southern gate that mistakes patience for weakness." }, + { "speaker": "Cao Cao", "side": "right", "text": "Let it warm the column, not loosen it." } + ] + } ] }, "shop": { @@ -55,7 +108,14 @@ "campaign_flags": { "pressed_liaodong_authority": true }, "items": ["war_drum"] } - ] + ], + "merchant": { + "name": "Xinye Road Sutler", + "lines": [ + "Xinye sells rumor at every ford, my lord. I sell things with more reliable weight.", + "Buy before Liu Bei's rearguard turns the south road into a toll gate." + ] + } }, "roster": { "max_units": 7, diff --git a/data/scenarios/026_changban_pursuit.json b/data/scenarios/026_changban_pursuit.json index e95c4c7..4c07414 100644 --- a/data/scenarios/026_changban_pursuit.json +++ b/data/scenarios/026_changban_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 2aed53f..960dea1 100644 --- a/tools/smoke_camp_conversation_rewards.gd +++ b/tools/smoke_camp_conversation_rewards.gd @@ -94,6 +94,10 @@ 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 SAVE_PATH := "user://campaign_save.json" const MANUAL_SAVE_PATH := "user://campaign_manual_save.json" @@ -127,6 +131,7 @@ func _init() -> void: _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_manual_checkpoint_reverts_claim(failures) _check_completed_replay_cannot_claim(failures) _check_conditional_camp_conversations(failures) @@ -143,6 +148,7 @@ func _init() -> void: _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_talk_menu_closes_on_cancel_and_reload(failures) if not _restore_user_file(SAVE_PATH, save_backup): @@ -1249,6 +1255,25 @@ func _check_liaodong_post_battle_choice_bridges_to_xinye(failures: Array[String] ) +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_wuchao_choice_branch_to_cangting( failures: Array[String], choice_id: String, @@ -2125,6 +2150,79 @@ func _check_liaodong_choice_branch_to_xinye( 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 _find_choice_by_id(choices, choice_id: String) -> Dictionary: if typeof(choices) != TYPE_ARRAY: return {} @@ -3292,6 +3390,99 @@ func _check_liaodong_branch_camp_conversations(failures: Array[String]) -> void: 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_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 73dcef6..61d5a36 100644 --- a/tools/smoke_visual_assets.gd +++ b/tools/smoke_visual_assets.gd @@ -1592,6 +1592,17 @@ func _check_battle_visual_data(failures: Array[String]) -> void: failures.append("could not load Xinye Advance data") else: _check_shop_items_unique(failures, xinye_state, "025 base") + var xinye_conversations: Array = xinye_state.get_briefing().get("camp_conversations", []) + if xinye_conversations.size() != 2: + failures.append("025 base briefing should expose exactly two camp conversations") + else: + _check_camp_conversation(failures, xinye_conversations[0], "xinye_southern_war_council", "topic", "") + _check_camp_conversation(failures, xinye_conversations[1], "xinye_zhang_he_south_road", "officer", "zhang_he") + var xinye_merchant := xinye_state.get_shop_merchant() + if str(xinye_merchant.get("name", "")) != "Xinye Road Sutler": + failures.append("025 shop should expose Xinye Road merchant name") + if (xinye_merchant.get("lines", []) as Array).size() < 2: + failures.append("025 shop should expose merchant flavor lines") if xinye_state.get_unit("zhang_he_ch25").is_empty() or not xinye_state.is_required_deployment("zhang_he_ch25"): failures.append("025 should deploy Zhang He as a required officer") _check_shop_item_visibility(failures, xinye_state, "war_drum", false, "025 base") @@ -1601,6 +1612,19 @@ func _check_battle_visual_data(failures: Array[String]) -> void: if not xinye_terms_state.load_battle("res://data/scenarios/025_xinye_advance.json", {}, {}, {"accepted_liaodong_terms": true}, ["zhang_he"]): failures.append("could not load Xinye accepted Liaodong terms data") else: + var ordered_medicine: Dictionary = _find_camp_conversation( + xinye_terms_state.get_briefing().get("camp_conversations", []), + "xinye_ordered_medicine" + ) + if ordered_medicine.is_empty(): + failures.append("025 accepted Liaodong terms should expose ordered medicine") + else: + _check_camp_conversation_effect(failures, ordered_medicine, "panacea", 1) + if not _find_camp_conversation( + xinye_terms_state.get_briefing().get("camp_conversations", []), + "xinye_authority_wine" + ).is_empty(): + failures.append("025 accepted Liaodong terms should not expose authority wine") _check_shop_item_visibility(failures, xinye_terms_state, "imperial_seal", true, "025 accepted Liaodong terms") _check_shop_item_visibility(failures, xinye_terms_state, "war_drum", false, "025 accepted Liaodong terms") @@ -1608,6 +1632,19 @@ func _check_battle_visual_data(failures: Array[String]) -> void: if not xinye_authority_state.load_battle("res://data/scenarios/025_xinye_advance.json", {}, {}, {"pressed_liaodong_authority": true}, ["zhang_he"]): failures.append("could not load Xinye pressed Liaodong authority data") else: + var authority_wine: Dictionary = _find_camp_conversation( + xinye_authority_state.get_briefing().get("camp_conversations", []), + "xinye_authority_wine" + ) + if authority_wine.is_empty(): + failures.append("025 pressed Liaodong authority should expose authority wine") + else: + _check_camp_conversation_effect(failures, authority_wine, "wine", 1) + if not _find_camp_conversation( + xinye_authority_state.get_briefing().get("camp_conversations", []), + "xinye_ordered_medicine" + ).is_empty(): + failures.append("025 pressed Liaodong authority should not expose ordered medicine") _check_shop_item_visibility(failures, xinye_authority_state, "war_drum", true, "025 pressed Liaodong authority") _check_shop_item_visibility(failures, xinye_authority_state, "imperial_seal", false, "025 pressed Liaodong authority") @@ -1618,6 +1655,48 @@ func _check_battle_visual_data(failures: Array[String]) -> void: _check_shop_items_unique(failures, xinye_old_flags_state, "025 old Liaodong Pursuit flags") _check_shop_item_visibility(failures, xinye_old_flags_state, "war_drum", false, "025 old Liaodong Pursuit flags") _check_shop_item_visibility(failures, xinye_old_flags_state, "imperial_seal", false, "025 old Liaodong Pursuit flags") + if not _find_camp_conversation( + xinye_old_flags_state.get_briefing().get("camp_conversations", []), + "xinye_ordered_medicine" + ).is_empty(): + failures.append("025 old Liaodong Pursuit flags should not expose ordered medicine") + if not _find_camp_conversation( + xinye_old_flags_state.get_briefing().get("camp_conversations", []), + "xinye_authority_wine" + ).is_empty(): + failures.append("025 old Liaodong Pursuit flags should not expose authority wine") + + var changban_state = BattleStateScript.new() + if not changban_state.load_battle("res://data/scenarios/026_changban_pursuit.json", {}, {}, {}, ["zhang_he"]): + failures.append("could not load Changban Pursuit data") + else: + _check_shop_items_unique(failures, changban_state, "026 base") + if changban_state.get_unit("zhang_he_ch26").is_empty() or not changban_state.is_required_deployment("zhang_he_ch26"): + failures.append("026 should deploy Zhang He as a required officer") + _check_shop_item_visibility(failures, changban_state, "war_drum", false, "026 base") + _check_shop_item_visibility(failures, changban_state, "imperial_seal", false, "026 base") + + var changban_vanguard_state = BattleStateScript.new() + if not changban_vanguard_state.load_battle("res://data/scenarios/026_changban_pursuit.json", {}, {}, {"pressed_xinye_vanguard": true}, ["zhang_he"]): + failures.append("could not load Changban pressed Xinye vanguard data") + else: + _check_shop_item_visibility(failures, changban_vanguard_state, "war_drum", true, "026 pressed Xinye vanguard") + _check_shop_item_visibility(failures, changban_vanguard_state, "imperial_seal", false, "026 pressed Xinye vanguard") + + var changban_supply_state = BattleStateScript.new() + if not changban_supply_state.load_battle("res://data/scenarios/026_changban_pursuit.json", {}, {}, {"secured_han_river_supply": true}, ["zhang_he"]): + failures.append("could not load Changban secured Han supply data") + else: + _check_shop_item_visibility(failures, changban_supply_state, "imperial_seal", true, "026 secured Han supply") + _check_shop_item_visibility(failures, changban_supply_state, "war_drum", false, "026 secured Han supply") + + var changban_old_flags_state = BattleStateScript.new() + if not changban_old_flags_state.load_battle("res://data/scenarios/026_changban_pursuit.json", {}, {}, {"accepted_liaodong_terms": true, "pressed_liaodong_authority": true}, ["zhang_he"]): + failures.append("could not load Changban old Xinye setup flag data") + else: + _check_shop_items_unique(failures, changban_old_flags_state, "026 old Xinye setup flags") + _check_shop_item_visibility(failures, changban_old_flags_state, "war_drum", false, "026 old Xinye setup flags") + _check_shop_item_visibility(failures, changban_old_flags_state, "imperial_seal", false, "026 old Xinye setup flags") for item_id in ["bronze_sword", "training_spear", "short_bow", "hand_axe", "iron_armor", "panacea"]: var item := state.get_item_def(item_id)