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

67 lines
1.9 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.

HOT = Buff:New()
--初始化Buff通过传入一些自定义参数控制成长相关的数值
function HOT:SetData(...)
self.interval,
self.healValue = ...
self.hotType=1 -- 1:治愈 2.神佑
-- 刷新排序等级
self.sort = 1 -- 最先计算回血
end
--初始化后调用一次
function HOT:OnStart()
self.target.Event:DispatchEvent(BattleEventName.RoleBeHealed, self.caster)
end
--修改持续加血效果的加血值
function HOT:ChangeHealValue(newValue)
if newValue and self.hotType~=2 then
self.healValue=newValue
end
end
--间隔N帧触发返回true时表示继续触发返回false立刻触发OnEnd
function HOT:OnTrigger()
if not self.target.ctrl_noheal or self.target:IsDead() then --禁疗和死亡无法加血
if self.hotType==2 then
local value=self.target:GetRoleData(RoleDataName.MaxHp)-self.target:GetRoleData(RoleDataName.Hp)
if self.healValue<value then
value=self.healValue
end
local yujia=0
if value>0 then
BattleUtil.FinalTreat(self.caster, self.target,value,1,nil)
else
value=0
end
if self.healValue-value>0 then
if self.target.bloodShield then
self.target.bloodShield:AddValue(self.healValue-value)
else
self.target:AddBuff(Buff.Create(self.caster,BuffName.Blood,0,self.healValue-value))
end
end
else
BattleUtil.ApplyTreat(self.caster, self.target, self.healValue)
end
end
return true
end
--效果结束时调用一次
function HOT:OnEnd()
BattleLogic.Event:DispatchEvent(BattleEventName.HotBuffEnd, self)
end
--只有当cover字段为true时触发返回true则被新效果覆盖
function HOT:OnCover(newBuff)
return true
end
return HOT