Files
2HUCardTDGame/scripts/vscripts/modifiers/bosses/modifier_bosses_random_dead_heal.lua
2021-10-24 15:36:18 -04:00

58 lines
1.7 KiB
Lua
Executable File

modifier_bosses_random_dead_heal = class({})
local public = modifier_bosses_random_dead_heal
--------------------------------------------------------------------------------
function public:IsDebuff()
return false
end
--------------------------------------------------------------------------------
function public:IsHidden()
return false
end
--------------------------------------------------------------------------------
function public:IsPurgable()
return false
end
--------------------------------------------------------------------------------
function public:OnDestroy(kv)
if IsServer() then
local caster = self:GetParent()
local point = caster:GetOrigin()
local hero = GameRules.HeroList[caster.thtd_player_index]
local time = 5
local effectIndex = ParticleManager:CreateParticle("particles/heroes/thtd_suwako/ability_suwako_02.vpcf", PATTACH_CUSTOMORIGIN, hero)
ParticleManager:SetParticleControl(effectIndex, 0, point)
ParticleManager:SetParticleControl(effectIndex, 1, Vector(200,1,1))
ParticleManager:DestroyParticleSystemTime(effectIndex,5.0)
hero:SetContextThink(DoUniqueString("random_boss_buff_dead_heal"),
function()
if GameRules:IsGamePaused() then return 0.3 end
if time <= 0 then return nil end
local targets = THTD_FindUnitsInRadius(hero,point,300)
for k,v in pairs(targets) do
if v ~= nil and v:IsNull() == false and v:IsAlive() then
v:SetHealth(math.min(v:GetMaxHealth(), v:GetHealth() + v:GetMaxHealth() * 0.05))
end
end
time = time - 1
return 1
end,
1)
end
end
--------------------------------------------------------------------------------
function public:GetTexture()
return "random_boss_buff_dead_heal"
end