2026-03-16 23:35:22 +08:00
|
|
|
extends BulletBase
|
|
|
|
|
class_name ParrierBullet
|
|
|
|
|
|
2026-03-17 06:49:46 +08:00
|
|
|
@export var parryRate: float = 1
|
|
|
|
|
|
2026-03-16 23:35:22 +08:00
|
|
|
func hitBullet(bullet: BulletBase):
|
|
|
|
|
if BulletTool.canDamage(bullet, launcher):
|
2026-03-17 06:49:46 +08:00
|
|
|
if MathTool.rate(parryRate):
|
2026-03-17 22:15:28 +08:00
|
|
|
var eff = EffectController.create(ComponentManager.getEffect("Parry"), position + (bullet.position - position).normalized() * 150)
|
|
|
|
|
eff.modulate = bullet.modulate.blend(bullet.texture.modulate)
|
2026-03-17 06:49:46 +08:00
|
|
|
eff.shot()
|
|
|
|
|
bullet.tryDestroy()
|
2026-03-17 22:58:04 +08:00
|
|
|
var cycler = launcher.getOrCreateCycleTimer("parry", 2000, 100)
|
|
|
|
|
if len(cycler.bullets) < 5:
|
|
|
|
|
for b in BulletBase.generate(
|
|
|
|
|
ComponentManager.getBullet("ParryBall"),
|
|
|
|
|
launcher,
|
|
|
|
|
position,
|
|
|
|
|
0
|
|
|
|
|
):
|
|
|
|
|
if b is ParryBallBullet:
|
|
|
|
|
pass
|