mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-06-11 14:17:13 +08:00
feat(伤害系统): 添加完美闪避机制和对应显示效果
- 新增完美闪避判定逻辑,当移动速度达到阈值时触发 - 添加黄色字体颜色用于显示完美闪避文本 - 完美闪避时获得双倍能量奖励并显示"PERFECT MISS" - 普通闪避仍显示"MISS"并给予基础能量奖励
This commit is contained in:
@@ -6,6 +6,7 @@ class_name DamageLabel
|
||||
@export var color1: Color = Color(1, 0, 0, 1)
|
||||
@export var color2: Color = Color(0, 1, 0, 1)
|
||||
@export var color3: Color = Color(0.5, 0.5, 0.5, 1)
|
||||
@export var color4: Color = Color.YELLOW
|
||||
|
||||
@onready var label: Label = $"%label"
|
||||
@onready var animator: AnimationPlayer = $"%animator"
|
||||
@@ -21,8 +22,12 @@ func _ready():
|
||||
label.label_settings.font_color = color2
|
||||
label.text = "+%s%s" % [damageValue, "!!!" if crit else ""]
|
||||
else:
|
||||
label.label_settings.font_color = color3
|
||||
label.text = "MISS"
|
||||
if crit:
|
||||
label.label_settings.font_color = color4
|
||||
label.text = "PERFECT MISS"
|
||||
else:
|
||||
label.label_settings.font_color = color3
|
||||
label.text = "MISS"
|
||||
animator.play("show")
|
||||
await animator.animation_finished
|
||||
queue_free()
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user