重生处理
This commit is contained in:
parent
4a4b25e11c
commit
9249ee3210
@ -153,6 +153,7 @@ BattleConst.UNIT_STATE = {
|
||||
RECOVER_HP_WAVE = 10, -- 波次之间回血
|
||||
FROZEN = 11, -- 冻结状态
|
||||
VERITGO = 12, -- 昏睡
|
||||
REBIRTH = 13, -- 复活中
|
||||
}
|
||||
|
||||
BattleConst.ATTACK_ACTION_STATE = {
|
||||
@ -349,6 +350,11 @@ local BUFF_NAME = {
|
||||
}
|
||||
BattleConst.BUFF_NAME = BUFF_NAME
|
||||
|
||||
|
||||
BattleConst.FINAL_WORK_BUFF = {
|
||||
[BUFF_NAME.REBIRTH] = true,
|
||||
}
|
||||
|
||||
local ATTR_NAME = {
|
||||
HP = "hp",
|
||||
MAX_HP = "max_hp",
|
||||
|
||||
@ -1751,6 +1751,7 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus, d
|
||||
end
|
||||
self.actionOverCallback = nil
|
||||
atker.actionOverCallback = nil
|
||||
mainUnit.unitEntity:setIsRebirth()
|
||||
mainUnit:playDead(function()
|
||||
mainUnit:removeBuffByName(BattleConst.ATTR_NAME.REBIRTH)
|
||||
local hpPercent = self.unitEntity:getHpPercent()
|
||||
@ -2176,6 +2177,10 @@ function BattleUnitComp:rebirth()
|
||||
self.unitEntity:rebirth()
|
||||
end
|
||||
|
||||
function BattleUnitComp:isInitState()
|
||||
return self.currState == UNIT_STATE.INIT
|
||||
end
|
||||
|
||||
function BattleUnitComp:getIsClear()
|
||||
return self.isClear
|
||||
end
|
||||
|
||||
@ -194,7 +194,11 @@ function BattleTeam:onRoundEnd()
|
||||
v:onRoundEnd()
|
||||
end
|
||||
self:doBuffWork()
|
||||
self:doFinalBuffWork()
|
||||
self.comboCount = 0
|
||||
if self:getMainUnit():isInitState() then
|
||||
return
|
||||
end
|
||||
self:getMainUnit():changeState(BattleConst.UNIT_STATE.IDLE)
|
||||
end
|
||||
|
||||
@ -451,6 +455,7 @@ function BattleTeam:doBuffWork()
|
||||
if not buffEffect then
|
||||
break
|
||||
end
|
||||
if not BattleConst.FINAL_WORK_BUFF[buffEffect.buff:getName()] then
|
||||
buffEffect.round = buffEffect.round - 1
|
||||
local target = self.mainUnit
|
||||
if buffEffect.target then
|
||||
@ -466,9 +471,51 @@ function BattleTeam:doBuffWork()
|
||||
BattleBuffHandle.removeBuff(target, buffEffect)
|
||||
end
|
||||
end
|
||||
end
|
||||
self.battleController:refreshBuff(self.side, self.buffList)
|
||||
end
|
||||
|
||||
-- 比如复活类,需要最后触发buff
|
||||
function BattleTeam:doFinalBuffWork()
|
||||
if not self:getMainUnit() or self:getMainUnit().unitEntity:getIsDead() or self:getMainUnit().unitEntity:getIsRebirth() then
|
||||
return
|
||||
end
|
||||
|
||||
local count = nil
|
||||
local buffEffect = nil
|
||||
count = #self.buffList
|
||||
if count <= 0 then
|
||||
return
|
||||
end
|
||||
local refreshUI = false
|
||||
for i = count, 1, -1 do
|
||||
buffEffect = self.buffList[i]
|
||||
if not buffEffect then
|
||||
break
|
||||
end
|
||||
if BattleConst.FINAL_WORK_BUFF[buffEffect.buff:getName()] then
|
||||
refreshUI = true
|
||||
buffEffect.round = buffEffect.round - 1
|
||||
local target = self.mainUnit
|
||||
if buffEffect.target then
|
||||
target = buffEffect.target
|
||||
end
|
||||
BattleBuffHandle.doBuffWork(target, buffEffect)
|
||||
if not self.buffList[i] then -- dot伤害致死后,buff已经全部移除
|
||||
break
|
||||
end
|
||||
if buffEffect.round <= 0 then
|
||||
self:updateBuffState(buffEffect.buff, -1)
|
||||
table.remove(self.buffList, i)
|
||||
BattleBuffHandle.removeBuff(target, buffEffect)
|
||||
end
|
||||
end
|
||||
end
|
||||
if refreshUI then
|
||||
self.battleController:refreshBuff(self.side, self.buffList)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleTeam:removeBuffByName(buffName)
|
||||
local count = #self.buffList
|
||||
if count <= 0 then
|
||||
@ -648,6 +695,8 @@ function BattleTeam:clearHurtComboTag()
|
||||
end
|
||||
|
||||
function BattleTeam:onActionOver()
|
||||
self:setIsFinalBlock(true)
|
||||
self:setCentralizedAttack(false)
|
||||
self:clearHurtComboTag()
|
||||
-- 处理反击
|
||||
local counterAttackCount = self:getMainUnit().unitEntity:getCounterAttackCount()
|
||||
|
||||
@ -458,10 +458,22 @@ function BattleTeamEntity:die()
|
||||
self:clearRecordData()
|
||||
end
|
||||
|
||||
function BattleTeamEntity:setIsRebirth()
|
||||
self.isRebirth = true
|
||||
end
|
||||
|
||||
function BattleTeamEntity:getIsRebirth()
|
||||
return self.isRebirth
|
||||
end
|
||||
|
||||
function BattleTeamEntity:rebirth()
|
||||
self.isRebirth = false
|
||||
self.isDead = false
|
||||
end
|
||||
function BattleTeamEntity:getIsDead()
|
||||
if self:getIsRebirth() then
|
||||
return false
|
||||
end
|
||||
return self.isDead
|
||||
end
|
||||
|
||||
|
||||
@ -556,6 +556,14 @@ function BattleUnitEntity:setTeamRecordData(name, value)
|
||||
self.team:setRecordData(name, value)
|
||||
end
|
||||
|
||||
function BattleUnitEntity:setIsRebirth()
|
||||
self.team:setIsRebirth()
|
||||
end
|
||||
|
||||
function BattleUnitEntity:getIsRebirth()
|
||||
return self.team:getIsRebirth()
|
||||
end
|
||||
|
||||
function BattleUnitEntity:rebirth()
|
||||
self.team:rebirth()
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user