From 9ae6d709e7fe93fba3c07b1d0eabe9f668f014fa Mon Sep 17 00:00:00 2001 From: chenxi Date: Tue, 25 Apr 2023 17:47:05 +0800 Subject: [PATCH] fix bug --- lua/app/module/battle/component/battle_unit_comp.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/app/module/battle/component/battle_unit_comp.lua b/lua/app/module/battle/component/battle_unit_comp.lua index e732e494..d4dc8d75 100644 --- a/lua/app/module/battle/component/battle_unit_comp.lua +++ b/lua/app/module/battle/component/battle_unit_comp.lua @@ -1168,9 +1168,9 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus) end local hp = self.unitEntity:getHp() local x, y = self.baseObject:fastGetLocalPosition() + local damage = num if num < 0 then -- 伤害 local delayTime = 0 - local damage = num if shieldHpDiff < 0 then damage = damage - shieldHpDiff delayTime = BattleConst.EFFECT_NUMBER_DELAY @@ -1200,13 +1200,13 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus) local hpPercent = self.unitEntity:getHpPercent() self.battleController:refreshHp(self.side, hp, hpPercent) if atker:getIsCentralizedAttack() then - if self.currState == UNIT_STATE.IDLE then + if damage < 0 and self.currState == UNIT_STATE.IDLE then self:playHurt() end else if self.unitEntity:getIsDead() then self:changeState(UNIT_STATE.DEAD) - elseif self.currState == UNIT_STATE.IDLE then + elseif damage < 0 and self.currState == UNIT_STATE.IDLE then self:playHurt() end end