Style ancient UI and refine Guandu camp
This commit is contained in:
@@ -43,6 +43,7 @@ func _init() -> void:
|
||||
_check_battle_visual_data(failures)
|
||||
_check_scene_texture_loading(failures)
|
||||
_check_hud_focus_text(failures)
|
||||
_check_ancient_ui_theme(failures)
|
||||
_check_hover_intent_badges(failures)
|
||||
_check_action_button_disabled_reasons(failures)
|
||||
_check_terrain_and_unit_presentation(failures)
|
||||
@@ -599,24 +600,112 @@ func _check_battle_visual_data(failures: Array[String]) -> void:
|
||||
failures.append("could not load Guandu Showdown shop data")
|
||||
else:
|
||||
_check_shop_items_unique(failures, guandu_state, "012 base")
|
||||
var guandu_conversations: Array = guandu_state.get_briefing().get("camp_conversations", [])
|
||||
if guandu_conversations.size() != 2:
|
||||
failures.append("012 base briefing should expose exactly two camp conversations")
|
||||
else:
|
||||
_check_camp_conversation(failures, guandu_conversations[0], "guandu_main_line_council", "officer", "cao_cao")
|
||||
_check_camp_conversation(failures, guandu_conversations[1], "guandu_guo_jia_supply_wound", "officer", "guo_jia")
|
||||
var guandu_merchant := guandu_state.get_shop_merchant()
|
||||
if str(guandu_merchant.get("name", "")) != "Guandu Camp Sutler":
|
||||
failures.append("012 shop should expose Guandu merchant name")
|
||||
if (guandu_merchant.get("lines", []) as Array).size() < 2:
|
||||
failures.append("012 shop should expose merchant flavor lines")
|
||||
_check_shop_item_visibility(failures, guandu_state, "imperial_seal", false, "012 base")
|
||||
_check_shop_item_visibility(failures, guandu_state, "war_drum", false, "012 base")
|
||||
_check_shop_item_visibility(failures, guandu_state, "yitian_sword", false, "012 base")
|
||||
_check_shop_item_visibility(failures, guandu_state, "panacea", false, "012 base")
|
||||
_check_shop_item_visibility(failures, guandu_state, "antidote", false, "012 base")
|
||||
|
||||
var guandu_secured_state = BattleStateScript.new()
|
||||
if not guandu_secured_state.load_battle("res://data/scenarios/012_guandu_showdown.json", {}, {}, {"secured_guandu_line": true}):
|
||||
failures.append("could not load Guandu secured line shop data")
|
||||
else:
|
||||
_check_shop_items_unique(failures, guandu_secured_state, "012 secured Guandu line")
|
||||
_check_shop_item_visibility(failures, guandu_secured_state, "imperial_seal", true, "012 secured Guandu line")
|
||||
var line_medicine: Dictionary = _find_camp_conversation(
|
||||
guandu_secured_state.get_briefing().get("camp_conversations", []),
|
||||
"guandu_secured_line_medicine"
|
||||
)
|
||||
if line_medicine.is_empty():
|
||||
failures.append("012 secured Guandu line flag should expose secured line medicine conversation")
|
||||
else:
|
||||
_check_camp_conversation_effect(failures, line_medicine, "panacea", 1)
|
||||
if not _find_camp_conversation(
|
||||
guandu_secured_state.get_briefing().get("camp_conversations", []),
|
||||
"guandu_wuchao_scout_wine"
|
||||
).is_empty():
|
||||
failures.append("012 secured Guandu line flag should not expose Wuchao scout wine conversation")
|
||||
_check_shop_item_visibility(failures, guandu_secured_state, "imperial_seal", false, "012 secured Guandu line")
|
||||
_check_shop_item_visibility(failures, guandu_secured_state, "war_drum", false, "012 secured Guandu line")
|
||||
_check_shop_item_visibility(failures, guandu_secured_state, "yitian_sword", false, "012 secured Guandu line")
|
||||
_check_shop_item_visibility(failures, guandu_secured_state, "panacea", true, "012 secured Guandu line")
|
||||
_check_shop_item_visibility(failures, guandu_secured_state, "antidote", false, "012 secured Guandu line")
|
||||
|
||||
var guandu_scouted_state = BattleStateScript.new()
|
||||
if not guandu_scouted_state.load_battle("res://data/scenarios/012_guandu_showdown.json", {}, {}, {"scouted_wuchao_depots": true}):
|
||||
failures.append("could not load Guandu scouted Wuchao shop data")
|
||||
else:
|
||||
_check_shop_items_unique(failures, guandu_scouted_state, "012 scouted Wuchao")
|
||||
var scout_wine: Dictionary = _find_camp_conversation(
|
||||
guandu_scouted_state.get_briefing().get("camp_conversations", []),
|
||||
"guandu_wuchao_scout_wine"
|
||||
)
|
||||
if scout_wine.is_empty():
|
||||
failures.append("012 scouted Wuchao flag should expose Wuchao scout wine conversation")
|
||||
else:
|
||||
_check_camp_conversation_effect(failures, scout_wine, "wine", 1)
|
||||
if not _find_camp_conversation(
|
||||
guandu_scouted_state.get_briefing().get("camp_conversations", []),
|
||||
"guandu_secured_line_medicine"
|
||||
).is_empty():
|
||||
failures.append("012 scouted Wuchao flag should not expose secured line medicine conversation")
|
||||
_check_shop_item_visibility(failures, guandu_scouted_state, "imperial_seal", false, "012 scouted Wuchao")
|
||||
_check_shop_item_visibility(failures, guandu_scouted_state, "war_drum", true, "012 scouted Wuchao")
|
||||
_check_shop_item_visibility(failures, guandu_scouted_state, "war_drum", false, "012 scouted Wuchao")
|
||||
_check_shop_item_visibility(failures, guandu_scouted_state, "yitian_sword", false, "012 scouted Wuchao")
|
||||
_check_shop_item_visibility(failures, guandu_scouted_state, "panacea", false, "012 scouted Wuchao")
|
||||
_check_shop_item_visibility(failures, guandu_scouted_state, "antidote", true, "012 scouted Wuchao")
|
||||
|
||||
var wuchao_state = BattleStateScript.new()
|
||||
if not wuchao_state.load_battle("res://data/scenarios/013_wuchao_raid.json"):
|
||||
failures.append("could not load Wuchao Raid shop data")
|
||||
else:
|
||||
_check_shop_items_unique(failures, wuchao_state, "013 base")
|
||||
_check_shop_item_visibility(failures, wuchao_state, "war_drum", false, "013 base")
|
||||
_check_shop_item_visibility(failures, wuchao_state, "imperial_seal", false, "013 base")
|
||||
|
||||
var wuchao_prepared_state = BattleStateScript.new()
|
||||
if not wuchao_prepared_state.load_battle("res://data/scenarios/013_wuchao_raid.json", {}, {}, {"prepared_wuchao_raid": true}):
|
||||
failures.append("could not load Wuchao prepared raid shop data")
|
||||
else:
|
||||
_check_shop_items_unique(failures, wuchao_prepared_state, "013 prepared Wuchao raid")
|
||||
_check_shop_item_visibility(failures, wuchao_prepared_state, "war_drum", true, "013 prepared Wuchao raid")
|
||||
_check_shop_item_visibility(failures, wuchao_prepared_state, "imperial_seal", false, "013 prepared Wuchao raid")
|
||||
|
||||
var wuchao_strengthened_state = BattleStateScript.new()
|
||||
if not wuchao_strengthened_state.load_battle("res://data/scenarios/013_wuchao_raid.json", {}, {}, {"strengthened_guandu_defense": true}):
|
||||
failures.append("could not load Wuchao strengthened Guandu shop data")
|
||||
else:
|
||||
_check_shop_items_unique(failures, wuchao_strengthened_state, "013 strengthened Guandu defense")
|
||||
_check_shop_item_visibility(failures, wuchao_strengthened_state, "war_drum", false, "013 strengthened Guandu defense")
|
||||
_check_shop_item_visibility(failures, wuchao_strengthened_state, "imperial_seal", true, "013 strengthened Guandu defense")
|
||||
|
||||
var wuchao_old_flags_state = BattleStateScript.new()
|
||||
if not wuchao_old_flags_state.load_battle("res://data/scenarios/013_wuchao_raid.json", {}, {}, {"secured_guandu_line": true, "scouted_wuchao_depots": true}):
|
||||
failures.append("could not load Wuchao old Guandu flag shop data")
|
||||
else:
|
||||
_check_shop_items_unique(failures, wuchao_old_flags_state, "013 old Guandu flags")
|
||||
_check_shop_item_visibility(failures, wuchao_old_flags_state, "war_drum", false, "013 old Guandu flags")
|
||||
_check_shop_item_visibility(failures, wuchao_old_flags_state, "imperial_seal", false, "013 old Guandu flags")
|
||||
if not _find_camp_conversation(
|
||||
wuchao_old_flags_state.get_briefing().get("camp_conversations", []),
|
||||
"wuchao_fast_raid_supplies"
|
||||
).is_empty():
|
||||
failures.append("013 old Guandu flags should not expose fast raid supplies")
|
||||
if not _find_camp_conversation(
|
||||
wuchao_old_flags_state.get_briefing().get("camp_conversations", []),
|
||||
"wuchao_guandu_reserve_wagon"
|
||||
).is_empty():
|
||||
failures.append("013 old Guandu flags should not expose reserve wagon supplies")
|
||||
|
||||
for item_id in ["bronze_sword", "training_spear", "short_bow", "hand_axe", "iron_armor", "panacea"]:
|
||||
var item := state.get_item_def(item_id)
|
||||
@@ -782,6 +871,45 @@ func _check_hud_focus_text(failures: Array[String]) -> void:
|
||||
scene.free()
|
||||
|
||||
|
||||
func _check_ancient_ui_theme(failures: Array[String]) -> void:
|
||||
var scene = BattleSceneScript.new()
|
||||
scene._create_hud()
|
||||
if not scene.state.load_battle("res://data/scenarios/001_yellow_turbans.json"):
|
||||
failures.append("could not load battle scene state for ancient UI theme")
|
||||
scene.free()
|
||||
return
|
||||
var briefing_text := scene._format_briefing_objectives()
|
||||
for expected in ["War Edict:", "Ruin If:", "War Report:", "Ill Omen:", "Spoils:"]:
|
||||
if not briefing_text.contains(expected):
|
||||
failures.append("briefing objective parchment should use ancient heading `%s`: %s" % [expected, briefing_text])
|
||||
_check_panel_style_fill(failures, scene.briefing_panel, "briefing panel", Color(0.77, 0.67, 0.48, 0.96))
|
||||
_check_panel_style_fill(failures, scene.dialogue_panel, "dialogue panel", Color(0.16, 0.075, 0.04, 0.96))
|
||||
_check_panel_style_fill(failures, scene.dialogue_portrait_panel, "dialogue portrait panel", Color(0.10, 0.065, 0.04, 1.0))
|
||||
_check_panel_style_fill(failures, scene.result_panel, "result panel", Color(0.77, 0.67, 0.48, 0.96))
|
||||
scene.free()
|
||||
|
||||
|
||||
func _check_panel_style_fill(failures: Array[String], panel: PanelContainer, label: String, expected: Color) -> void:
|
||||
if panel == null:
|
||||
failures.append("%s missing" % label)
|
||||
return
|
||||
var style := panel.get_theme_stylebox("panel") as StyleBoxFlat
|
||||
if style == null:
|
||||
failures.append("%s should use a flat styled panel" % label)
|
||||
return
|
||||
if not _colors_nearly_equal(style.bg_color, expected):
|
||||
failures.append("%s fill mismatch: %s" % [label, str(style.bg_color)])
|
||||
|
||||
|
||||
func _colors_nearly_equal(left: Color, right: Color) -> bool:
|
||||
return (
|
||||
absf(left.r - right.r) < 0.01
|
||||
and absf(left.g - right.g) < 0.01
|
||||
and absf(left.b - right.b) < 0.01
|
||||
and absf(left.a - right.a) < 0.01
|
||||
)
|
||||
|
||||
|
||||
func _check_action_button_disabled_reasons(failures: Array[String]) -> void:
|
||||
var scene = BattleSceneScript.new()
|
||||
scene.wait_button = Button.new()
|
||||
|
||||
Reference in New Issue
Block a user