1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-06-04 02:37:12 +08:00

fix: 限制能量值为非负,调整伤害造成的能量存储比例

This commit is contained in:
2025-08-27 20:03:57 +08:00
parent 27e45b4551
commit b4d11ee98a
+2 -1
View File
@@ -70,6 +70,7 @@ func _ready():
currentFocusedBoss = get_tree().get_nodes_in_group("players")[0]
func _process(_delta):
health = clamp(health, 0, fields.get(FieldStore.Entity.MAX_HEALTH))
energy = clamp(energy, 0, INF)
for i in inventory:
inventory[i] = clamp(inventory[i], 0, inventoryMax[i])
func _physics_process(_delta: float) -> void:
@@ -103,7 +104,7 @@ func takeDamage(bullet: BulletBase, crit: bool):
damage = 0
else:
playSound("hurt")
bullet.launcher.storeEnergy(damage * 0.15)
bullet.launcher.storeEnergy(damage * 0.05)
storeEnergy(damage * -0.1)
health -= damage
DamageLabel.create(damage, crit, damageAnchor.global_position + MathTool.randv2_range(GameRule.damageLabelSpawnOffset))