mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
32f1f545e2
- 调整格挡子弹的基础伤害为0 - 增加气力上限和格挡次数的可配置性 - 实现乾坤剑伤害随武器等级提升 - 更新武器描述文本以反映新机制 - 修复乾坤剑生命周期与生成速度的同步问题
31 lines
1.1 KiB
GDScript
31 lines
1.1 KiB
GDScript
extends BulletBase
|
|
class_name ParrierBullet
|
|
|
|
@export var parryRate: float = 1
|
|
|
|
var parryiedTimes: int = 0
|
|
var maxParryTimes: int = 1
|
|
var maxBallCount: int = 3
|
|
var atk: float = 0
|
|
|
|
func hitBullet(bullet: BulletBase): # 当前子弹与其他子弹相撞
|
|
if BulletTool.canDamage(bullet, launcher): # 其他子弹可以使当前子弹的发射者受伤吗?
|
|
if parryiedTimes < maxParryTimes && MathTool.rate(parryRate): # 一个刀光最多格挡多少个敌方子弹?
|
|
parryiedTimes += 1
|
|
# 生成格挡特效
|
|
var eff = EffectController.create(ComponentManager.getEffect("Parry"), position + (bullet.position - position).normalized() * 150) # 从子弹位置,面向其他子弹的方向前进150
|
|
eff.modulate = bullet.modulate.blend(bullet.texture.modulate)
|
|
eff.shot()
|
|
# 摧毁其他子弹
|
|
bullet.tryDestroy()
|
|
var cycler = launcher.getOrCreateCycleTimer("parry", 2000, 100)
|
|
if len(cycler.bullets) < maxBallCount: # 玩家最多只能拥有5点气
|
|
for b in BulletBase.generate(
|
|
ComponentManager.getBullet("ParryBall"), # 生成气的子弹
|
|
launcher,
|
|
position,
|
|
0
|
|
):
|
|
if b is ParryBallBullet:
|
|
b.atk = atk
|