mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
bd2525a55e
- 为扫帚子弹添加基础伤害属性并调整碰撞盒位置 - 扩展能量块攻击冷却时间配置,增加多种攻击类型 - 重构攻击逻辑,支持多类型攻击和互斥控制 - 优化子弹生成逻辑,根据类型执行不同行为
29 lines
970 B
GDScript
29 lines
970 B
GDScript
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)
|
|
)
|
|
attackCooldownMap[0] = 6000
|
|
attackCooldownMap[1] = 10000
|
|
attackCooldownMap[2] = 4000
|
|
attackCooldownMap[3] = 8000
|
|
attackCooldownMap[4] = 3000
|
|
attackCooldownMap[5] = 2000
|
|
attackCooldownMap[6] = 5000
|
|
attackMutexes = [1, 4]
|
|
func ai():
|
|
for i in 7:
|
|
tryAttack(i, [1, 3])
|
|
func attack(type: int):
|
|
if type == 0:
|
|
BulletBase.generate(ComponentManager.getBullet("SwingSword"), self , getTrackingAnchor(), getTrackingAnchor().angle_to_point(currentFocusedPosition))
|
|
elif type == 5:
|
|
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))
|