Add Bohai remnant camp flow

This commit is contained in:
2026-06-19 02:37:29 +09:00
parent 4087180f72
commit f26952e39e
4 changed files with 321 additions and 1 deletions

View File

@@ -78,6 +78,10 @@ const NANPI_SURRENDER_PRESSURE_CONVERSATION_ID := "nanpi_surrender_pressure_wine
const NANPI_SURRENDER_ADMIN_CONVERSATION_ID := "nanpi_surrender_admin_medicine"
const BOHAI_SCENARIO_ID := "021_bohai_remnants"
const BOHAI_SCENARIO_PATH := "res://data/scenarios/021_bohai_remnants.json"
const BOHAI_FAST_COLUMN_CONVERSATION_ID := "bohai_remnants_fast_column_wine"
const BOHAI_COMMANDERY_CONVERSATION_ID := "bohai_remnants_commandery_medicine"
const LIAOXI_SCENARIO_ID := "022_liaoxi_pursuit"
const LIAOXI_SCENARIO_PATH := "res://data/scenarios/022_liaoxi_pursuit.json"
const SAVE_PATH := "user://campaign_save.json"
const MANUAL_SAVE_PATH := "user://campaign_manual_save.json"
@@ -107,6 +111,7 @@ func _init() -> void:
_check_northern_pursuit_post_battle_choice_bridges_to_nanpi(failures)
_check_nanpi_post_battle_choice_bridges_to_surrender(failures)
_check_nanpi_surrender_post_battle_choice_bridges_to_bohai(failures)
_check_bohai_post_battle_choice_bridges_to_liaoxi(failures)
_check_manual_checkpoint_reverts_claim(failures)
_check_completed_replay_cannot_claim(failures)
_check_conditional_camp_conversations(failures)
@@ -119,6 +124,7 @@ func _init() -> void:
_check_northern_pursuit_branch_camp_conversations(failures)
_check_nanpi_branch_camp_conversations(failures)
_check_nanpi_surrender_branch_camp_conversations(failures)
_check_bohai_branch_camp_conversations(failures)
_check_talk_menu_closes_on_cancel_and_reload(failures)
if not _restore_user_file(SAVE_PATH, save_backup):
@@ -1149,6 +1155,25 @@ func _check_nanpi_surrender_post_battle_choice_bridges_to_bohai(failures: Array[
)
func _check_bohai_post_battle_choice_bridges_to_liaoxi(failures: Array[String]) -> void:
_check_bohai_choice_branch_to_liaoxi(
failures,
"press_liaoxi_pursuit",
"pressed_liaoxi_pursuit",
"secured_liaoxi_approaches",
"war_drum",
"imperial_seal"
)
_check_bohai_choice_branch_to_liaoxi(
failures,
"secure_liaoxi_approaches",
"secured_liaoxi_approaches",
"pressed_liaoxi_pursuit",
"imperial_seal",
"war_drum"
)
func _check_wuchao_choice_branch_to_cangting(
failures: Array[String],
choice_id: String,
@@ -1733,6 +1758,79 @@ func _check_nanpi_surrender_choice_branch_to_bohai(
scene.free()
func _check_bohai_choice_branch_to_liaoxi(
failures: Array[String],
choice_id: String,
expected_flag: String,
cleared_flag: String,
expected_shop_item_id: String,
hidden_shop_item_id: String
) -> void:
var scene = _new_prebattle_scene_for(failures, "Bohai choice bridge %s" % choice_id, BOHAI_SCENARIO_ID, BOHAI_SCENARIO_PATH)
if scene == null:
return
if not scene.campaign_state.joined_officers.has("zhang_he"):
scene.campaign_state.joined_officers.append("zhang_he")
if not scene.state.load_battle(
BOHAI_SCENARIO_PATH,
scene.campaign_state.get_roster_overrides(),
scene.campaign_state.get_inventory_snapshot(),
scene.campaign_state.get_flags_snapshot(),
scene.campaign_state.get_joined_officers_snapshot()
):
failures.append("Bohai choice bridge %s could not reload Bohai with Zhang He joined" % choice_id)
scene.free()
return
scene.state.battle_status = "victory"
var result: Dictionary = scene.campaign_state.apply_battle_result(scene.state)
if not bool(result.get("saved", false)):
failures.append("Bohai choice bridge %s should save 021 victory" % choice_id)
scene.free()
return
if not scene.campaign_state.get_joined_officers_snapshot().has("zhang_he"):
failures.append("Bohai choice bridge %s should keep Zhang He before Liaoxi" % choice_id)
if bool(result.get("choice_applied", true)):
failures.append("Bohai choice bridge %s should wait for a selected post-battle choice" % choice_id)
if scene.campaign_state.pending_post_battle_choice_scenario_id != BOHAI_SCENARIO_ID:
failures.append("Bohai choice bridge %s should mark Bohai choice pending" % choice_id)
var choice := _find_choice_by_id(result.get("post_battle_choices", []), choice_id)
if choice.is_empty():
failures.append("Bohai choice bridge missing choice: %s" % choice_id)
scene.free()
return
if not scene.campaign_state.try_apply_post_battle_choice(choice, BOHAI_SCENARIO_ID):
failures.append("Bohai choice bridge %s should save selected choice" % choice_id)
scene.free()
return
var flags: Dictionary = scene.campaign_state.get_flags_snapshot()
if flags.get(expected_flag, false) != true:
failures.append("Bohai choice bridge %s should set %s" % [choice_id, expected_flag])
if flags.get(cleared_flag, true) != false:
failures.append("Bohai choice bridge %s should clear %s" % [choice_id, cleared_flag])
if scene.campaign_state.current_scenario_id != LIAOXI_SCENARIO_ID:
failures.append("Bohai choice bridge %s should advance to Liaoxi, got %s" % [choice_id, scene.campaign_state.current_scenario_id])
if not scene.state.load_battle(
LIAOXI_SCENARIO_PATH,
scene.campaign_state.get_roster_overrides(),
scene.campaign_state.get_inventory_snapshot(),
flags,
scene.campaign_state.get_joined_officers_snapshot()
):
failures.append("Bohai choice bridge %s could not load Liaoxi" % choice_id)
scene.free()
return
if scene.state.get_unit("zhang_he_ch22").is_empty():
failures.append("Bohai choice bridge %s should deploy Zhang He in Liaoxi" % choice_id)
elif not scene.state.is_required_deployment("zhang_he_ch22"):
failures.append("Bohai choice bridge %s should require Zhang He in Liaoxi" % choice_id)
var shop_items: Array = scene.state.get_shop_item_ids()
if not shop_items.has(expected_shop_item_id):
failures.append("Bohai choice bridge %s should expose shop item %s" % [choice_id, expected_shop_item_id])
if shop_items.has(hidden_shop_item_id):
failures.append("Bohai choice bridge %s should hide shop item %s" % [choice_id, hidden_shop_item_id])
scene.free()
func _find_choice_by_id(choices, choice_id: String) -> Dictionary:
if typeof(choices) != TYPE_ARRAY:
return {}
@@ -2572,6 +2670,88 @@ func _check_nanpi_surrender_branch_camp_conversations(failures: Array[String]) -
admin_scene.free()
func _check_bohai_branch_camp_conversations(failures: Array[String]) -> void:
var base_scene = _new_prebattle_scene_for(failures, "Bohai base camp", BOHAI_SCENARIO_ID, BOHAI_SCENARIO_PATH)
if base_scene != null:
if base_scene._camp_conversation_by_id("bohai_remnants_exile_council").is_empty():
failures.append("Bohai should expose the exile council conversation")
if base_scene._camp_conversation_by_id("bohai_remnants_zhang_he_escape_road").is_empty():
failures.append("Bohai should expose Zhang He's escape road conversation")
if not base_scene._camp_conversation_by_id(BOHAI_FAST_COLUMN_CONVERSATION_ID).is_empty():
failures.append("Bohai fast column wine should be hidden without pursued Yuan brothers flag")
if not base_scene._camp_conversation_by_id(BOHAI_COMMANDERY_CONVERSATION_ID).is_empty():
failures.append("Bohai commandery medicine should be hidden without secured Bohai flag")
var merchant: Dictionary = base_scene.state.get_shop_merchant()
if str(merchant.get("name", "")) != "Bohai Road Sutler":
failures.append("Bohai shop merchant name should be present")
var merchant_lines: Array = merchant.get("lines", [])
if merchant_lines.size() < 2:
failures.append("Bohai shop merchant should expose flavor lines")
if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics":
failures.append("Bohai base talk status should summarize two non-supply topics")
base_scene.free()
var pursued_scene = _new_prebattle_scene_for(
failures,
"Bohai pursued camp",
BOHAI_SCENARIO_ID,
BOHAI_SCENARIO_PATH,
{"pursued_yuan_brothers": true}
)
if pursued_scene != null:
var fast_wine: Dictionary = pursued_scene._camp_conversation_by_id(BOHAI_FAST_COLUMN_CONVERSATION_ID)
if fast_wine.is_empty():
failures.append("pursued Yuan brothers flag should expose Bohai fast column wine")
if not pursued_scene._camp_conversation_by_id(BOHAI_COMMANDERY_CONVERSATION_ID).is_empty():
failures.append("pursued Yuan brothers flag should not expose Bohai commandery medicine")
if not fast_wine.is_empty():
if pursued_scene._format_talk_status_text(pursued_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready":
failures.append("Bohai pursued talk status should show one ready supply")
if not pursued_scene._format_camp_conversation_button_text(fast_wine).contains("Supply Wine"):
failures.append("Bohai fast column wine button should show Wine supply")
var before_wine := int(pursued_scene.campaign_state.get_inventory_snapshot().get("wine", 0))
pursued_scene._apply_camp_conversation_effects(fast_wine)
if int(pursued_scene.campaign_state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1:
failures.append("Bohai fast column wine should add Wine to campaign inventory")
if int(pursued_scene.state.get_inventory_snapshot().get("wine", 0)) != before_wine + 1:
failures.append("Bohai fast column wine should refresh battle Wine inventory")
if not pursued_scene.campaign_state.has_claimed_camp_conversation_effects(BOHAI_SCENARIO_ID, BOHAI_FAST_COLUMN_CONVERSATION_ID):
failures.append("Bohai fast column wine claim should be saved")
if pursued_scene._format_talk_status_text(pursued_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed":
failures.append("Bohai pursued talk status should show claimed supply after claim")
pursued_scene.free()
var secured_scene = _new_prebattle_scene_for(
failures,
"Bohai secured camp",
BOHAI_SCENARIO_ID,
BOHAI_SCENARIO_PATH,
{"secured_bohai_commandery": true}
)
if secured_scene != null:
var commandery_medicine: Dictionary = secured_scene._camp_conversation_by_id(BOHAI_COMMANDERY_CONVERSATION_ID)
if commandery_medicine.is_empty():
failures.append("secured Bohai flag should expose Bohai commandery medicine")
if not secured_scene._camp_conversation_by_id(BOHAI_FAST_COLUMN_CONVERSATION_ID).is_empty():
failures.append("secured Bohai flag should not expose Bohai fast column wine")
if not commandery_medicine.is_empty():
if secured_scene._format_talk_status_text(secured_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready":
failures.append("Bohai secured talk status should show one ready supply")
if not secured_scene._format_camp_conversation_button_text(commandery_medicine).contains("Supply Panacea"):
failures.append("Bohai commandery medicine button should show Panacea supply")
var before_panacea := int(secured_scene.campaign_state.get_inventory_snapshot().get("panacea", 0))
secured_scene._apply_camp_conversation_effects(commandery_medicine)
if int(secured_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1:
failures.append("Bohai commandery medicine should add Panacea to campaign inventory")
if int(secured_scene.state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1:
failures.append("Bohai commandery medicine should refresh battle Panacea inventory")
if not secured_scene.campaign_state.has_claimed_camp_conversation_effects(BOHAI_SCENARIO_ID, BOHAI_COMMANDERY_CONVERSATION_ID):
failures.append("Bohai commandery medicine claim should be saved")
if secured_scene._format_talk_status_text(secured_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed":
failures.append("Bohai secured talk status should show claimed supply after claim")
secured_scene.free()
func _check_talk_menu_closes_on_cancel_and_reload(failures: Array[String]) -> void:
var scene = _new_prebattle_scene(failures, "talk menu close guards")
if scene == null:

View File

@@ -1265,6 +1265,85 @@ func _check_battle_visual_data(failures: Array[String]) -> void:
).is_empty():
failures.append("020 old Nanpi Pressure flags should not expose admin medicine")
var bohai_state = BattleStateScript.new()
if not bohai_state.load_battle("res://data/scenarios/021_bohai_remnants.json"):
failures.append("could not load Bohai camp data")
else:
_check_shop_items_unique(failures, bohai_state, "021 base")
var bohai_conversations: Array = bohai_state.get_briefing().get("camp_conversations", [])
if bohai_conversations.size() != 2:
failures.append("021 base briefing should expose exactly two camp conversations")
else:
_check_camp_conversation(failures, bohai_conversations[0], "bohai_remnants_exile_council", "topic", "")
_check_camp_conversation(failures, bohai_conversations[1], "bohai_remnants_zhang_he_escape_road", "officer", "zhang_he")
var bohai_merchant := bohai_state.get_shop_merchant()
if str(bohai_merchant.get("name", "")) != "Bohai Road Sutler":
failures.append("021 shop should expose Bohai Road merchant name")
if (bohai_merchant.get("lines", []) as Array).size() < 2:
failures.append("021 shop should expose merchant flavor lines")
_check_shop_item_visibility(failures, bohai_state, "war_drum", false, "021 base")
_check_shop_item_visibility(failures, bohai_state, "imperial_seal", false, "021 base")
_check_shop_item_visibility(failures, bohai_state, "iron_armor", true, "021 base")
var bohai_pursued_state = BattleStateScript.new()
if not bohai_pursued_state.load_battle("res://data/scenarios/021_bohai_remnants.json", {}, {}, {"pursued_yuan_brothers": true}):
failures.append("could not load Bohai pursued Yuan brothers camp data")
else:
_check_shop_items_unique(failures, bohai_pursued_state, "021 pursued Yuan brothers")
var fast_wine: Dictionary = _find_camp_conversation(
bohai_pursued_state.get_briefing().get("camp_conversations", []),
"bohai_remnants_fast_column_wine"
)
if fast_wine.is_empty():
failures.append("021 pursued Yuan brothers flag should expose fast column wine")
else:
_check_camp_conversation_effect(failures, fast_wine, "wine", 1)
if not _find_camp_conversation(
bohai_pursued_state.get_briefing().get("camp_conversations", []),
"bohai_remnants_commandery_medicine"
).is_empty():
failures.append("021 pursued Yuan brothers flag should not expose commandery medicine")
_check_shop_item_visibility(failures, bohai_pursued_state, "war_drum", true, "021 pursued Yuan brothers")
_check_shop_item_visibility(failures, bohai_pursued_state, "imperial_seal", false, "021 pursued Yuan brothers")
var bohai_secured_state = BattleStateScript.new()
if not bohai_secured_state.load_battle("res://data/scenarios/021_bohai_remnants.json", {}, {}, {"secured_bohai_commandery": true}):
failures.append("could not load Bohai secured commandery camp data")
else:
_check_shop_items_unique(failures, bohai_secured_state, "021 secured Bohai")
var commandery_medicine: Dictionary = _find_camp_conversation(
bohai_secured_state.get_briefing().get("camp_conversations", []),
"bohai_remnants_commandery_medicine"
)
if commandery_medicine.is_empty():
failures.append("021 secured Bohai flag should expose commandery medicine")
else:
_check_camp_conversation_effect(failures, commandery_medicine, "panacea", 1)
if not _find_camp_conversation(
bohai_secured_state.get_briefing().get("camp_conversations", []),
"bohai_remnants_fast_column_wine"
).is_empty():
failures.append("021 secured Bohai flag should not expose fast column wine")
_check_shop_item_visibility(failures, bohai_secured_state, "war_drum", false, "021 secured Bohai")
_check_shop_item_visibility(failures, bohai_secured_state, "imperial_seal", true, "021 secured Bohai")
var bohai_old_flags_state = BattleStateScript.new()
if not bohai_old_flags_state.load_battle("res://data/scenarios/021_bohai_remnants.json", {}, {}, {"pressed_yuan_tan_surrender": true, "secured_nanpi_admin": true}):
failures.append("could not load Bohai old Nanpi Surrender flag camp data")
else:
_check_shop_item_visibility(failures, bohai_old_flags_state, "war_drum", false, "021 old Nanpi Surrender flags")
_check_shop_item_visibility(failures, bohai_old_flags_state, "imperial_seal", false, "021 old Nanpi Surrender flags")
if not _find_camp_conversation(
bohai_old_flags_state.get_briefing().get("camp_conversations", []),
"bohai_remnants_fast_column_wine"
).is_empty():
failures.append("021 old Nanpi Surrender flags should not expose fast column wine")
if not _find_camp_conversation(
bohai_old_flags_state.get_briefing().get("camp_conversations", []),
"bohai_remnants_commandery_medicine"
).is_empty():
failures.append("021 old Nanpi Surrender flags should not expose commandery medicine")
for item_id in ["bronze_sword", "training_spear", "short_bow", "hand_axe", "iron_armor", "panacea"]:
var item := state.get_item_def(item_id)
if item.is_empty():