local ____lualib = require("lualib_bundle") local __TS__Class = ____lualib.__TS__Class local __TS__ClassExtends = ____lualib.__TS__ClassExtends local __TS__Decorate = ____lualib.__TS__Decorate local ____exports = {} local ____dota_ts_adapter = require("lib.dota_ts_adapter") local BaseModifier = ____dota_ts_adapter.BaseModifier local registerModifier = ____dota_ts_adapter.registerModifier ____exports.modifier_general_froze = __TS__Class() local modifier_general_froze = ____exports.modifier_general_froze modifier_general_froze.name = "modifier_general_froze" modifier_general_froze.____file_path = "scripts/vscripts/abilities/modifiers/modifier_general_froze.lua" __TS__ClassExtends(modifier_general_froze, BaseModifier) function modifier_general_froze.prototype.____constructor(self, ...) BaseModifier.prototype.____constructor(self, ...) self.isFrozen = false self.STACKS_TO_FREEZE = 100 self.STACKS_TO_DAMAGEUP = 30 end function modifier_general_froze.prototype.IsDebuff(self) return true end function modifier_general_froze.prototype.IsPurgable(self) return true end function modifier_general_froze.prototype.OnCreated(self) if IsServer() then self:CheckFrozenState() self:StartIntervalThink(1) end end function modifier_general_froze.prototype.OnRefresh(self) if IsServer() then self:CheckFrozenState() end end function modifier_general_froze.prototype.OnDestroy(self) if IsClient() then return end if self.particleId then ParticleManager:DestroyParticle(self.particleId, false) ParticleManager:ReleaseParticleIndex(self.particleId) end if self.frozenParticleId then ParticleManager:DestroyParticle(self.frozenParticleId, false) ParticleManager:ReleaseParticleIndex(self.frozenParticleId) end self.frozenParticleId = nil end function modifier_general_froze.prototype.OnIntervalThink(self) if not self:GetParent() then return end if "modifier_general_fired" ~= nil then local firedModifier = self:GetParent():FindModifierByName("modifier_general_fired") local firedStacks = firedModifier and firedModifier:GetStackCount() or 0 if self:GetStackCount() > 0 then local decreaseAmount = math.max( 1, math.ceil(self:GetStackCount() * 0.1) ) self:SetStackCount(self:GetStackCount() - decreaseAmount) self:SetDuration(1.01, true) else self:GetParent():RemoveModifierByName("modifier_general_froze") end if firedStacks > 0 then local decreaseAmount = math.min( self:GetStackCount(), firedStacks ) self:SetStackCount(self:GetStackCount() - decreaseAmount) if firedModifier then firedModifier:SetStackCount(firedStacks - decreaseAmount) end end end end function modifier_general_froze.prototype.CheckState(self) if self.isFrozen and self:GetParent():IsBoss() then return {[MODIFIER_STATE_FROZEN] = true, [MODIFIER_STATE_ROOTED] = true} end return {} end function modifier_general_froze.prototype.DeclareFunctions(self) return {MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE, MODIFIER_PROPERTY_ATTACKSPEED_PERCENTAGE, MODIFIER_PROPERTY_INCOMING_DAMAGE_PERCENTAGE, MODIFIER_PROPERTY_HEALTH_REGEN_PERCENTAGE} end function modifier_general_froze.prototype.GetModifierMoveSpeedBonus_Percentage(self) return -self:GetStackCount() end function modifier_general_froze.prototype.GetModifierAttackSpeedPercentage(self) return -self:GetStackCount() end function modifier_general_froze.prototype.GetEffectName(self) return "particles/generic_gameplay/generic_slowed_cold.vpcf" end function modifier_general_froze.prototype.GetModifierIncomingDamage_Percentage(self) return self:GetStackCount() >= self.STACKS_TO_DAMAGEUP and self:GetStackCount() or 0 end function modifier_general_froze.prototype.GetModifierHealthRegenPercentage(self) return -self:GetStackCount() * 0.01 end function modifier_general_froze.prototype.GetEffectAttachType(self) return PATTACH_ABSORIGIN_FOLLOW end function modifier_general_froze.prototype.CheckFrozenState(self) local parent = self:GetParent() if self:GetStackCount() >= self.STACKS_TO_FREEZE and not self.isFrozen then self.isFrozen = true self.frozenParticleId = ParticleManager:CreateParticle("particles/units/heroes/hero_crystalmaiden/maiden_frostbite_buff.vpcf", PATTACH_ABSORIGIN_FOLLOW, parent) EmitSoundOn("Hero_Ancient_Apparition.ColdFeetCast", parent) elseif self:GetStackCount() < self.STACKS_TO_FREEZE and self.isFrozen then self.isFrozen = false if self.frozenParticleId then ParticleManager:DestroyParticle(self.frozenParticleId, false) ParticleManager:ReleaseParticleIndex(self.frozenParticleId) self.frozenParticleId = nil end parent:RemoveModifierByName("modifier_general_silenced") end end function modifier_general_froze.prototype.GetModifierStateImmune(self) return {[MODIFIER_STATE_FROZEN] = true, [MODIFIER_STATE_ROOTED] = true} end modifier_general_froze = __TS__Decorate( modifier_general_froze, modifier_general_froze, {registerModifier(nil)}, {kind = "class", name = "modifier_general_froze"} ) ____exports.modifier_general_froze = modifier_general_froze return ____exports