Add Tong Pass camp and Ma Chao bridge
This commit is contained in:
@@ -126,6 +126,10 @@ const JIANGLING_REARGUARD_STABILITY_MEDICINE_CONVERSATION_ID := "jiangling_rearg
|
||||
const JIANGLING_REARGUARD_FORCED_MARCH_BEANS_CONVERSATION_ID := "jiangling_rearguard_forced_march_beans"
|
||||
const TONG_PASS_SCENARIO_ID := "033_tong_pass_vanguard"
|
||||
const TONG_PASS_SCENARIO_PATH := "res://data/scenarios/033_tong_pass_vanguard.json"
|
||||
const TONG_PASS_JIANGLING_MEDICINE_CONVERSATION_ID := "tong_pass_jiangling_supply_medicine"
|
||||
const TONG_PASS_VANGUARD_RATIONS_CONVERSATION_ID := "tong_pass_vanguard_rations"
|
||||
const MA_CHAO_COUNTERSTROKE_SCENARIO_ID := "034_ma_chao_counterstroke"
|
||||
const MA_CHAO_COUNTERSTROKE_SCENARIO_PATH := "res://data/scenarios/034_ma_chao_counterstroke.json"
|
||||
const SAVE_PATH := "user://campaign_save.json"
|
||||
const MANUAL_SAVE_PATH := "user://campaign_manual_save.json"
|
||||
|
||||
@@ -167,6 +171,7 @@ func _init() -> void:
|
||||
_check_red_cliffs_fire_post_battle_choice_bridges_to_huarong(failures)
|
||||
_check_huarong_post_battle_choice_bridges_to_jiangling_rearguard(failures)
|
||||
_check_jiangling_rearguard_post_battle_choice_bridges_to_tong_pass(failures)
|
||||
_check_tong_pass_post_battle_choice_bridges_to_ma_chao_counterstroke(failures)
|
||||
_check_manual_checkpoint_reverts_claim(failures)
|
||||
_check_completed_replay_cannot_claim(failures)
|
||||
_check_conditional_camp_conversations(failures)
|
||||
@@ -191,6 +196,7 @@ func _init() -> void:
|
||||
_check_red_cliffs_fire_branch_camp_conversations(failures)
|
||||
_check_huarong_branch_camp_conversations(failures)
|
||||
_check_jiangling_rearguard_branch_camp_conversations(failures)
|
||||
_check_tong_pass_branch_camp_conversations(failures)
|
||||
_check_talk_menu_closes_on_cancel_and_reload(failures)
|
||||
|
||||
if not _restore_user_file(SAVE_PATH, save_backup):
|
||||
@@ -1453,6 +1459,29 @@ func _check_jiangling_rearguard_post_battle_choice_bridges_to_tong_pass(failures
|
||||
)
|
||||
|
||||
|
||||
func _check_tong_pass_post_battle_choice_bridges_to_ma_chao_counterstroke(failures: Array[String]) -> void:
|
||||
_check_tong_pass_choice_branch_to_ma_chao_counterstroke(
|
||||
failures,
|
||||
"fortify_tong_pass",
|
||||
"fortified_tong_pass",
|
||||
"pressed_ma_chao_vanguard",
|
||||
"imperial_seal",
|
||||
"war_drum",
|
||||
"Tong Pass fortifications",
|
||||
"fortified_pass_absorbs_charge"
|
||||
)
|
||||
_check_tong_pass_choice_branch_to_ma_chao_counterstroke(
|
||||
failures,
|
||||
"press_ma_chao_vanguard",
|
||||
"pressed_ma_chao_vanguard",
|
||||
"fortified_tong_pass",
|
||||
"war_drum",
|
||||
"imperial_seal",
|
||||
"Pressing Ma Chao's vanguard",
|
||||
"pressed_vanguard_draws_countercharge"
|
||||
)
|
||||
|
||||
|
||||
func _check_wuchao_choice_branch_to_cangting(
|
||||
failures: Array[String],
|
||||
choice_id: String,
|
||||
@@ -2920,6 +2949,86 @@ func _check_jiangling_rearguard_choice_branch_to_tong_pass(
|
||||
scene.free()
|
||||
|
||||
|
||||
func _check_tong_pass_choice_branch_to_ma_chao_counterstroke(
|
||||
failures: Array[String],
|
||||
choice_id: String,
|
||||
expected_flag: String,
|
||||
cleared_flag: String,
|
||||
expected_shop_item_id: String,
|
||||
hidden_shop_item_id: String,
|
||||
expected_briefing_fragment: String,
|
||||
expected_event_id: String
|
||||
) -> void:
|
||||
var scene = _new_prebattle_scene_for(failures, "Tong Pass choice bridge %s" % choice_id, TONG_PASS_SCENARIO_ID, TONG_PASS_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(
|
||||
TONG_PASS_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("Tong Pass choice bridge %s could not reload Tong Pass 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("Tong Pass choice bridge %s should save 033 victory" % choice_id)
|
||||
scene.free()
|
||||
return
|
||||
if not scene.campaign_state.get_joined_officers_snapshot().has("zhang_he"):
|
||||
failures.append("Tong Pass choice bridge %s should keep Zhang He before Ma Chao Counterstroke" % choice_id)
|
||||
if bool(result.get("choice_applied", true)):
|
||||
failures.append("Tong Pass choice bridge %s should wait for a selected post-battle choice" % choice_id)
|
||||
if scene.campaign_state.pending_post_battle_choice_scenario_id != TONG_PASS_SCENARIO_ID:
|
||||
failures.append("Tong Pass choice bridge %s should mark Tong Pass choice pending" % choice_id)
|
||||
var choice := _find_choice_by_id(result.get("post_battle_choices", []), choice_id)
|
||||
if choice.is_empty():
|
||||
failures.append("Tong Pass choice bridge missing choice: %s" % choice_id)
|
||||
scene.free()
|
||||
return
|
||||
if not scene.campaign_state.try_apply_post_battle_choice(choice, TONG_PASS_SCENARIO_ID):
|
||||
failures.append("Tong Pass 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("Tong Pass choice bridge %s should set %s" % [choice_id, expected_flag])
|
||||
if flags.get(cleared_flag, true) != false:
|
||||
failures.append("Tong Pass choice bridge %s should clear %s" % [choice_id, cleared_flag])
|
||||
if scene.campaign_state.current_scenario_id != MA_CHAO_COUNTERSTROKE_SCENARIO_ID:
|
||||
failures.append("Tong Pass choice bridge %s should advance to Ma Chao Counterstroke, got %s" % [choice_id, scene.campaign_state.current_scenario_id])
|
||||
if not scene.state.load_battle(
|
||||
MA_CHAO_COUNTERSTROKE_SCENARIO_PATH,
|
||||
scene.campaign_state.get_roster_overrides(),
|
||||
scene.campaign_state.get_inventory_snapshot(),
|
||||
flags,
|
||||
scene.campaign_state.get_joined_officers_snapshot()
|
||||
):
|
||||
failures.append("Tong Pass choice bridge %s could not load Ma Chao Counterstroke" % choice_id)
|
||||
scene.free()
|
||||
return
|
||||
if scene.state.get_unit("zhang_he_ch34").is_empty():
|
||||
failures.append("Tong Pass choice bridge %s should deploy Zhang He in Ma Chao Counterstroke" % choice_id)
|
||||
elif not scene.state.is_required_deployment("zhang_he_ch34"):
|
||||
failures.append("Tong Pass choice bridge %s should require Zhang He in Ma Chao Counterstroke" % choice_id)
|
||||
var briefing_lines: Array = scene.state.get_briefing().get("lines", [])
|
||||
if not _lines_contain_fragment(briefing_lines, expected_briefing_fragment):
|
||||
failures.append("Tong Pass choice bridge %s should expose Ma Chao Counterstroke briefing fragment `%s`" % [choice_id, expected_briefing_fragment])
|
||||
if not _battle_event_requires_flag(scene.state.battle_events, expected_event_id, expected_flag):
|
||||
failures.append("Tong Pass choice bridge %s should expose Ma Chao Counterstroke event %s gated by %s" % [choice_id, expected_event_id, expected_flag])
|
||||
var shop_items: Array = scene.state.get_shop_item_ids()
|
||||
if not shop_items.has(expected_shop_item_id):
|
||||
failures.append("Tong Pass choice bridge %s should expose shop item %s" % [choice_id, expected_shop_item_id])
|
||||
if shop_items.has(hidden_shop_item_id):
|
||||
failures.append("Tong Pass choice bridge %s should hide shop item %s" % [choice_id, hidden_shop_item_id])
|
||||
scene.free()
|
||||
|
||||
|
||||
func _lines_contain_fragment(lines: Array, fragment: String) -> bool:
|
||||
for line in lines:
|
||||
if str(line).contains(fragment):
|
||||
@@ -5004,6 +5113,121 @@ func _check_jiangling_rearguard_branch_camp_conversations(failures: Array[String
|
||||
rushed_scene.free()
|
||||
|
||||
|
||||
func _check_tong_pass_branch_camp_conversations(failures: Array[String]) -> void:
|
||||
var base_scene = _new_prebattle_scene_for(failures, "Tong Pass base camp", TONG_PASS_SCENARIO_ID, TONG_PASS_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(
|
||||
TONG_PASS_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("Tong Pass base camp should reload with Zhang He joined")
|
||||
else:
|
||||
if base_scene._camp_conversation_by_id("tong_pass_vanguard_council").is_empty():
|
||||
failures.append("Tong Pass should expose the vanguard council conversation")
|
||||
if base_scene._camp_conversation_by_id("tong_pass_zhang_he_pass_road").is_empty():
|
||||
failures.append("Tong Pass should expose Zhang He's pass road conversation")
|
||||
if not base_scene._camp_conversation_by_id(TONG_PASS_JIANGLING_MEDICINE_CONVERSATION_ID).is_empty():
|
||||
failures.append("Tong Pass Jiangling medicine should be hidden without stabilized Jiangling flag")
|
||||
if not base_scene._camp_conversation_by_id(TONG_PASS_VANGUARD_RATIONS_CONVERSATION_ID).is_empty():
|
||||
failures.append("Tong Pass vanguard rations should be hidden without mobilized vanguard flag")
|
||||
var merchant: Dictionary = base_scene.state.get_shop_merchant()
|
||||
if str(merchant.get("name", "")) != "Tong Pass Sutler":
|
||||
failures.append("Tong Pass shop merchant name should be present")
|
||||
var merchant_lines: Array = merchant.get("lines", [])
|
||||
if merchant_lines.size() < 2:
|
||||
failures.append("Tong Pass shop merchant should expose flavor lines")
|
||||
if base_scene._format_talk_status_text(base_scene._camp_conversation_entries()) != "Camp conversations | 2 topics":
|
||||
failures.append("Tong Pass base talk status should summarize two non-supply topics")
|
||||
base_scene.free()
|
||||
|
||||
var stabilized_scene = _new_prebattle_scene_for(
|
||||
failures,
|
||||
"Tong Pass stabilized Jiangling camp",
|
||||
TONG_PASS_SCENARIO_ID,
|
||||
TONG_PASS_SCENARIO_PATH,
|
||||
{"stabilized_jiangling_rearguard": true}
|
||||
)
|
||||
if stabilized_scene != null:
|
||||
if not stabilized_scene.campaign_state.joined_officers.has("zhang_he"):
|
||||
stabilized_scene.campaign_state.joined_officers.append("zhang_he")
|
||||
if not stabilized_scene.state.load_battle(
|
||||
TONG_PASS_SCENARIO_PATH,
|
||||
stabilized_scene.campaign_state.get_roster_overrides(),
|
||||
stabilized_scene.campaign_state.get_inventory_snapshot(),
|
||||
stabilized_scene.campaign_state.get_flags_snapshot(),
|
||||
stabilized_scene.campaign_state.get_joined_officers_snapshot()
|
||||
):
|
||||
failures.append("Tong Pass stabilized Jiangling camp should reload with Zhang He joined")
|
||||
else:
|
||||
var jiangling_medicine: Dictionary = stabilized_scene._camp_conversation_by_id(TONG_PASS_JIANGLING_MEDICINE_CONVERSATION_ID)
|
||||
if jiangling_medicine.is_empty():
|
||||
failures.append("stabilized Jiangling flag should expose Tong Pass medicine")
|
||||
if not stabilized_scene._camp_conversation_by_id(TONG_PASS_VANGUARD_RATIONS_CONVERSATION_ID).is_empty():
|
||||
failures.append("stabilized Jiangling flag should not expose Tong Pass vanguard rations")
|
||||
if not jiangling_medicine.is_empty():
|
||||
if stabilized_scene._format_talk_status_text(stabilized_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready":
|
||||
failures.append("Tong Pass stabilized Jiangling talk status should show one ready supply")
|
||||
if not stabilized_scene._format_camp_conversation_button_text(jiangling_medicine).contains("보급 Panacea"):
|
||||
failures.append("Tong Pass Jiangling 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(jiangling_medicine)
|
||||
if int(stabilized_scene.campaign_state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1:
|
||||
failures.append("Tong Pass Jiangling medicine should add Panacea to campaign inventory")
|
||||
if int(stabilized_scene.state.get_inventory_snapshot().get("panacea", 0)) != before_panacea + 1:
|
||||
failures.append("Tong Pass Jiangling medicine should refresh battle Panacea inventory")
|
||||
if not stabilized_scene.campaign_state.has_claimed_camp_conversation_effects(TONG_PASS_SCENARIO_ID, TONG_PASS_JIANGLING_MEDICINE_CONVERSATION_ID):
|
||||
failures.append("Tong Pass Jiangling 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("Tong Pass stabilized Jiangling talk status should show claimed supply after claim")
|
||||
stabilized_scene.free()
|
||||
|
||||
var mobilized_scene = _new_prebattle_scene_for(
|
||||
failures,
|
||||
"Tong Pass mobilized vanguard camp",
|
||||
TONG_PASS_SCENARIO_ID,
|
||||
TONG_PASS_SCENARIO_PATH,
|
||||
{"mobilized_tong_pass_vanguard": true}
|
||||
)
|
||||
if mobilized_scene != null:
|
||||
if not mobilized_scene.campaign_state.joined_officers.has("zhang_he"):
|
||||
mobilized_scene.campaign_state.joined_officers.append("zhang_he")
|
||||
if not mobilized_scene.state.load_battle(
|
||||
TONG_PASS_SCENARIO_PATH,
|
||||
mobilized_scene.campaign_state.get_roster_overrides(),
|
||||
mobilized_scene.campaign_state.get_inventory_snapshot(),
|
||||
mobilized_scene.campaign_state.get_flags_snapshot(),
|
||||
mobilized_scene.campaign_state.get_joined_officers_snapshot()
|
||||
):
|
||||
failures.append("Tong Pass mobilized vanguard camp should reload with Zhang He joined")
|
||||
else:
|
||||
var vanguard_rations: Dictionary = mobilized_scene._camp_conversation_by_id(TONG_PASS_VANGUARD_RATIONS_CONVERSATION_ID)
|
||||
if vanguard_rations.is_empty():
|
||||
failures.append("mobilized Tong Pass vanguard flag should expose Tong Pass rations")
|
||||
if not mobilized_scene._camp_conversation_by_id(TONG_PASS_JIANGLING_MEDICINE_CONVERSATION_ID).is_empty():
|
||||
failures.append("mobilized Tong Pass vanguard flag should not expose Tong Pass medicine")
|
||||
if not vanguard_rations.is_empty():
|
||||
if mobilized_scene._format_talk_status_text(mobilized_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 supplies ready":
|
||||
failures.append("Tong Pass mobilized vanguard talk status should show one ready supply")
|
||||
if not mobilized_scene._format_camp_conversation_button_text(vanguard_rations).contains("보급 Bean"):
|
||||
failures.append("Tong Pass vanguard rations button should show Bean supply")
|
||||
var before_bean := int(mobilized_scene.campaign_state.get_inventory_snapshot().get("bean", 0))
|
||||
mobilized_scene._apply_camp_conversation_effects(vanguard_rations)
|
||||
if int(mobilized_scene.campaign_state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1:
|
||||
failures.append("Tong Pass vanguard rations should add Bean to campaign inventory")
|
||||
if int(mobilized_scene.state.get_inventory_snapshot().get("bean", 0)) != before_bean + 1:
|
||||
failures.append("Tong Pass vanguard rations should refresh battle Bean inventory")
|
||||
if not mobilized_scene.campaign_state.has_claimed_camp_conversation_effects(TONG_PASS_SCENARIO_ID, TONG_PASS_VANGUARD_RATIONS_CONVERSATION_ID):
|
||||
failures.append("Tong Pass vanguard rations claim should be saved")
|
||||
if mobilized_scene._format_talk_status_text(mobilized_scene._camp_conversation_entries()) != "Camp conversations | 3 topics | 1 claimed":
|
||||
failures.append("Tong Pass mobilized vanguard talk status should show claimed supply after claim")
|
||||
mobilized_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:
|
||||
|
||||
Reference in New Issue
Block a user