Files
Dota-Zombie-Invasion/scripts/vscripts/abilities/heroes/spectre/ability_spectre_desolate_custom.lua
T
2026-05-29 15:11:31 +07:00

105 lines
4.2 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 ____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_spectre_desolate_custom = __TS__Class()
local ability_spectre_desolate_custom = ____exports.ability_spectre_desolate_custom
ability_spectre_desolate_custom.name = "ability_spectre_desolate_custom"
ability_spectre_desolate_custom.____file_path = "scripts/vscripts/abilities/heroes/spectre/ability_spectre_desolate_custom.lua"
__TS__ClassExtends(ability_spectre_desolate_custom, BaseAbility)
function ability_spectre_desolate_custom.prototype.Precache(self, context)
PrecacheResource("particle", "particles/units/heroes/hero_spectre/spectre_desolate.vpcf", context)
PrecacheResource("soundfile", "soundevents/game_sounds_heroes/game_sounds_spectre.vsndevts", context)
end
function ability_spectre_desolate_custom.prototype.GetIntrinsicModifierName(self)
return ____exports.modifier_spectre_desolate_custom.name
end
ability_spectre_desolate_custom = __TS__Decorate(
ability_spectre_desolate_custom,
ability_spectre_desolate_custom,
{registerAbility(nil)},
{kind = "class", name = "ability_spectre_desolate_custom"}
)
____exports.ability_spectre_desolate_custom = ability_spectre_desolate_custom
____exports.modifier_spectre_desolate_custom = __TS__Class()
local modifier_spectre_desolate_custom = ____exports.modifier_spectre_desolate_custom
modifier_spectre_desolate_custom.name = "modifier_spectre_desolate_custom"
modifier_spectre_desolate_custom.____file_path = "scripts/vscripts/abilities/heroes/spectre/ability_spectre_desolate_custom.lua"
__TS__ClassExtends(modifier_spectre_desolate_custom, BaseModifier)
function modifier_spectre_desolate_custom.prototype.IsHidden(self)
return true
end
function modifier_spectre_desolate_custom.prototype.IsPurgable(self)
return false
end
function modifier_spectre_desolate_custom.prototype.IsPurgeException(self)
return false
end
function modifier_spectre_desolate_custom.prototype.AllowIllusionDuplicate(self)
return true
end
function modifier_spectre_desolate_custom.prototype.DeclareFunctions(self)
return {MODIFIER_EVENT_ON_ATTACK_LANDED}
end
function modifier_spectre_desolate_custom.prototype.OnAttackLanded(self, event)
if not IsServer() then
return
end
local attacker = event.attacker
local target = event.target
local ability = self:GetAbility()
if not ability then
return
end
if attacker ~= self:GetParent() or target:GetTeamNumber() == attacker:GetTeamNumber() or attacker:PassivesDisabled() then
return
end
local healthPct = ability:GetSpecialValueFor("health_damage_pct")
local pureDamage = attacker:GetMaxHealth() / 100 * healthPct
if pureDamage <= 0 then
return
end
ApplyDamage({
attacker = attacker,
victim = target,
damage = pureDamage,
damage_type = DAMAGE_TYPE_PURE,
ability = ability
})
local particle = ParticleManager:CreateParticle("particles/units/heroes/hero_spectre/spectre_desolate.vpcf", PATTACH_POINT, target)
local ground = GetGroundPosition(
target:GetAbsOrigin(),
target
)
ParticleManager:SetParticleControl(
particle,
0,
Vector(
target:GetAbsOrigin().x,
target:GetAbsOrigin().y,
ground.z + 140
)
)
ParticleManager:SetParticleControlForward(
particle,
0,
attacker:GetForwardVector()
)
ParticleManager:ReleaseParticleIndex(particle)
EmitSoundOn("Hero_Spectre.Desolate", target)
end
modifier_spectre_desolate_custom = __TS__Decorate(
modifier_spectre_desolate_custom,
modifier_spectre_desolate_custom,
{registerModifier(nil)},
{kind = "class", name = "modifier_spectre_desolate_custom"}
)
____exports.modifier_spectre_desolate_custom = modifier_spectre_desolate_custom
return ____exports