modifier_bosses_random_health_effect = class({}) local public = modifier_bosses_random_health_effect -------------------------------------------------------------------------------- function public:IsDebuff() return false end -------------------------------------------------------------------------------- function public:IsHidden() return false end -------------------------------------------------------------------------------- function public:IsPurgable() return false end -------------------------------------------------------------------------------- function public:OnCreated(kv) if IsServer() then local caster = self:GetParent() if caster.random_boss_health_buff ~= true then caster.random_boss_health_buff = true local health = math.min(MAX_HEALTH, caster:GetMaxHealth()*1.25) caster.random_health_factor = health/caster:GetMaxHealth() caster:SetBaseMaxHealth(health) caster:SetMaxHealth(health) caster:SetHealth(caster:GetHealth()*caster.random_health_factor) end end end function public:OnDestroy(kv) if IsServer() then local caster = self:GetParent() if caster.random_boss_health_buff == true and caster.random_health_factor ~= nil then local health = caster:GetMaxHealth()/caster.random_health_factor caster:SetBaseMaxHealth(health) caster:SetMaxHealth(health) caster:SetHealth(caster:GetHealth()/caster.random_health_factor) caster.random_boss_health_buff = false end end end -------------------------------------------------------------------------------- function public:GetTexture() return "random_boss_buff_health" end