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 BaseAbility = ____dota_ts_adapter.BaseAbility local BaseModifier = ____dota_ts_adapter.BaseModifier local registerModifier = ____dota_ts_adapter.registerModifier local ____dota_ts_adapter = require("lib.dota_ts_adapter") local registerAbility = ____dota_ts_adapter.registerAbility ____exports.sheep_coil = __TS__Class() local sheep_coil = ____exports.sheep_coil sheep_coil.name = "sheep_coil" sheep_coil.____file_path = "scripts/vscripts/abilities/creep/sheep_coil.lua" __TS__ClassExtends(sheep_coil, BaseAbility) function sheep_coil.prototype.GetAOERadius(self) return self:GetSpecialValueFor("radius") end function sheep_coil.prototype.OnSpellStart(self) local caster = self:GetCaster() local cursorPt = self:GetCursorPosition() local targetPoint = GetGroundPosition(cursorPt, nil) local spawnOrigin do local function ____catch() spawnOrigin = caster:GetAbsOrigin() end local ____try = pcall(function() local attachId = caster:ScriptLookupAttachment("attach_attack1") if attachId ~= nil and attachId >= 0 then spawnOrigin = caster:GetAttachmentOrigin(attachId) else spawnOrigin = caster:GetAbsOrigin() end end) if not ____try then ____catch() end end local projectileSpeed = self:GetSpecialValueFor("projectile_speed") local direction = targetPoint - spawnOrigin direction.z = 0 local directionLength = math.sqrt(direction.x * direction.x + direction.y * direction.y) if directionLength < 0.01 then return end direction = direction:Normalized() local distance = directionLength local particle = ParticleManager:CreateParticle("particles/units/heroes/hero_abaddon/abaddon_death_coil.vpcf", PATTACH_CUSTOMORIGIN, nil) ParticleManager:SetParticleControl(particle, 0, spawnOrigin) ParticleManager:SetParticleControl(particle, 1, targetPoint) ParticleManager:SetParticleControl( particle, 2, Vector(projectileSpeed, 0, 0) ) ParticleManager:SetParticleControl( particle, 3, Vector(distance, 0, 0) ) ParticleManager:SetParticleControl( particle, 4, Vector(0, 0, 0) ) ParticleManager:SetParticleControl(particle, 9, spawnOrigin) ParticleManager:SetParticleControl(particle, 13, direction) self.projectile_particle = particle self.projectile_start_pos = spawnOrigin self.projectile_target_pos = targetPoint self.projectile_direction = direction self.projectile_speed = projectileSpeed self.projectile_distance = distance local info = { Ability = self, EffectName = "", vSpawnOrigin = spawnOrigin, fDistance = distance, fStartRadius = 0, fEndRadius = 0, Source = caster, bHasFrontalCone = false, bReplaceExisting = false, iUnitTargetTeam = DOTA_UNIT_TARGET_TEAM_ENEMY, iUnitTargetFlags = DOTA_UNIT_TARGET_FLAG_NONE, iUnitTargetType = bit.bor(DOTA_UNIT_TARGET_HERO, DOTA_UNIT_TARGET_BASIC), fExpireTime = GameRules:GetGameTime() + 10, bDeleteOnHit = true, vVelocity = direction * projectileSpeed, iMoveSpeed = projectileSpeed, bProvidesVision = true, iVisionRadius = 200, iVisionTeamNumber = caster:GetTeamNumber() } ProjectileManager:CreateLinearProjectile(info) Timers:CreateTimer( distance / projectileSpeed + 0.1, function() if self.projectile_particle ~= nil then ParticleManager:DestroyParticle(self.projectile_particle, false) ParticleManager:ReleaseParticleIndex(self.projectile_particle) self.projectile_particle = nil end return nil end ) self.target_point = targetPoint local travelTime = distance / projectileSpeed Timers:CreateTimer( travelTime, function() if not self.projectile_hit then self:OnProjectileHit(nil, targetPoint) end return nil end ) local effectCast = ParticleManager:CreateParticle("particles/units/heroes/hero_abaddon/abaddon_death_coil_abaddon.vpcf", PATTACH_ABSORIGIN_FOLLOW, caster) ParticleManager:ReleaseParticleIndex(effectCast) EmitSoundOn("Hero_Abaddon.DeathCoil.Cast", caster) end function sheep_coil.prototype.OnProjectileThink(self, location) if self.projectile_particle ~= nil then local currentPos = GetGroundPosition(location, nil) ParticleManager:SetParticleControl(self.projectile_particle, 0, currentPos) ParticleManager:SetParticleControl(self.projectile_particle, 9, currentPos) local startPos = self.projectile_start_pos local targetPos = self.projectile_target_pos local totalDist = self.projectile_distance local currentDist = math.sqrt((currentPos.x - startPos.x) * (currentPos.x - startPos.x) + (currentPos.y - startPos.y) * (currentPos.y - startPos.y)) local progress = math.min(currentDist / totalDist, 1) ParticleManager:SetParticleControl( self.projectile_particle, 3, Vector(totalDist * (1 - progress), 0, 0) ) end end function sheep_coil.prototype.OnProjectileHit(self, target, location) self.projectile_hit = true if self.projectile_particle ~= nil then ParticleManager:DestroyParticle(self.projectile_particle, false) ParticleManager:ReleaseParticleIndex(self.projectile_particle) self.projectile_particle = nil end local caster = self:GetCaster() local slow_duration = self:GetSpecialValueFor("slow_duration") local radius = self:GetSpecialValueFor("radius") local hitPoint = self.target_point or location local units = FindUnitsInRadius( caster:GetTeamNumber(), hitPoint, nil, radius, DOTA_UNIT_TARGET_TEAM_ENEMY, bit.bor(DOTA_UNIT_TARGET_HERO, DOTA_UNIT_TARGET_BASIC), DOTA_UNIT_TARGET_FLAG_NONE, FIND_ANY_ORDER, false ) for ____, unit in ipairs(units) do ApplyDamage({ victim = unit, attacker = caster, damage = caster:GetAttackDamage(), damage_type = DAMAGE_TYPE_MAGICAL, ability = self }) local existingModifier = unit:FindModifierByName("modifier_sheep_coil_slow") if existingModifier then existingModifier:IncrementStackCount() existingModifier:SetDuration(slow_duration, true) else local modifier = unit:AddNewModifier(caster, self, "modifier_sheep_coil_slow", {duration = slow_duration}) if modifier ~= nil then modifier:SetStackCount(1) end end EmitSoundOn("Hero_Abaddon.DeathCoil.Target", unit) end local particle = ParticleManager:CreateParticle("particles/units/heroes/hero_abaddon/abaddon_death_coil_explosion.vpcf", PATTACH_CUSTOMORIGIN, nil) ParticleManager:SetParticleControl(particle, 0, hitPoint) ParticleManager:SetParticleControl( particle, 1, Vector(radius, 0, 0) ) ParticleManager:ReleaseParticleIndex(particle) return true end function sheep_coil.prototype.GetAbilityTextureName(self) return "abaddon_death_coil" end sheep_coil = __TS__Decorate( sheep_coil, sheep_coil, {registerAbility(nil)}, {kind = "class", name = "sheep_coil"} ) ____exports.sheep_coil = sheep_coil ____exports.modifier_sheep_coil_slow = __TS__Class() local modifier_sheep_coil_slow = ____exports.modifier_sheep_coil_slow modifier_sheep_coil_slow.name = "modifier_sheep_coil_slow" modifier_sheep_coil_slow.____file_path = "scripts/vscripts/abilities/creep/sheep_coil.lua" __TS__ClassExtends(modifier_sheep_coil_slow, BaseModifier) function modifier_sheep_coil_slow.prototype.DeclareFunctions(self) return {MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE} end function modifier_sheep_coil_slow.prototype.GetModifierMoveSpeedBonus_Percentage(self) local ability = self:GetAbility() if not ability then return 0 end return ability:GetSpecialValueFor("movement_slow") * self:GetStackCount() end function modifier_sheep_coil_slow.prototype.OnCreated(self) if not IsServer() then return end end function modifier_sheep_coil_slow.prototype.GetEffectName(self) return "particles/items4_fx/nullifier_slow.vpcf" end function modifier_sheep_coil_slow.prototype.GetEffectAttachType(self) return PATTACH_ABSORIGIN_FOLLOW end function modifier_sheep_coil_slow.prototype.RemoveOnDeath(self) return true end function modifier_sheep_coil_slow.prototype.IsPurgable(self) return true end modifier_sheep_coil_slow = __TS__Decorate( modifier_sheep_coil_slow, modifier_sheep_coil_slow, {registerModifier(nil)}, {kind = "class", name = "modifier_sheep_coil_slow"} ) ____exports.modifier_sheep_coil_slow = modifier_sheep_coil_slow return ____exports