This commit is contained in:
chenxi 2023-04-25 17:47:05 +08:00
parent 79b546d2f8
commit 9ae6d709e7

View File

@ -1168,9 +1168,9 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus)
end end
local hp = self.unitEntity:getHp() local hp = self.unitEntity:getHp()
local x, y = self.baseObject:fastGetLocalPosition() local x, y = self.baseObject:fastGetLocalPosition()
local damage = num
if num < 0 then -- 伤害 if num < 0 then -- 伤害
local delayTime = 0 local delayTime = 0
local damage = num
if shieldHpDiff < 0 then if shieldHpDiff < 0 then
damage = damage - shieldHpDiff damage = damage - shieldHpDiff
delayTime = BattleConst.EFFECT_NUMBER_DELAY delayTime = BattleConst.EFFECT_NUMBER_DELAY
@ -1200,13 +1200,13 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus)
local hpPercent = self.unitEntity:getHpPercent() local hpPercent = self.unitEntity:getHpPercent()
self.battleController:refreshHp(self.side, hp, hpPercent) self.battleController:refreshHp(self.side, hp, hpPercent)
if atker:getIsCentralizedAttack() then if atker:getIsCentralizedAttack() then
if self.currState == UNIT_STATE.IDLE then if damage < 0 and self.currState == UNIT_STATE.IDLE then
self:playHurt() self:playHurt()
end end
else else
if self.unitEntity:getIsDead() then if self.unitEntity:getIsDead() then
self:changeState(UNIT_STATE.DEAD) self:changeState(UNIT_STATE.DEAD)
elseif self.currState == UNIT_STATE.IDLE then elseif damage < 0 and self.currState == UNIT_STATE.IDLE then
self:playHurt() self:playHurt()
end end
end end