1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-31 00:11:54 +08:00

feat(战斗系统): 改进攻击逻辑和Kernyr角色技能

重构tryAttack方法,将needChargeUp参数改为更灵活的chargeConfig配置
优化Kernyr角色的攻击2技能,改为持续旋转发射子弹
This commit is contained in:
2026-03-28 10:30:23 +08:00
parent 2105de1131
commit 0a3dbd64ef
2 changed files with 30 additions and 15 deletions
+22 -14
View File
@@ -3,6 +3,7 @@ class_name Kernyr
var attack1Angle = 0
var attack0State = 0
var attack2Start = 0
func register():
fields[FieldStore.Entity.MAX_HEALTH] = 2000
@@ -13,7 +14,7 @@ func register():
attackMutexes = [2]
func ai():
for i in 3:
tryAttack(i)
tryAttack(i, [2])
func attack(type: int):
if type == 0:
for i in randi_range(7, 16):
@@ -38,19 +39,26 @@ func attack(type: int):
elif type == 2:
var anchor = currentFocusedBoss.position
var radius = 600
await sprintTo(anchor + Vector2(0, -radius), 0.1)
await TickTool.millseconds(500)
await chargeUp()
var count = 10.0
for i in count:
await sprintTo(anchor + Vector2.from_angle(deg_to_rad(i / count * 360.0 - 90)) * radius, 0.5)
for bullet in BulletBase.generate(
ComponentManager.getBullet("Egg"),
self ,
position,
0
):
if bullet is EggBullet:
bullet.look_at(anchor)
var i = 0
var currentAngle = 0
var time = 500.0
await sprintTo(anchor + Vector2(0, -radius), 0.1)
attack2Start = timeLived()
while timeLived() - attack2Start <= time:
var targetAngle = deg_to_rad(i / count * 360.0 - 90)
currentAngle = deg_to_rad((timeLived() - attack2Start) / time * 360.0 - 90)
position = anchor + Vector2.from_angle(currentAngle) * radius
if currentAngle >= targetAngle:
i += 1
for bullet in BulletBase.generate(
ComponentManager.getBullet("Egg"),
self ,
position,
0
):
if bullet is EggBullet:
bullet.look_at(anchor)
await TickTool.frame()
await TickTool.millseconds(2000)
await chargeUp()