2021-04-20 13:58:00 +08:00
|
|
|
|
HOT = Buff:New()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
--初始化Buff,通过传入一些自定义参数控制成长相关的数值
|
|
|
|
|
function HOT:SetData(...)
|
|
|
|
|
|
|
|
|
|
self.interval,
|
|
|
|
|
self.healValue = ...
|
2021-10-20 21:33:37 +08:00
|
|
|
|
self.hotType=1 -- 1:治愈 2.神佑
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-- 刷新排序等级
|
|
|
|
|
self.sort = 1 -- 最先计算回血
|
|
|
|
|
end
|
|
|
|
|
|
2021-01-18 13:31:54 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--初始化后调用一次
|
|
|
|
|
function HOT:OnStart()
|
|
|
|
|
|
|
|
|
|
self.target.Event:DispatchEvent(BattleEventName.RoleBeHealed, self.caster)
|
|
|
|
|
end
|
|
|
|
|
|
2021-01-18 13:31:54 +08:00
|
|
|
|
--修改持续加血效果的加血值
|
|
|
|
|
function HOT:ChangeHealValue(newValue)
|
2021-10-20 21:33:37 +08:00
|
|
|
|
if newValue and self.hotType~=2 then
|
2021-01-18 13:31:54 +08:00
|
|
|
|
self.healValue=newValue
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--间隔N帧触发,返回true时表示继续触发,返回false立刻触发OnEnd
|
|
|
|
|
function HOT:OnTrigger()
|
|
|
|
|
|
|
|
|
|
if not self.target.ctrl_noheal or self.target:IsDead() then --禁疗和死亡无法加血
|
2021-10-20 21:33:37 +08:00
|
|
|
|
if self.hotType==2 then
|
|
|
|
|
local value=self.target:GetRoleData(RoleDataName.MaxHp)-self.target:GetRoleData(RoleDataName.Hp)
|
2021-10-22 17:34:15 +08:00
|
|
|
|
if self.healValue<value then
|
|
|
|
|
value=self.healValue
|
|
|
|
|
end
|
2021-10-20 21:33:37 +08:00
|
|
|
|
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
|
2021-10-22 14:11:25 +08:00
|
|
|
|
if self.target.bloodShield then
|
|
|
|
|
self.target.bloodShield:AddValue(self.healValue-value)
|
2021-10-20 21:33:37 +08:00
|
|
|
|
else
|
2021-10-22 14:11:25 +08:00
|
|
|
|
self.target:AddBuff(Buff.Create(self.caster,BuffName.Blood,0,self.healValue-value))
|
2021-10-20 21:33:37 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
BattleUtil.ApplyTreat(self.caster, self.target, self.healValue)
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--效果结束时调用一次
|
|
|
|
|
function HOT:OnEnd()
|
2021-01-14 15:20:26 +08:00
|
|
|
|
BattleLogic.Event:DispatchEvent(BattleEventName.HotBuffEnd, self)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--只有当cover字段为true时触发,返回true则被新效果覆盖
|
|
|
|
|
function HOT:OnCover(newBuff)
|
|
|
|
|
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
|
2020-06-23 18:36:24 +08:00
|
|
|
|
return HOT
|