Polish chapter one battle presentation
This commit is contained in:
137
tools/smoke_chapter_one_polish.gd
Normal file
137
tools/smoke_chapter_one_polish.gd
Normal file
@@ -0,0 +1,137 @@
|
||||
extends SceneTree
|
||||
|
||||
const BattleSceneScript := preload("res://scripts/scenes/battle_scene.gd")
|
||||
|
||||
const CHAPTER_ONE_SCENARIOS := [
|
||||
"res://data/scenarios/001_yellow_turbans.json",
|
||||
"res://data/scenarios/002_sishui_gate.json",
|
||||
"res://data/scenarios/003_xingyang_ambush.json",
|
||||
"res://data/scenarios/004_qingzhou_campaign.json",
|
||||
"res://data/scenarios/005_puyang_raid.json",
|
||||
"res://data/scenarios/006_dingtao_counterattack.json",
|
||||
"res://data/scenarios/007_xian_emperor_escort.json",
|
||||
"res://data/scenarios/008_wan_castle_escape.json",
|
||||
"res://data/scenarios/009_xiapi_siege.json"
|
||||
]
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
var failures: Array[String] = []
|
||||
_check_chapter_one_scenarios_have_visual_grounding(failures)
|
||||
_check_edge_scroll_layout_contract(failures)
|
||||
_check_readability_contract(failures)
|
||||
_check_dialogue_localization_and_side(failures)
|
||||
_check_pixel_unit_helpers(failures)
|
||||
|
||||
if failures.is_empty():
|
||||
print("chapter one polish smoke ok")
|
||||
quit(0)
|
||||
return
|
||||
|
||||
for failure in failures:
|
||||
push_error(failure)
|
||||
quit(1)
|
||||
|
||||
|
||||
func _check_chapter_one_scenarios_have_visual_grounding(failures: Array[String]) -> void:
|
||||
var scene = BattleSceneScript.new()
|
||||
for scenario_path in CHAPTER_ONE_SCENARIOS:
|
||||
if not scene.state.load_battle(scenario_path):
|
||||
failures.append("could not load chapter one scenario: %s" % scenario_path)
|
||||
continue
|
||||
var background_path: String = scene.state.get_map_background_path()
|
||||
if background_path.is_empty():
|
||||
failures.append("scenario is missing a map background: %s" % scenario_path)
|
||||
continue
|
||||
if not FileAccess.file_exists(background_path):
|
||||
failures.append("scenario background does not exist: %s -> %s" % [scenario_path, background_path])
|
||||
scene.free()
|
||||
|
||||
|
||||
func _check_edge_scroll_layout_contract(failures: Array[String]) -> void:
|
||||
var scene = BattleSceneScript.new()
|
||||
if not scene.state.load_battle("res://data/scenarios/009_xiapi_siege.json"):
|
||||
failures.append("could not load large chapter one map for edge scrolling")
|
||||
scene.free()
|
||||
return
|
||||
|
||||
var view_rect := scene._map_view_rect()
|
||||
var board_size := scene._board_size()
|
||||
if view_rect.size.x < 160.0 or view_rect.size.y < 160.0:
|
||||
failures.append("map view rect should keep a usable minimum size")
|
||||
if board_size.x <= view_rect.size.x and board_size.y <= view_rect.size.y:
|
||||
failures.append("chapter one should include at least one map large enough to exercise edge scrolling")
|
||||
|
||||
scene._reset_board_scroll()
|
||||
if scene.board_scroll_offset.x > 0.0 or scene.board_scroll_offset.y > 0.0:
|
||||
failures.append("reset board scroll should never push the map past the top-left origin")
|
||||
|
||||
var far_offset := scene._clamped_board_scroll_offset(Vector2(-9999.0, -9999.0))
|
||||
var min_x := minf(0.0, view_rect.size.x - board_size.x)
|
||||
var min_y := minf(0.0, view_rect.size.y - board_size.y)
|
||||
if far_offset.x < min_x - 0.01 or far_offset.y < min_y - 0.01:
|
||||
failures.append("edge scroll clamp should stay inside the visible map bounds")
|
||||
if far_offset.x > 0.01 or far_offset.y > 0.01:
|
||||
failures.append("edge scroll clamp should not create positive board offsets")
|
||||
|
||||
scene.board_scroll_offset = far_offset
|
||||
var first_cell_screen := scene._rect_for_cell(Vector2i(0, 0)).position + Vector2(4.0, 4.0)
|
||||
if scene._cell_from_screen(first_cell_screen) != Vector2i(0, 0):
|
||||
failures.append("screen-to-cell mapping should stay stable after scrolling")
|
||||
scene.free()
|
||||
|
||||
|
||||
func _check_readability_contract(failures: Array[String]) -> void:
|
||||
var scene = BattleSceneScript.new()
|
||||
scene._create_hud()
|
||||
if scene.dialogue_text_panel.custom_minimum_size.y < 160.0:
|
||||
failures.append("dialogue text panel should be tall enough for multi-line story text")
|
||||
if scene.dialogue_text_label.custom_minimum_size.y < 130.0:
|
||||
failures.append("dialogue label should reserve enough height to avoid clipping")
|
||||
if scene.dialogue_text_label.autowrap_mode != TextServer.AUTOWRAP_WORD_SMART:
|
||||
failures.append("dialogue text should use smart Korean-friendly wrapping")
|
||||
if scene.briefing_objective_panel.custom_minimum_size.y < 120.0:
|
||||
failures.append("briefing objective panel should reserve enough height for victory and defeat text")
|
||||
if scene.briefing_objective_toggle_button == null:
|
||||
failures.append("briefing objective section should have a close/open button")
|
||||
elif scene.briefing_objective_toggle_button.text != "닫기":
|
||||
failures.append("briefing objective button should start with a clear close label")
|
||||
scene.free()
|
||||
|
||||
|
||||
func _check_dialogue_localization_and_side(failures: Array[String]) -> void:
|
||||
var scene = BattleSceneScript.new()
|
||||
var lines := scene._normalized_dialogue_lines([
|
||||
{"speaker": "Cao Cao", "text": "전열을 세워라."},
|
||||
{"speaker": "Lu Bu", "text": "조조를 짓밟아라."},
|
||||
{"speaker": "Qingzhou Chief", "text": "마을 곡식을 내놓아라."},
|
||||
{"speaker": "Camp Merchant", "text": "군막에 물자가 남았습니다."}
|
||||
])
|
||||
if lines.size() != 4:
|
||||
failures.append("dialogue normalization should keep all valid chapter one lines")
|
||||
scene.free()
|
||||
return
|
||||
if lines[0].get("speaker", "") != "조조" or lines[0].get("side", "") != "left":
|
||||
failures.append("Cao Cao dialogue should localize to Korean on the left")
|
||||
if lines[1].get("speaker", "") != "여포" or lines[1].get("side", "") != "right":
|
||||
failures.append("enemy officer dialogue should localize to Korean on the right")
|
||||
if lines[2].get("speaker", "") != "청주 두령" or lines[2].get("side", "") != "right":
|
||||
failures.append("chapter one named enemy dialogue should be localized and right-sided")
|
||||
if lines[3].get("speaker", "") != "군막 상인" or lines[3].get("side", "") != "right":
|
||||
failures.append("camp merchant dialogue should be localized and right-sided by default")
|
||||
scene.free()
|
||||
|
||||
|
||||
func _check_pixel_unit_helpers(failures: Array[String]) -> void:
|
||||
var scene = BattleSceneScript.new()
|
||||
for method_name in [
|
||||
"_draw_pixel_unit_sprite",
|
||||
"_draw_pixel_infantry",
|
||||
"_draw_pixel_archer",
|
||||
"_draw_pixel_cavalry",
|
||||
"_draw_pixel_strategist",
|
||||
"_draw_pixel_heavy"
|
||||
]:
|
||||
if not scene.has_method(method_name):
|
||||
failures.append("missing pixel-map unit helper: %s" % method_name)
|
||||
scene.free()
|
||||
Reference in New Issue
Block a user