miduo_client/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Control.lua

80 lines
2.3 KiB
Lua
Raw Normal View History

2021-04-20 13:58:00 +08:00
Control = Buff:New()
2020-05-09 13:31:21 +08:00
--初始化Buff通过传入一些自定义参数控制成长相关的数值
function Control:SetData(...)
self.ctrlType = ...
self.cover = true --控制效果可被覆盖
-- 刷新排序等级
self.sort = 4
2020-05-09 13:31:21 +08:00
end
--初始化后调用一次
function Control:OnStart()
2020-05-09 13:31:21 +08:00
if self.ctrlType == 1 then --眩晕
self.target.ctrl_dizzy = true
elseif self.ctrlType == 2 then --沉默
self.target.ctrl_slient = true
elseif self.ctrlType == 3 then --嘲讽(包括沉默)
self.target.lockTarget = self.caster
self.target.ctrl_slient = true
elseif self.ctrlType == 4 then --禁疗
self.target.ctrl_noheal = true
elseif self.ctrlType == 5 then --致盲
self.target.ctrl_blind = true
elseif self.ctrlType == 7 then --麻痹
self.target.ctrl_palsy = true
elseif self.ctrlType == 8 then --混乱
self.target.ctrl_chaos = true
2020-05-09 13:31:21 +08:00
end
2020-05-09 13:31:21 +08:00
end
2020-05-09 13:31:21 +08:00
--间隔N帧触发返回true时表示继续触发返回false立刻触发OnEnd
function Control:OnTrigger()
return true
end
--效果结束时调用一次
function Control:OnEnd()
--如果还有同类型的控制效果,就返回
if BattleLogic.BuffMgr:HasBuff(self.target, BuffName.Control, function (buff) return buff~=self and buff.ctrlType == self.ctrlType end) then
return
end
2020-05-09 13:31:21 +08:00
if self.ctrlType == 1 then --眩晕
self.target.ctrl_dizzy = false
elseif self.ctrlType == 2 then --沉默
self.target.ctrl_slient = false
elseif self.ctrlType == 3 then --嘲讽(包括沉默)
self.target.lockTarget = nil
self.target.ctrl_slient = false
elseif self.ctrlType == 4 then --禁疗
2021-05-13 11:24:35 +08:00
local isHave=self.target:CheckHavePassive(315)
if not isHave then
self.target.ctrl_noheal = false
end
2020-05-09 13:31:21 +08:00
elseif self.ctrlType == 5 then --致盲
self.target.ctrl_blind = false
2020-05-09 13:31:21 +08:00
elseif self.ctrlType == 7 then --麻痹
self.target.ctrl_palsy = false
elseif self.ctrlType==8 then --混乱
self.target.ctrl_chaos = false
2020-05-09 13:31:21 +08:00
end
end
--只有当cover字段为true时触发返回true则被新效果覆盖
function Control:OnCover(newBuff)
return newBuff.ctrlType == self.ctrlType
end
-- 比较buff
function Control:OnCompare(buff)
return self.ctrlType == buff.ctrlType
end
2020-06-23 18:36:24 +08:00
return Control