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

47 lines
1.4 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

CommonSign = Buff:New()
--初始化Buff通过传入一些自定义参数控制成长相关的数值
function CommonSign:SetData(...)
self.signType=...
-- 刷新排序等级
self.sort = 4
end
local onRageChange=function(caster,target,func,type,value)
local buff=Buff.Create(caster,BuffName.Control,1,7)
target:AddBuff(buff)
end
local onSkillCast=function(skill)
skill.owner.Event:AddEvent(BattleEventName.RecordRageChange,onRageChange,nil,nil,skill.owner)
end
local onSkillCastEnd=function(skill)
skill.owner.Event:RemoveEvent(BattleEventName.RecordRageChange,onRageChange,nil,nil,skill.owner)
end
--初始化后调用一次
function CommonSign:OnStart()
self.target.Event:AddEvent(BattleEventName.SkillCast,onSkillCast,nil,nil,self.target)
self.target.Event:AddEvent(BattleEventName.SkillCastEnd,onSkillCastEnd,nil,nil,self.target)
end
--间隔N帧触发返回true时表示继续触发返回false立刻触发OnEnd
function CommonSign:OnTrigger()
return true
end
--效果结束时调用一次
function CommonSign:OnEnd()
self.target.Event:RemoveEvent(BattleEventName.SkillCast,onSkillCast,nil,nil,self.target)
self.target.Event:RemoveEvent(BattleEventName.SkillCastEnd,onSkillCastEnd,nil,nil,self.target)
end
--只有当cover字段为true时触发返回true则被新效果覆盖
function CommonSign:OnCover(newBuff)
return true
end
return CommonSign