Only H01, EG01 and B01 had reviewed pixel art, leaving most of the launch roster invisible in the battle stage. create_filler_sprites.py generates deterministic 96px silhouettes for the remaining five heroes and eight enemies, keyed by signature so each role reads differently. They are written with status "temporary_placeholder" in their manifests and must be replaced with reviewed art before release; they are not being passed off as final. Adding art for all characters exposed a real cap bug: the stage limited enemy units to five but let all six hero units spawn. The HUD now clamps both to five, and the visible-node test asserts exactly five hero units under an over-cap input. tools/run_p2_checks.sh still runs 15 gates; all pass.
99 lines
3.4 KiB
GDScript
99 lines
3.4 KiB
GDScript
extends SceneTree
|
|
|
|
## Visible-node cap evidence for P2-BAT-03.
|
|
##
|
|
## The contract allows at most five full enemy nodes and five visible hero
|
|
## nodes in the battle stage. Background heroes must not get a Sprite or a
|
|
## collision body. This test supplies more content than the cap and checks
|
|
## the actual node counts, including after the content shrinks again.
|
|
|
|
const OUTPUT_PATH := "res://artifacts/visible_node_test.json"
|
|
|
|
var _problems: Array = []
|
|
var _steps: Array = []
|
|
|
|
|
|
func _init() -> void:
|
|
_run.call_deferred()
|
|
|
|
|
|
func _run() -> void:
|
|
var scene = load("res://scripts/battle_scene.gd").new()
|
|
root.add_child(scene)
|
|
var battle := scene as BattleScene
|
|
battle.set_process(false)
|
|
battle.setup("zh_CN", "P3A-N03-SEMI", 10001)
|
|
|
|
var heroes: Array = []
|
|
for hero_id in ["H01", "H02", "H04", "H05", "H06", "H03"]:
|
|
heroes.append({"id": hero_id, "signature": "auto", "energy": 0.0, "energy_max": 100.0})
|
|
battle.hud.set_roster(heroes)
|
|
|
|
var enemies: Array = []
|
|
for index in range(7):
|
|
enemies.append({
|
|
"id": "E-R1-F1-V1#%d" % (index + 1),
|
|
"content_id": "E-R1-F1-V1",
|
|
"kind": "normal", "hp": 100.0, "max_hp": 100.0,
|
|
"armor": 1.0, "shield": 0.0, "weak_tag": "aoe",
|
|
"shield_broken": false, "dead": false,
|
|
})
|
|
battle.hud.set_enemies(enemies, "")
|
|
await process_frame
|
|
await process_frame
|
|
|
|
var counts := battle.hud.visible_node_counts()
|
|
_check(int(counts["enemy_units"]) <= 5, "enemy unit count %s exceeds 5" % str(counts["enemy_units"]))
|
|
_check(int(counts["enemy_plates"]) <= 5, "enemy plate count %s exceeds 5" % str(counts["enemy_plates"]))
|
|
_check(int(counts["enemy_hit_areas"]) <= 5, "enemy hit area count %s exceeds 5" % str(counts["enemy_hit_areas"]))
|
|
_check(int(counts["hero_units"]) <= 5, "visible hero unit count %s exceeds 5" % str(counts["hero_units"]))
|
|
_record("over_cap_content", counts)
|
|
|
|
# Non-visible heroes must not have spawned any art: only H01 has an atlas,
|
|
# so a leaked unit for H02/H04 would fail to configure and stay absent.
|
|
_check(int(counts["hero_units"]) == 5, "the hero cap should render exactly 5 units, got %s" % str(counts["hero_units"]))
|
|
|
|
# Shrinking the content must release the stale nodes.
|
|
battle.hud.set_enemies(enemies.slice(0, 1), "")
|
|
battle.hud.set_roster(heroes.slice(0, 1))
|
|
await process_frame
|
|
await process_frame
|
|
var shrunk := battle.hud.visible_node_counts()
|
|
_check(int(shrunk["enemy_units"]) == 1, "stale enemy units were not released")
|
|
_check(int(shrunk["hero_units"]) == 1, "stale hero units were not released")
|
|
_record("after_shrink", shrunk)
|
|
|
|
var passed := _problems.is_empty()
|
|
var report := {
|
|
"schema": 1,
|
|
"kind": "windroost_visible_node_test",
|
|
"overall": "PASS" if passed else "FAIL",
|
|
"problems": _problems,
|
|
"steps": _steps,
|
|
}
|
|
var artifact_dir := ProjectSettings.globalize_path("res://artifacts")
|
|
DirAccess.make_dir_recursive_absolute(artifact_dir)
|
|
var file := FileAccess.open(artifact_dir.path_join("visible_node_test.json"), FileAccess.WRITE)
|
|
if file != null:
|
|
file.store_string(JSON.stringify(report, "\t", true))
|
|
file.close()
|
|
|
|
for entry in _steps:
|
|
print("VISIBLE_NODE_STEP %s" % JSON.stringify(entry))
|
|
if passed:
|
|
print("VISIBLE_NODE_PASS caps and stale-node cleanup verified")
|
|
else:
|
|
print("VISIBLE_NODE_FAIL %s" % "; ".join(_problems))
|
|
quit(0 if passed else 1)
|
|
|
|
|
|
func _check(condition: bool, message: String) -> void:
|
|
if not condition:
|
|
_problems.append(message)
|
|
|
|
|
|
func _record(name: String, data: Dictionary) -> void:
|
|
var entry := data.duplicate()
|
|
entry["step"] = name
|
|
_steps.append(entry)
|