Files
mtgodot-poc/project/weapon_trace_reach_affect_parity_test.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.5 KiB
GDScript

# weapon_trace_reach_affect_parity_test —— 40250 AFFECT_GEOMGYEONG。
#
# InstanceBaseEffect.cpp::__Warrior_SetGeomgyeongAffect 在开启铁剑气时把
# CActorInstance::SetReachScale 设为 1.5,关闭时恢复 1.0;该值同时被
# WeaponTrace::Update 与攻击碰撞使用。
extends SceneTree
const PlayerView = preload("res://ui/player_view.gd")
var _fail := 0
func _ck(condition: bool, message: String) -> void:
if not condition:
_fail += 1
printerr("FAIL: " + message)
func _run() -> void:
var pv := PlayerView.new()
root.add_child(pv)
await process_frame
var model := Node3D.new()
var weapon := MeshInstance3D.new()
weapon.name = "Weapon"
var box := BoxMesh.new()
box.size = Vector3(0.1, 0.1, 1.0)
weapon.mesh = box
model.add_child(weapon)
pv.add_child(model)
pv.model = model
pv._refresh_weapon_trace()
pv.set_affect(15, true, null)
var enabled: Dictionary = pv.weapon_trace_state()
_ck(is_equal_approx(float(enabled.get("reach_scale", 0.0)), 1.5),
"AFFECT_GEOMGYEONG sets WeaponTrace reach scale to 1.5")
pv.set_affect(15, false, null)
var disabled: Dictionary = pv.weapon_trace_state()
_ck(is_equal_approx(float(disabled.get("reach_scale", 0.0)), 1.0),
"removing AFFECT_GEOMGYEONG restores WeaponTrace reach scale to 1.0")
if _fail == 0:
print("PASS: weapon_trace_reach_affect_parity_test (Geomgyeong reach scale)")
quit(0)
else:
printerr("%d check(s) failed" % _fail)
quit(1)
func _init() -> void:
call_deferred("_run")