122 lines
4.9 KiB
Lua
122 lines
4.9 KiB
Lua
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 modifier_ability_global_silence
|
|
local ____dota_ts_adapter = require("lib.dota_ts_adapter")
|
|
local BaseAbility = ____dota_ts_adapter.BaseAbility
|
|
local BaseModifier = ____dota_ts_adapter.BaseModifier
|
|
local registerAbility = ____dota_ts_adapter.registerAbility
|
|
local registerModifier = ____dota_ts_adapter.registerModifier
|
|
____exports.ability_global_silence = __TS__Class()
|
|
local ability_global_silence = ____exports.ability_global_silence
|
|
ability_global_silence.name = "ability_global_silence"
|
|
ability_global_silence.____file_path = "scripts/vscripts/abilities/heroes/silencer/ability_global_silence.lua"
|
|
__TS__ClassExtends(ability_global_silence, BaseAbility)
|
|
function ability_global_silence.prototype.OnSpellStart(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local caster = self:GetCaster()
|
|
local duration = self:GetSpecialValueFor("tooltip_duration")
|
|
local enemies = FindUnitsInRadius(
|
|
caster:GetTeamNumber(),
|
|
caster:GetOrigin(),
|
|
nil,
|
|
FIND_UNITS_EVERYWHERE,
|
|
DOTA_UNIT_TARGET_TEAM_ENEMY,
|
|
DOTA_UNIT_TARGET_ALL,
|
|
bit.bor(DOTA_UNIT_TARGET_FLAG_MAGIC_IMMUNE_ENEMIES, DOTA_UNIT_TARGET_FLAG_MANA_ONLY),
|
|
FIND_ANY_ORDER,
|
|
false
|
|
)
|
|
for ____, enemy in ipairs(enemies) do
|
|
enemy:AddNewModifier(caster, self, modifier_ability_global_silence.name, {duration = duration})
|
|
if enemy:IsHero() then
|
|
local heroFx = ParticleManager:CreateParticle("particles/units/heroes/hero_silencer/silencer_global_silence_hero.vpcf", PATTACH_ABSORIGIN_FOLLOW, enemy)
|
|
ParticleManager:SetParticleControlEnt(
|
|
heroFx,
|
|
1,
|
|
enemy,
|
|
PATTACH_ABSORIGIN_FOLLOW,
|
|
"attach_attack1",
|
|
Vector(0, 0, 0),
|
|
true
|
|
)
|
|
ParticleManager:ReleaseParticleIndex(heroFx)
|
|
local playerOwner = enemy:GetPlayerOwner()
|
|
if playerOwner ~= nil and playerOwner ~= nil then
|
|
EmitSoundOnClient("Hero_Silencer.GlobalSilence.Effect", playerOwner)
|
|
end
|
|
end
|
|
end
|
|
local castFx = ParticleManager:CreateParticle("particles/units/heroes/hero_silencer/silencer_global_silence.vpcf", PATTACH_ABSORIGIN_FOLLOW, caster)
|
|
ParticleManager:SetParticleControlForward(
|
|
castFx,
|
|
0,
|
|
caster:GetForwardVector()
|
|
)
|
|
ParticleManager:SetParticleControlEnt(
|
|
castFx,
|
|
1,
|
|
caster,
|
|
PATTACH_POINT_FOLLOW,
|
|
"attach_attack1",
|
|
Vector(0, 0, 0),
|
|
true
|
|
)
|
|
ParticleManager:ReleaseParticleIndex(castFx)
|
|
EmitGlobalSound("Hero_Silencer.GlobalSilence.Cast")
|
|
end
|
|
ability_global_silence = __TS__Decorate(
|
|
ability_global_silence,
|
|
ability_global_silence,
|
|
{registerAbility(nil)},
|
|
{kind = "class", name = "ability_global_silence"}
|
|
)
|
|
____exports.ability_global_silence = ability_global_silence
|
|
modifier_ability_global_silence = __TS__Class()
|
|
modifier_ability_global_silence.name = "modifier_ability_global_silence"
|
|
modifier_ability_global_silence.____file_path = "scripts/vscripts/abilities/heroes/silencer/ability_global_silence.lua"
|
|
__TS__ClassExtends(modifier_ability_global_silence, BaseModifier)
|
|
function modifier_ability_global_silence.prototype.____constructor(self, ...)
|
|
BaseModifier.prototype.____constructor(self, ...)
|
|
self.incomingPct = 0
|
|
end
|
|
function modifier_ability_global_silence.prototype.IsDebuff(self)
|
|
return true
|
|
end
|
|
function modifier_ability_global_silence.prototype.IsPurgable(self)
|
|
return true
|
|
end
|
|
function modifier_ability_global_silence.prototype.OnCreated(self)
|
|
local ____opt_0 = self:GetAbility()
|
|
self.incomingPct = ____opt_0 and ____opt_0:GetSpecialValueFor("icnoming_enemy") or 0
|
|
end
|
|
function modifier_ability_global_silence.prototype.GetPriority(self)
|
|
return MODIFIER_PRIORITY_SUPER_ULTRA
|
|
end
|
|
function modifier_ability_global_silence.prototype.CheckState(self)
|
|
return {[MODIFIER_STATE_SILENCED] = true}
|
|
end
|
|
function modifier_ability_global_silence.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_PROPERTY_INCOMING_DAMAGE_PERCENTAGE}
|
|
end
|
|
function modifier_ability_global_silence.prototype.GetModifierIncomingDamage_Percentage(self)
|
|
return self.incomingPct
|
|
end
|
|
function modifier_ability_global_silence.prototype.GetEffectName(self)
|
|
return "particles/generic_gameplay/generic_silenced.vpcf"
|
|
end
|
|
function modifier_ability_global_silence.prototype.GetEffectAttachType(self)
|
|
return PATTACH_OVERHEAD_FOLLOW
|
|
end
|
|
modifier_ability_global_silence = __TS__Decorate(
|
|
modifier_ability_global_silence,
|
|
modifier_ability_global_silence,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_ability_global_silence"}
|
|
)
|
|
return ____exports
|