2026-04-26 14:02:02 +08:00
|
|
|
extends EntityBase
|
|
|
|
|
class_name EnergyBlockEntity
|
|
|
|
|
|
|
|
|
|
func register():
|
|
|
|
|
fields[FieldStore.Entity.MAX_HEALTH] = 5000
|
|
|
|
|
hit.connect(
|
|
|
|
|
func(damage: float, bullet: BulletBase, _crit: bool):
|
|
|
|
|
bullet.launcher.storeEnergy(damage)
|
|
|
|
|
)
|
2026-05-01 06:38:07 +08:00
|
|
|
attackCooldownMap[0] = 6000
|
|
|
|
|
attackCooldownMap[1] = 10000
|
|
|
|
|
attackCooldownMap[2] = 4000
|
|
|
|
|
attackCooldownMap[3] = 8000
|
|
|
|
|
attackCooldownMap[4] = 3000
|
|
|
|
|
attackCooldownMap[5] = 2000
|
|
|
|
|
attackCooldownMap[6] = 5000
|
|
|
|
|
attackMutexes = [1, 4]
|
2026-04-26 14:02:02 +08:00
|
|
|
func ai():
|
2026-05-01 06:38:07 +08:00
|
|
|
for i in 7:
|
|
|
|
|
tryAttack(i, [1, 3])
|
2026-04-26 14:02:02 +08:00
|
|
|
func attack(type: int):
|
|
|
|
|
if type == 0:
|
2026-05-01 06:38:07 +08:00
|
|
|
BulletBase.generate(ComponentManager.getBullet("SwingSword"), self , getTrackingAnchor(), getTrackingAnchor().angle_to_point(currentFocusedPosition))
|
|
|
|
|
elif type == 5:
|
2026-04-26 14:02:02 +08:00
|
|
|
var track = getTrackingAnchor()
|
|
|
|
|
var bullet = BulletTool.findClosetBulletCanDamage(track, get_tree(), self , 200)
|
|
|
|
|
if is_instance_valid(bullet):
|
|
|
|
|
BulletBase.generate(ComponentManager.getBullet("Parrier"), self , track, track.angle_to_point(bullet.position))
|