Files
mtgodot-poc/project/weapon_reach_scale_attack_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

51 lines
1.5 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.
# weapon_reach_scale_attack_parity_test —— 40250 __NormalAttackProcess。
#
# ActorInstanceCollisionDetection.cpp 将刀尖球从 last 到 current 的位移向量
# 乘以 __GetReachScale()AFFECT_GEOMGYEONG=1.5 不只影响视觉刀光,也影响
# 攻击命中位置。
extends SceneTree
const NetPlay = preload("res://net_play.gd")
var _fail := 0
func _ck(condition: bool, message: String) -> void:
if not condition:
_fail += 1
printerr("FAIL: " + message)
func _run() -> void:
var np := NetPlay.new()
root.add_child(np)
var view := Node.new()
var script := GDScript.new()
script.source_code = """
extends Node
func weapon_reach_scale() -> float:
return 1.5
"""
script.reload()
view.set_script(script)
root.add_child(view)
np.player_view = view
if not np.has_method("_attack_sample_positions"):
_ck(false, "attack sample path exposes the reach-scaled endpoint helper")
else:
var out: Dictionary = np._attack_sample_positions(
Vector3(0.0, 0.0, 0.0), Vector3(10.0, 0.0, 0.0), 0.0, Vector3.ZERO)
_ck(Vector3(out.get("last", Vector3.ZERO)).is_equal_approx(Vector3.ZERO),
"attack sweep keeps the last sample unchanged")
_ck(Vector3(out.get("pos", Vector3.ZERO)).is_equal_approx(Vector3(15.0, 0.0, 0.0)),
"AFFECT_GEOMGYEONG reach scale extends the attack sweep by 1.5")
if _fail == 0:
print("PASS: weapon_reach_scale_attack_parity_test (attack sweep reach scale)")
quit(0)
else:
printerr("%d check(s) failed" % _fail)
quit(1)
func _init() -> void:
call_deferred("_run")