复活判定逻辑
This commit is contained in:
parent
1ccef0858b
commit
eeeadeace0
@ -1402,8 +1402,10 @@ function BattleUnitComp:onSkillTakeEffect(skill, isFinalBlock, validEffectIdx)
|
||||
end
|
||||
local targetType = skill:getTargetType()
|
||||
local target
|
||||
local targetIsSelf = false
|
||||
if targetType == 1 then -- 自己
|
||||
target = self
|
||||
targetIsSelf = true
|
||||
else
|
||||
target = self.battleController:getOtherSideMainUnit(self.side)
|
||||
if skill:getIsNormalType() then -- 普攻要计算一下格挡
|
||||
@ -1450,6 +1452,11 @@ function BattleUnitComp:onSkillTakeEffect(skill, isFinalBlock, validEffectIdx)
|
||||
end
|
||||
end
|
||||
|
||||
if isFinalBlock and targetIsSelf then -- 死亡判定
|
||||
local otherSideTarget = self.battleController:getOtherSideMainUnit(self.side)
|
||||
otherSideTarget:checkDeadStatus(target)
|
||||
end
|
||||
|
||||
if succ then
|
||||
if skill:getIsHurtType() then
|
||||
self.team:addCombo()
|
||||
@ -1740,6 +1747,20 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus, d
|
||||
self.team:playHurt()
|
||||
end
|
||||
else
|
||||
if self:checkDeadStatus(atker, damageOrCureType) then
|
||||
elseif damage < 0 then
|
||||
self.team:playHurt()
|
||||
end
|
||||
end
|
||||
|
||||
if hp > 0 then
|
||||
self.team:checkPassiveEvent(PASSIVE_EVENT.HP_LOWER_THAN, atker, hpPercent)
|
||||
else
|
||||
self.team:checkPassiveEvent(PASSIVE_EVENT.ON_DEAD, atker)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleUnitComp:checkDeadStatus(atker, damageOrCureType)
|
||||
if self.unitEntity:getIsDead() then
|
||||
if self.unitEntity:getCanRebirth() then -- 复活
|
||||
self.battleController:resetTimeSpeed(true)
|
||||
@ -1785,16 +1806,10 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus, d
|
||||
self.battleController:resetTimeSpeed(true)
|
||||
|
||||
self.team:changeDead() -- 因为buff生效对象有可能不是当前主英雄,会导致状态不对,所以使用主英雄来播放动画
|
||||
elseif damage < 0 then
|
||||
self.team:playHurt()
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
if hp > 0 then
|
||||
self.team:checkPassiveEvent(PASSIVE_EVENT.HP_LOWER_THAN, atker, hpPercent)
|
||||
else
|
||||
self.team:checkPassiveEvent(PASSIVE_EVENT.ON_DEAD, atker)
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function BattleUnitComp:addBattleExp(atker, hpRealReduce)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user