1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 15:01:53 +08:00
Files
Dog-Lynx-And-HCN/scripts/Contents/Characters/Chick.gd
T
fallingshrimp e74414b53b feat(角色): 调整小鸡和公鸡角色属性及武器配置
- 修改小鸡角色的攻击冷却时间和激光数量范围
- 更新公鸡角色的武器为紫色水晶
- 调整小鸡角色的贴图、碰撞体积和位置参数
- 修改初始波数设置,开发环境从10开始
2026-01-24 08:34:03 +08:00

53 lines
1.9 KiB
GDScript

extends EntityBase
class_name Chick
var played: bool = false
func register():
fields[FieldStore.Entity.MAX_HEALTH] = 2500
fields[FieldStore.Entity.MOVEMENT_SPEED] = 0.4
attackCooldownMap[0] = 400
attackCooldownMap[1] = 10000
attackCooldownMap[2] = 3000
attackCooldownMap[3] = 2000
attackCooldownMap[4] = 2500
sprintMultiplier = 50
healthChanged.connect(
func(h):
if !played and h <= fields.get(FieldStore.Entity.MAX_HEALTH) * 0.1:
played = true
playSound("readyToDie")
)
func spawn():
texture.play("walk")
func ai():
tryAttack(4)
PresetEntityAI.follow(self, currentFocusedBoss, 0)
PresetEntityAI.distanceAttack(self, currentFocusedBoss, 0, 500, 2)
PresetEntityAI.distanceAttack(self, currentFocusedBoss, 500, 1000, 1)
PresetEntityAI.distanceAction(self, currentFocusedBoss, 1000, INF,
func():
PresetEntityAI.weightAttack(self, [0, 3], [5, 1], func(index): return index == 3)
)
func attack(type):
if type == 0:
var weaponPos = findWeaponAnchor("normal")
for i in randi_range(7, 16):
BulletBase.generate(ComponentManager.getBullet("Diamond"), self, weaponPos + MathTool.sampleInCircle(20), rotation + deg_to_rad(randf_range(-90, 90)))
elif type == 1:
var laserCount = randi_range(3, 4)
for i in laserCount:
BulletBase.generate(ComponentManager.getBullet("ChickLaser"), self, texture.global_position, deg_to_rad(360.0 / laserCount * i))
elif type == 2:
var weaponPos = findWeaponAnchor("normal")
BulletBase.generate(ComponentManager.getBullet("FireScan"), self, weaponPos, weaponPos.angle_to_point(currentFocusedBoss.getTrackingAnchor()))
elif type == 3:
BulletBase.generate(ComponentManager.getBullet("ChickSprint"), self, position, 0)
trySprint()
elif type == 4:
BulletBase.generate(ComponentManager.getBullet("FoxZhua"), self, findWeaponAnchor("foot"), deg_to_rad(90))
return true
func sprint():
move((currentFocusedBoss.position - position).normalized() * sprintMultiplier, true)