Files
mtgodot-poc/project/test_skill_state_arg_parity.gd
T
shenandshen c93894313a fix: 装备属性面板避让逻辑 + 多项功能更新
- item_tooltip_view.gd: 新增 avoid_rect 属性,tooltip 与装备窗口重叠时自动推到左侧
- inventory_ui.gd: 悬停装备时传入窗口矩形作为避让区域
- 包含其他累积的功能开发和测试文件
2026-09-21 16:38:59 -07:00

52 lines
1.6 KiB
GDScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# test_skill_state_arg_parity —— 40250 FUNC_SKILL uArg 到动作视图的映射。
# 覆盖 OnUseSkill: low nibble = loop countbit 4 = moving-skill。
extends SceneTree
const NetWorld = preload("res://net_world.gd")
class FakeSkillTable extends RefCounted:
func motion_name_by_idx(idx: int) -> String:
return "skill_%d" % idx
class SkillView extends Node3D:
var calls := []
var states := []
func play_skill_motion(name: String, grade: int = 0, loop_count: int = 0,
moving_skill: bool = false) -> bool:
calls.append([name, grade, loop_count, moving_skill])
return true
func set_anim_state(state: String) -> void:
states.append(state)
var _fail := 0
func _ck(ok: bool, message: String) -> void:
if not ok:
_fail += 1
printerr("FAIL: " + message)
func _init() -> void:
var nw := NetWorld.new()
var view := SkillView.new()
get_root().add_child(nw)
nw.skill_table = FakeSkillTable.new()
# 0x12 = loop count 2 + IsUsingMovingSkill bit (1 << 4).
nw._apply_anim(view, NetWorld.FUNC_SKILL | 7, false, NetWorld.WALKMODE_RUN, false, 0x12)
_ck(view.calls == [["skill_7", 0, 2, true]],
"FUNC_SKILL uArg -> play_skill_motion(name, grade, loop_count, moving)")
# A normal one-shot with no loop override must not inherit the moving bit.
nw._apply_anim(view, NetWorld.FUNC_SKILL | 3, false, NetWorld.WALKMODE_RUN, false, 0)
_ck(view.calls[-1] == ["skill_3", 0, 0, false],
"zero skill arg -> ordinary one-shot defaults")
view.free()
nw.free()
if _fail == 0:
print("PASS: test_skill_state_arg_parity")
quit(0)
else:
printerr("%d check(s) failed" % _fail)
quit(1)