Enhance class attack VFX signatures

This commit is contained in:
2026-06-18 19:47:38 +09:00
parent 9daad0e539
commit c4d6a0c1cd
2 changed files with 133 additions and 4 deletions

View File

@@ -233,13 +233,23 @@ func _check_attack_motion_profiles(failures: Array[String]) -> void:
_check_synthetic_attack_profile(failures, scene, "champion", "heavy_strike")
_check_synthetic_attack_profile(failures, scene, "bandit", "heavy_strike")
scene._on_unit_action_motion_requested("xiahou_dun", Vector2i(1, 4), Vector2i(2, 4), "attack")
_check_stored_attack_motion(failures, scene, "xiahou_dun", "cavalry_charge", "melee", "attack")
_check_stored_attack_motion(failures, scene, "xiahou_dun", "cavalry_charge", "melee", "attack", "charge_dust")
scene._on_unit_action_motion_requested("yellow_turban_3", Vector2i(7, 6), Vector2i(7, 4), "attack")
_check_stored_attack_motion(failures, scene, "yellow_turban_3", "arrow", "ranged", "attack")
_check_stored_attack_motion(failures, scene, "yellow_turban_3", "arrow", "ranged", "attack", "piercing_trace")
_check_attack_vfx_signature(failures, scene, "arrow", "piercing_trace")
_check_attack_vfx_signature(failures, scene, "cavalry_charge", "charge_dust")
_check_attack_vfx_signature(failures, scene, "infantry_strike", "shield_spark")
_check_attack_vfx_signature(failures, scene, "command_strike", "command_ring")
_check_attack_vfx_signature(failures, scene, "heavy_strike", "shock_crack")
_check_unique_attack_vfx_signatures(failures, scene)
if scene._action_motion_duration("cavalry_charge") <= scene._action_motion_duration("slash"):
failures.append("cavalry charge animation should last longer than default slash")
if scene._action_motion_lunge_scale("arrow") >= scene._action_motion_lunge_scale("slash"):
failures.append("arrow animation should keep the archer mostly planted")
if scene._action_motion_impact_radius("heavy_strike") <= scene._action_motion_impact_radius("infantry_strike"):
failures.append("heavy strike impact radius should exceed infantry strike")
if scene._action_motion_impact_radius("cavalry_charge") <= scene._action_motion_impact_radius("arrow"):
failures.append("cavalry charge impact radius should exceed arrow impact")
if scene._action_motion_sfx("arrow") != "bow_release":
failures.append("arrow animation should use bow SFX")
if scene._action_motion_sfx("infantry_strike") != "slash":
@@ -269,7 +279,28 @@ func _check_synthetic_attack_profile(failures: Array[String], scene, class_id: S
failures.append("%s synthetic attack profile mismatch: expected %s got %s" % [class_id, expected_profile, profile])
func _check_stored_attack_motion(failures: Array[String], scene, unit_id: String, expected_profile: String, expected_style: String, expected_kind: String) -> void:
func _check_attack_vfx_signature(failures: Array[String], scene, profile: String, expected_signature: String) -> void:
var signature: String = scene._action_motion_vfx_signature(profile)
if signature != expected_signature:
failures.append("%s VFX signature mismatch: expected %s got %s" % [profile, expected_signature, signature])
if str(scene._action_motion_impact_cue(profile)).is_empty():
failures.append("%s should expose an impact cue" % profile)
if float(scene._action_motion_impact_radius(profile)) <= 0.0:
failures.append("%s should expose a positive impact radius" % profile)
func _check_unique_attack_vfx_signatures(failures: Array[String], scene) -> void:
var seen := {}
for profile in ["arrow", "cavalry_charge", "infantry_strike", "command_strike", "heavy_strike"]:
var signature: String = scene._action_motion_vfx_signature(profile)
if seen.has(signature):
failures.append("attack VFX signature should be unique: %s" % signature)
seen[signature] = true
if scene._action_motion_vfx_signature("slash") == scene._action_motion_vfx_signature("heavy_strike"):
failures.append("default slash should not share heavy strike VFX signature")
func _check_stored_attack_motion(failures: Array[String], scene, unit_id: String, expected_profile: String, expected_style: String, expected_kind: String, expected_vfx_signature: String) -> void:
if not scene.unit_action_motion_by_unit.has(unit_id):
failures.append("%s should store an action motion" % unit_id)
return
@@ -278,12 +309,19 @@ func _check_stored_attack_motion(failures: Array[String], scene, unit_id: String
var family := str(motion.get("attack_family", ""))
var style := str(motion.get("style", ""))
var kind := str(motion.get("kind", ""))
var signature := str(motion.get("vfx_signature", ""))
if profile != expected_profile or family != expected_profile:
failures.append("%s stored motion profile mismatch: %s" % [unit_id, str(motion)])
if style != expected_style:
failures.append("%s stored motion style mismatch: %s" % [unit_id, str(motion)])
if kind != expected_kind:
failures.append("%s stored motion kind mismatch: %s" % [unit_id, str(motion)])
if signature != expected_vfx_signature:
failures.append("%s stored motion VFX signature mismatch: %s" % [unit_id, str(motion)])
if str(motion.get("impact_cue", "")).is_empty():
failures.append("%s stored motion should include an impact cue: %s" % [unit_id, str(motion)])
if float(motion.get("impact_radius", 0.0)) <= 0.0:
failures.append("%s stored motion should include a positive impact radius: %s" % [unit_id, str(motion)])
if float(motion.get("duration", 0.0)) <= 0.0:
failures.append("%s stored motion duration should be positive: %s" % [unit_id, str(motion)])