Improve battlefield terrain presentation
This commit is contained in:
@@ -9,6 +9,7 @@ func _init() -> void:
|
||||
_check_battle_visual_data(failures)
|
||||
_check_scene_texture_loading(failures)
|
||||
_check_hud_focus_text(failures)
|
||||
_check_terrain_and_unit_presentation(failures)
|
||||
_check_attack_motion_profiles(failures)
|
||||
_check_attack_motion_signal(failures)
|
||||
|
||||
@@ -120,6 +121,65 @@ func _check_hud_focus_text(failures: Array[String]) -> void:
|
||||
scene.free()
|
||||
|
||||
|
||||
func _check_terrain_and_unit_presentation(failures: Array[String]) -> void:
|
||||
var scene = BattleSceneScript.new()
|
||||
if not scene.state.load_battle("res://data/scenarios/001_yellow_turbans.json"):
|
||||
failures.append("could not load battle scene state for presentation helpers")
|
||||
scene.free()
|
||||
return
|
||||
if scene._terrain_key_at(Vector2i(3, 1)) != "F":
|
||||
failures.append("terrain helper should read forest cells")
|
||||
if not scene._terrain_key_at(Vector2i(-1, 0)).is_empty():
|
||||
failures.append("terrain helper should return empty outside the board")
|
||||
var background_fill: Color = scene._terrain_fill_color(Vector2i(0, 0), "G", true)
|
||||
var fallback_fill: Color = scene._terrain_fill_color(Vector2i(0, 0), "G", false)
|
||||
if background_fill.a >= 0.20:
|
||||
failures.append("background terrain fill should stay translucent over high-res art")
|
||||
if fallback_fill.a <= background_fill.a:
|
||||
failures.append("fallback terrain fill should be stronger than background fill")
|
||||
if scene._map_grid_color(true).a >= scene._map_grid_color(false).a:
|
||||
failures.append("background grid should be lighter than fallback grid")
|
||||
if scene._terrain_edge_color("F", "G").a <= 0.0:
|
||||
failures.append("forest edge blend should be visible")
|
||||
if not scene._should_draw_terrain_edge("F", "G", Vector2i(1, 0)):
|
||||
failures.append("forest should own forest/plain edge drawing")
|
||||
if scene._should_draw_terrain_edge("G", "F", Vector2i(-1, 0)):
|
||||
failures.append("plain should not redraw forest-owned edge")
|
||||
if scene._should_draw_terrain_edge("F", "F", Vector2i(1, 0)):
|
||||
failures.append("matching terrain should not draw edge blends")
|
||||
if scene._terrain_edge_width("W", "G") <= scene._terrain_edge_width("G", "F"):
|
||||
failures.append("water shoreline edge should be wider than grass blend")
|
||||
if not scene.state.load_battle("res://data/scenarios/002_sishui_gate.json"):
|
||||
failures.append("could not load Sishui Gate for road presentation helpers")
|
||||
else:
|
||||
var road_flags: Dictionary = scene._terrain_connection_flags(Vector2i(2, 4), "R")
|
||||
if not bool(road_flags.get("west", false)) or not bool(road_flags.get("east", false)):
|
||||
failures.append("Sishui Gate road should connect west/east at 3,5: %s" % str(road_flags))
|
||||
if bool(road_flags.get("north", false)) or bool(road_flags.get("south", false)):
|
||||
failures.append("Sishui Gate road should not connect north/south at 3,5: %s" % str(road_flags))
|
||||
if not scene.state.load_battle("res://data/scenarios/001_yellow_turbans.json"):
|
||||
failures.append("could not reload opening battle for unit presentation helpers")
|
||||
scene.free()
|
||||
return
|
||||
var generic_enemy: Dictionary = scene.state.get_unit("yellow_turban_2")
|
||||
var named_officer: Dictionary = scene.state.get_unit("cao_cao")
|
||||
if not scene._is_generic_enemy_unit(generic_enemy):
|
||||
failures.append("generic enemy unit should be marked as generic enemy")
|
||||
if scene._is_generic_enemy_unit(named_officer):
|
||||
failures.append("named officer should not be marked as generic enemy")
|
||||
if scene._is_generic_enemy_unit({"team": "enemy", "officer_id": "named_enemy"}):
|
||||
failures.append("enemy with officer_id should not be marked as generic")
|
||||
if scene._is_generic_enemy_unit({"team": "player", "officer_id": ""}):
|
||||
failures.append("player unit should not be marked as generic enemy")
|
||||
var enemy_modulate: Color = scene._unit_sprite_modulate(generic_enemy, false)
|
||||
if enemy_modulate == Color.WHITE or enemy_modulate.a >= 1.0:
|
||||
failures.append("generic enemy sprite should receive a distinct semi-real tint")
|
||||
var acted_modulate: Color = scene._unit_sprite_modulate(generic_enemy, true)
|
||||
if acted_modulate.a >= enemy_modulate.a:
|
||||
failures.append("acted generic enemy sprite should still dim below active tint")
|
||||
scene.free()
|
||||
|
||||
|
||||
func _check_attack_motion_profiles(failures: Array[String]) -> void:
|
||||
var scene = BattleSceneScript.new()
|
||||
if not scene.state.load_battle("res://data/scenarios/001_yellow_turbans.json"):
|
||||
|
||||
Reference in New Issue
Block a user