87 lines
2.6 KiB
Lua
87 lines
2.6 KiB
Lua
Control = Buff:New()
|
||
|
||
--初始化Buff,通过传入一些自定义参数控制成长相关的数值
|
||
function Control:SetData(...)
|
||
|
||
self.ctrlType = ...
|
||
self.cover = true --控制效果可被覆盖
|
||
-- 刷新排序等级
|
||
self.sort = 4
|
||
end
|
||
|
||
|
||
--初始化后调用一次
|
||
function Control:OnStart()
|
||
local lockTargetFun=function()
|
||
self.target.ctrl_slient = false
|
||
self.target.lockTarget=nil
|
||
self.disperse=true
|
||
end
|
||
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_lock = true
|
||
self.caster.Event:AddEvent(BattleEventName.RoleDead,lockTargetFun,nil,nil,self.target)
|
||
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
|
||
end
|
||
|
||
end
|
||
|
||
|
||
|
||
--间隔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
|
||
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_lock = false
|
||
elseif self.ctrlType == 4 then --禁疗
|
||
local isHave=self.target:CheckHavePassive(315)
|
||
if not isHave then
|
||
self.target.ctrl_noheal = false
|
||
end
|
||
elseif self.ctrlType == 5 then --致盲
|
||
self.target.ctrl_blind = false
|
||
elseif self.ctrlType == 7 then --麻痹
|
||
self.target.ctrl_palsy = false
|
||
elseif self.ctrlType==8 then --混乱
|
||
self.target.ctrl_chaos = false
|
||
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
|
||
|
||
|
||
return Control |