# test_skill_state_arg_parity —— 40250 FUNC_SKILL uArg 到动作视图的映射。 # 覆盖 OnUseSkill: low nibble = loop count,bit 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)