Add Liaodong camp and Xinye bridge
This commit is contained in:
@@ -90,6 +90,10 @@ 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 SAVE_PATH := "user://campaign_save.json"
|
||||
const MANUAL_SAVE_PATH := "user://campaign_manual_save.json"
|
||||
|
||||
@@ -122,6 +126,7 @@ func _init() -> void:
|
||||
_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_manual_checkpoint_reverts_claim(failures)
|
||||
_check_completed_replay_cannot_claim(failures)
|
||||
_check_conditional_camp_conversations(failures)
|
||||
@@ -137,6 +142,7 @@ func _init() -> void:
|
||||
_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_talk_menu_closes_on_cancel_and_reload(failures)
|
||||
|
||||
if not _restore_user_file(SAVE_PATH, save_backup):
|
||||
@@ -1224,6 +1230,25 @@ func _check_white_wolf_post_battle_choice_bridges_to_liaodong(failures: Array[St
|
||||
)
|
||||
|
||||
|
||||
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_wuchao_choice_branch_to_cangting(
|
||||
failures: Array[String],
|
||||
choice_id: String,
|
||||
@@ -2027,6 +2052,79 @@ func _check_white_wolf_choice_branch_to_liaodong(
|
||||
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 _find_choice_by_id(choices, choice_id: String) -> Dictionary:
|
||||
if typeof(choices) != TYPE_ARRAY:
|
||||
return {}
|
||||
@@ -3112,6 +3210,88 @@ func _check_white_wolf_branch_camp_conversations(failures: Array[String]) -> voi
|
||||
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_talk_menu_closes_on_cancel_and_reload(failures: Array[String]) -> void:
|
||||
var scene = _new_prebattle_scene(failures, "talk menu close guards")
|
||||
if scene == null:
|
||||
|
||||
@@ -1510,13 +1510,42 @@ func _check_battle_visual_data(failures: Array[String]) -> void:
|
||||
if not liaodong_state.load_battle("res://data/scenarios/024_liaodong_pursuit.json", {}, {}, {}, ["zhang_he"]):
|
||||
failures.append("could not load Liaodong Pursuit data")
|
||||
else:
|
||||
_check_shop_items_unique(failures, liaodong_state, "024 base")
|
||||
var liaodong_conversations: Array = liaodong_state.get_briefing().get("camp_conversations", [])
|
||||
if liaodong_conversations.size() != 2:
|
||||
failures.append("024 base briefing should expose exactly two camp conversations")
|
||||
else:
|
||||
_check_camp_conversation(failures, liaodong_conversations[0], "liaodong_border_council", "topic", "")
|
||||
_check_camp_conversation(failures, liaodong_conversations[1], "liaodong_zhang_he_border_price", "officer", "zhang_he")
|
||||
var liaodong_merchant := liaodong_state.get_shop_merchant()
|
||||
if str(liaodong_merchant.get("name", "")) != "Liaodong Border Sutler":
|
||||
failures.append("024 shop should expose Liaodong Border merchant name")
|
||||
if (liaodong_merchant.get("lines", []) as Array).size() < 2:
|
||||
failures.append("024 shop should expose merchant flavor lines")
|
||||
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")
|
||||
_check_shop_item_visibility(failures, liaodong_state, "war_drum", false, "024 base")
|
||||
_check_shop_item_visibility(failures, liaodong_state, "imperial_seal", false, "024 base")
|
||||
_check_shop_item_visibility(failures, liaodong_state, "iron_armor", true, "024 base")
|
||||
|
||||
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_items_unique(failures, liaodong_pressed_state, "024 pressed Liaodong")
|
||||
var hard_wine: Dictionary = _find_camp_conversation(
|
||||
liaodong_pressed_state.get_briefing().get("camp_conversations", []),
|
||||
"liaodong_hard_pursuit_wine"
|
||||
)
|
||||
if hard_wine.is_empty():
|
||||
failures.append("024 pressed Liaodong flag should expose hard pursuit wine")
|
||||
else:
|
||||
_check_camp_conversation_effect(failures, hard_wine, "wine", 1)
|
||||
if not _find_camp_conversation(
|
||||
liaodong_pressed_state.get_briefing().get("camp_conversations", []),
|
||||
"liaodong_wuhuan_guides_medicine"
|
||||
).is_empty():
|
||||
failures.append("024 pressed Liaodong flag should not expose Wuhuan guide medicine")
|
||||
_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")
|
||||
|
||||
@@ -1524,9 +1553,72 @@ func _check_battle_visual_data(failures: Array[String]) -> void:
|
||||
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_items_unique(failures, liaodong_secured_state, "024 secured Wuhuan")
|
||||
var guide_medicine: Dictionary = _find_camp_conversation(
|
||||
liaodong_secured_state.get_briefing().get("camp_conversations", []),
|
||||
"liaodong_wuhuan_guides_medicine"
|
||||
)
|
||||
if guide_medicine.is_empty():
|
||||
failures.append("024 secured Wuhuan flag should expose guide medicine")
|
||||
else:
|
||||
_check_camp_conversation_effect(failures, guide_medicine, "panacea", 1)
|
||||
if not _find_camp_conversation(
|
||||
liaodong_secured_state.get_briefing().get("camp_conversations", []),
|
||||
"liaodong_hard_pursuit_wine"
|
||||
).is_empty():
|
||||
failures.append("024 secured Wuhuan flag should not expose hard pursuit wine")
|
||||
_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")
|
||||
|
||||
var liaodong_old_flags_state = BattleStateScript.new()
|
||||
if not liaodong_old_flags_state.load_battle("res://data/scenarios/024_liaodong_pursuit.json", {}, {}, {"struck_wuhuan_vanguard": true, "fortified_white_wolf_route": true}, ["zhang_he"]):
|
||||
failures.append("could not load Liaodong old White Wolf flag camp data")
|
||||
else:
|
||||
_check_shop_item_visibility(failures, liaodong_old_flags_state, "war_drum", false, "024 old White Wolf flags")
|
||||
_check_shop_item_visibility(failures, liaodong_old_flags_state, "imperial_seal", false, "024 old White Wolf flags")
|
||||
if not _find_camp_conversation(
|
||||
liaodong_old_flags_state.get_briefing().get("camp_conversations", []),
|
||||
"liaodong_hard_pursuit_wine"
|
||||
).is_empty():
|
||||
failures.append("024 old White Wolf flags should not expose hard pursuit wine")
|
||||
if not _find_camp_conversation(
|
||||
liaodong_old_flags_state.get_briefing().get("camp_conversations", []),
|
||||
"liaodong_wuhuan_guides_medicine"
|
||||
).is_empty():
|
||||
failures.append("024 old White Wolf flags should not expose guide medicine")
|
||||
|
||||
var xinye_state = BattleStateScript.new()
|
||||
if not xinye_state.load_battle("res://data/scenarios/025_xinye_advance.json", {}, {}, {}, ["zhang_he"]):
|
||||
failures.append("could not load Xinye Advance data")
|
||||
else:
|
||||
_check_shop_items_unique(failures, xinye_state, "025 base")
|
||||
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")
|
||||
_check_shop_item_visibility(failures, xinye_state, "imperial_seal", false, "025 base")
|
||||
|
||||
var xinye_terms_state = BattleStateScript.new()
|
||||
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:
|
||||
_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")
|
||||
|
||||
var xinye_authority_state = BattleStateScript.new()
|
||||
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:
|
||||
_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")
|
||||
|
||||
var xinye_old_flags_state = BattleStateScript.new()
|
||||
if not xinye_old_flags_state.load_battle("res://data/scenarios/025_xinye_advance.json", {}, {}, {"pressed_liaodong_pursuit": true, "secured_wuhuan_submission": true}, ["zhang_he"]):
|
||||
failures.append("could not load Xinye old Liaodong Pursuit flag data")
|
||||
else:
|
||||
_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")
|
||||
|
||||
for item_id in ["bronze_sword", "training_spear", "short_bow", "hand_axe", "iron_armor", "panacea"]:
|
||||
var item := state.get_item_def(item_id)
|
||||
if item.is_empty():
|
||||
|
||||
Reference in New Issue
Block a user