2025-08-27 13:05:20 +08:00
|
|
|
extends EntityBase
|
2025-09-07 09:25:51 +08:00
|
|
|
class_name Bear # 攻击方式模仿泰拉瑞亚光之女皇
|
|
|
|
|
|
2025-09-13 19:55:51 +08:00
|
|
|
@onready var sprintParticle: GPUParticles2D = $"%sprintParticle"
|
|
|
|
|
|
2025-09-07 09:48:03 +08:00
|
|
|
func register():
|
|
|
|
|
fields[FieldStore.Entity.MAX_HEALTH] = 2000
|
|
|
|
|
fields[FieldStore.Entity.MOVEMENT_SPEED] = 0.25
|
2025-09-13 19:55:51 +08:00
|
|
|
attackCooldownMap[0] = 3000
|
|
|
|
|
attackCooldownMap[1] = 10000
|
|
|
|
|
attackCooldownMap[2] = 8000
|
|
|
|
|
attackCooldownMap[3] = 13000
|
|
|
|
|
sprintMultiplier = 120
|
2025-09-07 09:48:03 +08:00
|
|
|
func spawn():
|
|
|
|
|
texture.play("walk")
|
2025-09-07 09:25:51 +08:00
|
|
|
func ai():
|
2025-09-07 09:48:03 +08:00
|
|
|
PresetEntityAI.follow(self, currentFocusedBoss, 0)
|
2025-09-13 19:55:51 +08:00
|
|
|
for i in range(4):
|
|
|
|
|
tryAttack(i)
|
2025-09-07 09:25:51 +08:00
|
|
|
func attack(type):
|
2025-09-07 09:48:03 +08:00
|
|
|
var weaponPos = findWeaponAnchor("normal")
|
2025-09-07 09:25:51 +08:00
|
|
|
if type == 0:
|
2025-09-13 19:55:51 +08:00
|
|
|
for i in range(20):
|
|
|
|
|
for bullet in BulletBase.generate(preload("res://components/Bullets/BossAttack/Bear/ArrowSeven.tscn"), self, weaponPos, deg_to_rad(randf_range(0, 360))):
|
|
|
|
|
bullet.tracer = currentFocusedBoss
|
2025-09-07 11:17:44 +08:00
|
|
|
elif type == 1:
|
2025-09-13 19:55:51 +08:00
|
|
|
await sprintTo(currentFocusedBoss.position - Vector2(200, 200), 0.25)
|
|
|
|
|
for i in range(6):
|
|
|
|
|
BulletBase.generate(preload("res://components/Bullets/BossAttack/Bear/SunDance.tscn"), self, weaponPos, deg_to_rad(randf_range(0, 360)))
|
|
|
|
|
elif type == 2:
|
|
|
|
|
for i in range(13):
|
|
|
|
|
for bullet in BulletBase.generate(preload("res://components/Bullets/BossAttack/Bear/ForeverRainbow.tscn"), self, weaponPos, 0):
|
|
|
|
|
bullet.rotation = 360 / 13.0 * i
|
|
|
|
|
elif type == 3:
|
|
|
|
|
await sprintTo(currentFocusedBoss.position - Vector2(500, 0), 0.25)
|
|
|
|
|
sprintParticle.emitting = true
|
|
|
|
|
canRunAi = false
|
|
|
|
|
await TickTool.millseconds(1500)
|
|
|
|
|
BulletBase.generate(preload("res://components/Bullets/BearSprint.tscn"), self, weaponPos, 0)
|
|
|
|
|
await trySprint()
|
|
|
|
|
sprintParticle.emitting = false
|
|
|
|
|
canRunAi = true
|
2025-09-07 11:17:44 +08:00
|
|
|
return true
|
2025-09-13 19:55:51 +08:00
|
|
|
func sprint():
|
|
|
|
|
move((currentFocusedBoss.position - position).normalized() * sprintMultiplier * Vector2(1, 0), true)
|