1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-06-09 13:17:12 +08:00

feat(伤害系统): 添加完美闪避机制和对应显示效果

- 新增完美闪避判定逻辑,当移动速度达到阈值时触发
- 添加黄色字体颜色用于显示完美闪避文本
- 完美闪避时获得双倍能量奖励并显示"PERFECT MISS"
- 普通闪避仍显示"MISS"并给予基础能量奖励
This commit is contained in:
2025-09-07 14:23:58 +08:00
parent 6d469d739a
commit 49172a0088
2 changed files with 15 additions and 4 deletions
+8 -2
View File
@@ -173,9 +173,15 @@ func takeDamage(bullet: BulletBase, crit: bool):
hurtAnimator.play("hurt")
var baseDamage: float = bullet.damage * bullet.launcher.fields.get(FieldStore.Entity.DAMAGE_MULTIPILER) * randf_range(1 - GameRule.damageOffset, 1 + GameRule.damageOffset)
var damage = baseDamage + baseDamage * int(crit) * fields.get(FieldStore.Entity.CRIT_DAMAGE)
var perfectMiss = false
if sprinting:
playSound("miss")
storeEnergy(damage * 0.35)
if velocity.length() > (displace(velocity, true) * sprintMultiplier * 0.9).length():
perfectMiss = true
if perfectMiss:
storeEnergy(damage * 2)
else:
storeEnergy(damage * 0.35)
damage = 0
else:
playSound("hurt")
@@ -184,7 +190,7 @@ func takeDamage(bullet: BulletBase, crit: bool):
hit.emit(damage, bullet, crit)
healthChanged.emit(health)
health -= damage
DamageLabel.create(damage, crit, damageAnchor.global_position + MathTool.randv2_range(GameRule.damageLabelSpawnOffset))
DamageLabel.create(damage, crit || perfectMiss, damageAnchor.global_position + MathTool.randv2_range(GameRule.damageLabelSpawnOffset))
if isBoss and bullet.launcher.isPlayer():
bullet.launcher.setBoss(self)
if health <= 0: