护盾
This commit is contained in:
parent
d8bf6274d8
commit
8575d48b37
@ -193,6 +193,7 @@ local BUFF_NAME = {
|
|||||||
CURED_ADD = "cured_add",
|
CURED_ADD = "cured_add",
|
||||||
ADD_SKILL = "add_skill",
|
ADD_SKILL = "add_skill",
|
||||||
SKILL_FIRE_TIMES = "skill_fire_times",
|
SKILL_FIRE_TIMES = "skill_fire_times",
|
||||||
|
SHIELD_REBOUND_200 = "shield_rebound_200",
|
||||||
}
|
}
|
||||||
BattleConst.BUFF_NAME = BUFF_NAME
|
BattleConst.BUFF_NAME = BUFF_NAME
|
||||||
|
|
||||||
@ -227,6 +228,7 @@ local ATTR_NAME = {
|
|||||||
CRIT_TIME = "crit_time",
|
CRIT_TIME = "crit_time",
|
||||||
EXP_TIME = "exp_time",
|
EXP_TIME = "exp_time",
|
||||||
CURE_ADDITION = "cure_addition",
|
CURE_ADDITION = "cure_addition",
|
||||||
|
SHIELD_REBOUND = "shield_rebound",
|
||||||
}
|
}
|
||||||
BattleConst.ATTR_NAME = ATTR_NAME
|
BattleConst.ATTR_NAME = ATTR_NAME
|
||||||
|
|
||||||
|
|||||||
@ -366,6 +366,17 @@ function BattleUnitComp:addShield(num, buffEffect)
|
|||||||
self.team:addShield(buffEffect)
|
self.team:addShield(buffEffect)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleUnitComp:removeShield(buffEffect)
|
||||||
|
if buffEffect == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if buffEffect.result > 0 then
|
||||||
|
self.unitEntity:addShield(-buffEffect.result)
|
||||||
|
buffEffect.result = 0
|
||||||
|
end
|
||||||
|
self.team:removeShield(buffEffect)
|
||||||
|
end
|
||||||
|
|
||||||
function BattleUnitComp:changeState(state)
|
function BattleUnitComp:changeState(state)
|
||||||
if self.currState == state and not self:repeatCurrState() then
|
if self.currState == state and not self:repeatCurrState() then
|
||||||
return false
|
return false
|
||||||
|
|||||||
@ -116,10 +116,32 @@ local function _takeEffectControl(unitComp, buff, target, buffEffect)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
BattleBuffHandle.addShield = {
|
||||||
|
-- 反弹目标伤害的200%,直接写死
|
||||||
|
[BUFF_NAME.SHIELD_REBOUND_200] = function(unitComp, buff, target, buffEffect)
|
||||||
|
local shieldNum = target.unitEntity:getMaxHp() * buff:getEffectNum() // DEFAULT_FACTOR
|
||||||
|
target:addShield(shieldNum, buffEffect)
|
||||||
|
target.unitEntity:addAttr(ATTR_NAME.SHIELD_REBOUND, 20000, false)
|
||||||
|
return shieldNum
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
BattleBuffHandle.removeShield = {
|
||||||
|
[BUFF_NAME.SHIELD_REBOUND_200] = function(buffSender, target, buff, buffEffect)
|
||||||
|
target.unitEntity:addAttr(ATTR_NAME.SHIELD_REBOUND, -20000, false)
|
||||||
|
target:removeShield(buffEffect)
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
local function _takeEffectShield(unitComp, buff, target, buffEffect)
|
local function _takeEffectShield(unitComp, buff, target, buffEffect)
|
||||||
local shieldNum = target.unitEntity:getMaxHp() * buff:getEffectNum() // DEFAULT_FACTOR
|
local func = BattleBuffHandle.addShield[buff:getName()]
|
||||||
target:addShield(shieldNum, buffEffect)
|
if func then
|
||||||
return true
|
return func(unitComp, buff, target, buffEffect)
|
||||||
|
else
|
||||||
|
local shieldNum = target.unitEntity:getMaxHp() * buff:getEffectNum() // DEFAULT_FACTOR
|
||||||
|
target:addShield(shieldNum, buffEffect)
|
||||||
|
return shieldNum
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- buff添加时的效果
|
-- buff添加时的效果
|
||||||
@ -152,6 +174,15 @@ local function _removeEffectAttr(buffSender, target, buff, buffEffect)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function _removeEffectShield(buffSender, target, buff, buffEffect)
|
||||||
|
local func = BattleBuffHandle.removeShield[buff:getName()]
|
||||||
|
if func then
|
||||||
|
func(buffSender, target, buff, buffEffect)
|
||||||
|
else
|
||||||
|
target:removeShield(buffEffect)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function _removeEffectControl(buffSender, target, buff, buffEffect)
|
local function _removeEffectControl(buffSender, target, buff, buffEffect)
|
||||||
target.unitEntity:removeLimit(buff:getName())
|
target.unitEntity:removeLimit(buff:getName())
|
||||||
end
|
end
|
||||||
@ -159,6 +190,7 @@ end
|
|||||||
-- buff移除时的效果
|
-- buff移除时的效果
|
||||||
BattleBuffHandle.removeEffect = {
|
BattleBuffHandle.removeEffect = {
|
||||||
[1] = _removeEffectAttr,
|
[1] = _removeEffectAttr,
|
||||||
|
[2] = _removeEffectShield,
|
||||||
[7] = BattleBuffSpecial.specialBuffOff,
|
[7] = BattleBuffSpecial.specialBuffOff,
|
||||||
[8] = _removeEffectControl,
|
[8] = _removeEffectControl,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -157,6 +157,15 @@ function BattleTeam:addShield(buffEffect)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleTeam:removeShield(buffEffect)
|
||||||
|
for k, v in ipairs(self.shieldBuffList) do
|
||||||
|
if v == buffEffect then
|
||||||
|
table.remove(self.shieldBuffList, k)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function BattleTeam:handleShield(reduceShield, unit)
|
function BattleTeam:handleShield(reduceShield, unit)
|
||||||
if #self.shieldBuffList <= 0 then
|
if #self.shieldBuffList <= 0 then
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user