Files
mtgodot-poc/project/test_warrior_mental_skills_regression.gd
T
shenandshen 66d217b313 feat(client): 完成40250客户端核心功能1:1对齐与桥梁高度采样修复
- 桥梁与静态物体高度采样修复:
  - 严格对齐 40250 CMapOutdoor::GetHeight 与 CAttributeInstance::GetHeight
  - 解析 .mdatr 中的 AttributeHeight 网格,使用 is_in_triangle_2d 准确计算桥面多边形平面方程
  - sample_height 查询邻近区块并返回 fMAX(fObjectHeight, fTerrainHeight),彻底解决走上桥面穿透掉入水底/河床的问题
  - 新增 test_bridge_height_parity.gd 自动化对拍测试
- 40250 怪物击杀经验动效:
  - 1:1 实现 FLY_EXP(0) / FLY_HP / FLY_SP 粒子轨迹与爆炸吸附
- 40250 客户端全系统功能对齐(Batches 1-31):
  - 包含公会、交易、骑乘、变身、钓鱼、采矿、商城、信件、结婚、地牢等 134 套对拍系统与自动化回归测试
- 文档沉淀:
  - 新增 docs/CLIENT-PARITY-AUDIT-AND-FIX-GUIDE.md 客户端对拍缺陷发现与修复工程指南
2026-09-19 08:51:25 -07:00

82 lines
2.6 KiB
GDScript

extends SceneTree
const AssetRoot = preload("res://asset_root.gd")
const PlayerView = preload("res://ui/player_view.gd")
func _init() -> void:
call_deferred("_run")
func _run() -> void:
print("=== Running test_warrior_mental_skills_regression ===")
var fails := 0
var check = func(cond: bool, msg: String):
if not cond:
fails += 1
print("FAIL: ", msg)
else:
print("OK: ", msg)
var root_dir := AssetRoot.path()
var pv := PlayerView.new()
get_root().add_child(pv)
var ok = pv.build(root_dir, 0) # warrior male
check.call(ok, "warrior PlayerView built")
var skills = ["gigongcham", "gyeoksan", "daejin", "cheongeun", "geompung"]
for sname in skills:
print("\n--- Testing skill: ", sname, " ---")
var finished := [false]
var on_finished = func():
finished[0] = true
pv.anim.playback_finished.connect(on_finished, CONNECT_ONE_SHOT)
var cast_ok = pv.play_skill_motion(sname, 0)
check.call(cast_ok, "play_skill_motion(%s) returned true" % sname)
check.call(pv._state == "__skill", "pv._state is '__skill'")
check.call(bool(pv.anim.get("playing")), "anim.playing is true at start")
var dur = float(pv.anim.get_duration()) if pv.anim.has_method("get_duration") else 2.0
# Run frames until playback_finished or timeout
var frames = 0
while not finished[0] and frames < 400:
await process_frame
frames += 1
check.call(finished[0], "%s emitted playback_finished (frames=%d)" % [sname, frames])
check.call(pv._state == "wait", "pv._state reset to 'wait'")
check.call(bool(pv.anim.get("playing")), "anim.playing is true after playback_finished")
# Transition to run
pv.set_anim_state("run")
check.call(pv._state == "run", "pv._state changed to 'run'")
check.call(bool(pv.anim.get("playing")), "anim.playing is true during run")
var t0 = float(pv.anim.get_time()) if pv.anim.has_method("get_time") else 0.0
for f in range(15):
await process_frame
var t1 = float(pv.anim.get_time()) if pv.anim.has_method("get_time") else 0.0
check.call(t1 > t0, "run animation is advancing (t0=%.3f, t1=%.3f)" % [t0, t1])
# Reset to wait for next skill
pv.set_anim_state("wait")
for f in range(5):
await process_frame
# Clean up
if is_instance_valid(pv.anim):
pv.anim.free()
if is_instance_valid(pv.model):
pv.model.free()
pv.free()
if ClassDB.class_exists("Metin2Model"):
var m_dummy: Object = ClassDB.instantiate("Metin2Model")
m_dummy.call("clear_texture_cache")
m_dummy.free()
await process_frame
await process_frame
print("\n=== Completed test_warrior_mental_skills_regression with %d failures ===" % fails)
if fails == 0:
print("ALL PASS")
quit(fails)