2019-03-12 14:05:45 +08:00
|
|
|
|
require("Modules/Battle/Logic/Base/Buff")
|
|
|
|
|
Control = Buff:New()
|
|
|
|
|
|
|
|
|
|
--初始化Buff,通过传入一些自定义参数控制成长相关的数值
|
|
|
|
|
function Control:SetData(...)
|
|
|
|
|
--log("Control:SetData")
|
2019-03-26 15:11:47 +08:00
|
|
|
|
self.ctrlType = ...
|
2019-04-17 21:04:32 +08:00
|
|
|
|
self.cover = true --控制效果可被覆盖
|
2019-03-12 14:05:45 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--初始化后调用一次
|
|
|
|
|
function Control:OnStart()
|
|
|
|
|
--log("Control:OnStart")
|
|
|
|
|
if self.ctrlType == 1 then --眩晕
|
|
|
|
|
self.target.enable = false
|
|
|
|
|
elseif self.ctrlType == 2 then --沉默
|
2019-04-17 21:04:32 +08:00
|
|
|
|
self.target.ctrl_slient = true
|
2019-03-12 14:05:45 +08:00
|
|
|
|
elseif self.ctrlType == 3 then --嘲讽
|
|
|
|
|
self.target.lockTarget = self.caster
|
|
|
|
|
elseif self.ctrlType == 4 then --禁疗
|
2019-04-17 21:04:32 +08:00
|
|
|
|
self.target.ctrl_noheal = true
|
2019-03-12 14:05:45 +08:00
|
|
|
|
elseif self.ctrlType == 5 then --致盲
|
2019-04-17 21:04:32 +08:00
|
|
|
|
self.target.ctrl_blind = true
|
2019-03-12 14:05:45 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--间隔N帧触发,返回true时表示继续触发,返回false立刻触发OnEnd
|
|
|
|
|
function Control:OnTrigger()
|
|
|
|
|
--log("Control:OnTrigger")
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--效果结束时调用一次
|
|
|
|
|
function Control:OnEnd()
|
|
|
|
|
--log("Control:OnEnd")
|
|
|
|
|
if self.ctrlType == 1 then --眩晕
|
|
|
|
|
self.target.enable = true
|
|
|
|
|
elseif self.ctrlType == 2 then --沉默
|
2019-04-17 21:04:32 +08:00
|
|
|
|
self.target.ctrl_slient = false
|
2019-03-12 14:05:45 +08:00
|
|
|
|
elseif self.ctrlType == 3 then --嘲讽
|
|
|
|
|
self.target.lockTarget = nil
|
|
|
|
|
elseif self.ctrlType == 4 then --禁疗
|
2019-04-17 21:04:32 +08:00
|
|
|
|
self.target.ctrl_noheal = false
|
2019-03-12 14:05:45 +08:00
|
|
|
|
elseif self.ctrlType == 5 then --致盲
|
2019-04-17 21:04:32 +08:00
|
|
|
|
self.target.ctrl_blind = false
|
2019-03-12 14:05:45 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--只有当cover字段为true时触发,返回true则被新效果覆盖
|
|
|
|
|
function Control:OnCover(newBuff)
|
|
|
|
|
--log("Control:OnCover")
|
2019-04-17 21:04:32 +08:00
|
|
|
|
return newBuff.ctrlType == self.ctrlType
|
2019-03-12 14:05:45 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return Control
|