mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
feat(战斗系统): 重构子弹追踪逻辑,使用实体当前焦点位置替代鼠标位置
修改所有子弹追踪逻辑,统一使用launcher.currentFocusedPosition作为目标位置 在EntityBase中新增currentFocusedPosition字段,用于存储当前焦点位置 调整MTY角色的攻击距离参数,使用常量定义最小招架和攻击距离
This commit is contained in:
@@ -38,7 +38,7 @@ func applyDot():
|
||||
bullet.arg2 = clAtkSpeed
|
||||
if bullet is AcidP:
|
||||
bullet.arg1 = pOffset
|
||||
bullet.arg2 = EntityTool.findClosetEntity(get_global_mouse_position(), get_tree(), !launcher.isPlayer(), launcher.isPlayer())
|
||||
bullet.arg2 = EntityTool.findClosetEntity(launcher.currentFocusedPosition, get_tree(), !launcher.isPlayer(), launcher.isPlayer())
|
||||
if bullet is AcidC:
|
||||
bullet.arg1 = cAtk
|
||||
await TickTool.millseconds(1000.0 / f)
|
||||
|
||||
@@ -12,15 +12,15 @@ func register():
|
||||
hitbox.disabled = true
|
||||
func ai():
|
||||
if timeLived() < waitTime:
|
||||
PresetBulletAI.lockLauncher(self, launcher, true)
|
||||
rotation = position.angle_to_point(get_global_mouse_position()) + offsetRotation
|
||||
PresetBulletAI.lockLauncher(self , launcher, true)
|
||||
rotation = position.angle_to_point(launcher.currentFocusedPosition) + offsetRotation
|
||||
return
|
||||
else:
|
||||
trail.emitting = true
|
||||
hitbox.disabled = false
|
||||
speed = (1 - lifeTimePercent()) * initialSpeed
|
||||
baseDamage = speed * atk
|
||||
PresetBulletAI.forward(self, rotation)
|
||||
PresetBulletAI.forward(self , rotation)
|
||||
if speed < 1:
|
||||
tryDestroy()
|
||||
func succeedToHit(_dmg: float, _entity: EntityBase):
|
||||
|
||||
@@ -8,7 +8,7 @@ func spawn():
|
||||
CameraManager.playAnimation("bigLaser")
|
||||
baseDamage *= launcher.fields[FieldStore.Entity.ATTACK_SPEED]
|
||||
func ai():
|
||||
rotation = lerp_angle(rotation, ((get_global_mouse_position() - position).angle()), 0.1)
|
||||
rotation = lerp_angle(rotation, ((launcher.currentFocusedPosition - position).angle()), 0.1)
|
||||
position = launcher.texture.global_position
|
||||
func applyDot():
|
||||
hitbox.disabled = true
|
||||
|
||||
@@ -21,5 +21,5 @@ func spawn():
|
||||
await TickTool.millseconds(waitTime)
|
||||
tryDestroy()
|
||||
func ai():
|
||||
PresetBulletAI.lockLauncher(self, launcher, true)
|
||||
rotation = position.angle_to_point(get_global_mouse_position())
|
||||
PresetBulletAI.lockLauncher(self , launcher, true)
|
||||
rotation = position.angle_to_point(launcher.currentFocusedPosition)
|
||||
|
||||
@@ -10,8 +10,8 @@ func ai():
|
||||
if accelerating:
|
||||
if roundBullets.count(self ) < 1:
|
||||
accelerating = false
|
||||
rotation = lerp_angle(rotation, position.angle_to_point(get_global_mouse_position()), 0.1)
|
||||
speedV2 += (get_global_mouse_position() - position).normalized() * 1
|
||||
rotation = lerp_angle(rotation, position.angle_to_point(launcher.currentFocusedPosition), 0.1)
|
||||
speedV2 += (launcher.currentFocusedPosition - position).normalized() * 1
|
||||
elif speed < 1 || baseDamage < 1:
|
||||
tryDestroy()
|
||||
speedV2 *= 0.995
|
||||
|
||||
@@ -10,10 +10,10 @@ var dmg5: float = 0
|
||||
var splitAngle: float = 10
|
||||
|
||||
func ai():
|
||||
PresetBulletAI.lockLauncher(self, launcher, true)
|
||||
PresetBulletAI.lockLauncher(self , launcher, true)
|
||||
rotation = lerp_angle(
|
||||
rotation,
|
||||
position.angle_to_point(get_global_mouse_position()),
|
||||
position.angle_to_point(launcher.currentFocusedPosition),
|
||||
rotates
|
||||
)
|
||||
func succeedToHit(_dmg: float, _entity: EntityBase):
|
||||
|
||||
@@ -6,7 +6,7 @@ class_name WuweiBullet
|
||||
func ai():
|
||||
if canMove:
|
||||
PresetBulletAI.lockLauncher(self , launcher, true)
|
||||
PresetBulletAI.trace(self , get_global_mouse_position(), 0.1)
|
||||
PresetBulletAI.trace(self , launcher.currentFocusedPosition, 0.1)
|
||||
|
||||
func shoot():
|
||||
for bullet in BulletBase.generate(
|
||||
|
||||
Reference in New Issue
Block a user