2026-03-17 22:58:04 +08:00
|
|
|
extends BulletBase
|
|
|
|
|
class_name ParryBallBullet
|
|
|
|
|
|
|
|
|
|
var cycler: CycleTimer
|
2026-04-24 18:09:24 +08:00
|
|
|
var atk: float = 1
|
2026-03-17 22:58:04 +08:00
|
|
|
|
|
|
|
|
func spawn():
|
|
|
|
|
cycler = launcher.getOrCreateCycleTimer("parry")
|
|
|
|
|
cycler.host(self )
|
2026-03-19 22:58:50 +08:00
|
|
|
launcher.sprintMultiplier += 1
|
|
|
|
|
func destroy(_beacuseMap: bool):
|
2026-04-24 18:09:24 +08:00
|
|
|
if is_instance_valid(launcher):
|
|
|
|
|
launcher.sprintMultiplier -= 1
|
2026-03-17 22:58:04 +08:00
|
|
|
func ai():
|
|
|
|
|
PresetBulletAI.selfRotate(self , 5)
|
2026-03-19 22:58:50 +08:00
|
|
|
hitbox.disabled = !launcher.sprinting # 玩家在冲刺时气的碰撞箱才生效
|
2026-03-22 08:16:35 +08:00
|
|
|
hitbox.global_position = launcher.position
|
2026-03-19 22:58:50 +08:00
|
|
|
func succeedToHit(_dmg: float, entity: EntityBase): # 当撞到敌人时
|
2026-03-18 22:39:44 +08:00
|
|
|
for bullet in BulletBase.generate(
|
|
|
|
|
ComponentManager.getBullet("QKSword"),
|
|
|
|
|
launcher,
|
|
|
|
|
entity.position,
|
|
|
|
|
0
|
|
|
|
|
):
|
|
|
|
|
if bullet is QKSwordBullet:
|
2026-03-21 14:37:46 +08:00
|
|
|
bullet.baseDamage = atk
|
2026-03-21 13:51:17 +08:00
|
|
|
bullet.position = entity.texture.global_position + MathTool.sampleInRing(200, 500)
|
2026-03-18 22:39:44 +08:00
|
|
|
bullet.tracer = entity
|
2026-03-19 22:58:50 +08:00
|
|
|
bullet.look_at(entity.getTrackingAnchor()) # 生成的乾坤剑面向敌人
|