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