diff --git a/lua/app/module/battle/battle_const.lua b/lua/app/module/battle/battle_const.lua index 12b37364..77505f64 100644 --- a/lua/app/module/battle/battle_const.lua +++ b/lua/app/module/battle/battle_const.lua @@ -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", diff --git a/lua/app/module/battle/component/battle_unit_comp.lua b/lua/app/module/battle/component/battle_unit_comp.lua index 401e6c73..e1b030bd 100644 --- a/lua/app/module/battle/component/battle_unit_comp.lua +++ b/lua/app/module/battle/component/battle_unit_comp.lua @@ -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 diff --git a/lua/app/module/battle/team/battle_team.lua b/lua/app/module/battle/team/battle_team.lua index f75f0a95..70fbf3cc 100644 --- a/lua/app/module/battle/team/battle_team.lua +++ b/lua/app/module/battle/team/battle_team.lua @@ -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,24 +455,67 @@ function BattleTeam:doBuffWork() if not buffEffect then break end - 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) + if not BattleConst.FINAL_WORK_BUFF[buffEffect.buff:getName()] then + 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 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() diff --git a/lua/app/userdata/battle/team/battle_team_entity.lua b/lua/app/userdata/battle/team/battle_team_entity.lua index 145c14ff..2a4efd09 100644 --- a/lua/app/userdata/battle/team/battle_team_entity.lua +++ b/lua/app/userdata/battle/team/battle_team_entity.lua @@ -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 diff --git a/lua/app/userdata/battle/team/battle_unit_entity.lua b/lua/app/userdata/battle/team/battle_unit_entity.lua index 39a9491e..bfe743d3 100644 --- a/lua/app/userdata/battle/team/battle_unit_entity.lua +++ b/lua/app/userdata/battle/team/battle_unit_entity.lua @@ -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