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 --控制效果可被覆盖
|
|
|
|
|
-- 刷新排序等级
|
2020-12-22 10:59:26 +08:00
|
|
|
|
self.sort = 4
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
2023-05-12 16:55:47 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--初始化后调用一次
|
2020-12-22 10:59:26 +08:00
|
|
|
|
function Control:OnStart()
|
2023-05-12 16:55:47 +08:00
|
|
|
|
local lockTargetFun=function()
|
|
|
|
|
self.target.ctrl_slient = false
|
|
|
|
|
self.target.lockTarget=nil
|
|
|
|
|
self.disperse=true
|
|
|
|
|
end
|
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
|
2023-05-17 16:12:30 +08:00
|
|
|
|
self.target.ctrl_lock = true
|
2023-05-12 16:55:47 +08:00
|
|
|
|
self.caster.Event:AddEvent(BattleEventName.RoleDead,lockTargetFun,nil,nil,self.target)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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
|
2020-12-22 10:59:26 +08:00
|
|
|
|
elseif self.ctrlType == 8 then --混乱
|
|
|
|
|
self.target.ctrl_chaos = true
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2020-12-22 10:59:26 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
2020-12-22 10:59:26 +08:00
|
|
|
|
|
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--间隔N帧触发,返回true时表示继续触发,返回false立刻触发OnEnd
|
|
|
|
|
function Control:OnTrigger()
|
|
|
|
|
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--效果结束时调用一次
|
|
|
|
|
function Control:OnEnd()
|
2021-03-30 16:34:17 +08:00
|
|
|
|
--如果还有同类型的控制效果,就返回
|
|
|
|
|
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
|
2023-05-17 16:12:30 +08:00
|
|
|
|
self.target.ctrl_lock = false
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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 --致盲
|
2020-12-22 10:59:26 +08:00
|
|
|
|
self.target.ctrl_blind = false
|
2020-05-09 13:31:21 +08:00
|
|
|
|
elseif self.ctrlType == 7 then --麻痹
|
|
|
|
|
self.target.ctrl_palsy = false
|
2020-12-22 10:59:26 +08:00
|
|
|
|
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
|