124 lines
5.1 KiB
Lua
124 lines
5.1 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
|
|
local ____creep_render_color = require("utils.creep_render_color")
|
|
local trySetIntrinsicCreepRenderColor = ____creep_render_color.trySetIntrinsicCreepRenderColor
|
|
--- Пассив: при смерти взрыв по радиусу — урон и союзникам, и врагам (герои и крипы).
|
|
____exports.zombie_death_explosion = __TS__Class()
|
|
local zombie_death_explosion = ____exports.zombie_death_explosion
|
|
zombie_death_explosion.name = "zombie_death_explosion"
|
|
zombie_death_explosion.____file_path = "scripts/vscripts/abilities/creep/zombie_death_explosion.lua"
|
|
__TS__ClassExtends(zombie_death_explosion, BaseAbility)
|
|
function zombie_death_explosion.prototype.GetIntrinsicModifierName(self)
|
|
return "modifier_zombie_death_explosion_listener"
|
|
end
|
|
function zombie_death_explosion.prototype.Precache(self, context)
|
|
PrecacheResource("particle", "particles/units/heroes/hero_techies/techies_remote_mines_detonate.vpcf", context)
|
|
end
|
|
zombie_death_explosion = __TS__Decorate(
|
|
zombie_death_explosion,
|
|
zombie_death_explosion,
|
|
{registerAbility(nil)},
|
|
{kind = "class", name = "zombie_death_explosion"}
|
|
)
|
|
____exports.zombie_death_explosion = zombie_death_explosion
|
|
____exports.modifier_zombie_death_explosion_listener = __TS__Class()
|
|
local modifier_zombie_death_explosion_listener = ____exports.modifier_zombie_death_explosion_listener
|
|
modifier_zombie_death_explosion_listener.name = "modifier_zombie_death_explosion_listener"
|
|
modifier_zombie_death_explosion_listener.____file_path = "scripts/vscripts/abilities/creep/zombie_death_explosion.lua"
|
|
__TS__ClassExtends(modifier_zombie_death_explosion_listener, BaseModifier)
|
|
function modifier_zombie_death_explosion_listener.prototype.IsHidden(self)
|
|
return true
|
|
end
|
|
function modifier_zombie_death_explosion_listener.prototype.IsPurgable(self)
|
|
return false
|
|
end
|
|
function modifier_zombie_death_explosion_listener.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_EVENT_ON_DEATH}
|
|
end
|
|
function modifier_zombie_death_explosion_listener.prototype.OnCreated(self, params)
|
|
if IsServer() then
|
|
trySetIntrinsicCreepRenderColor(
|
|
nil,
|
|
self:GetParent(),
|
|
255,
|
|
0,
|
|
0
|
|
)
|
|
end
|
|
end
|
|
function modifier_zombie_death_explosion_listener.prototype.OnDeath(self, event)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local parent = self:GetParent()
|
|
if event.unit ~= parent then
|
|
return
|
|
end
|
|
local ability = self:GetAbility()
|
|
if not ability then
|
|
return
|
|
end
|
|
local radius = ability:GetSpecialValueFor("radius")
|
|
local baseDamage = ability:GetSpecialValueFor("explosion_damage") + self:GetCaster():GetAttackDamage() * 0.35
|
|
local origin = parent:GetAbsOrigin()
|
|
local particle = ParticleManager:CreateParticle("particles/units/heroes/hero_techies/techies_remote_mines_detonate.vpcf", PATTACH_WORLDORIGIN, nil)
|
|
ParticleManager:SetParticleControl(particle, 0, origin)
|
|
ParticleManager:SetParticleControl(
|
|
particle,
|
|
1,
|
|
Vector(radius, radius, radius)
|
|
)
|
|
ParticleManager:ReleaseParticleIndex(particle)
|
|
EmitSoundOn("Hero_Techies.RemoteMine.Detonate", parent)
|
|
local units = FindUnitsInRadius(
|
|
parent:GetTeamNumber(),
|
|
origin,
|
|
nil,
|
|
radius,
|
|
DOTA_UNIT_TARGET_TEAM_BOTH,
|
|
bit.bor(DOTA_UNIT_TARGET_HERO, DOTA_UNIT_TARGET_BASIC),
|
|
DOTA_UNIT_TARGET_FLAG_NONE,
|
|
FIND_ANY_ORDER,
|
|
false
|
|
)
|
|
local deadIndex = parent:entindex()
|
|
for ____, target in ipairs(units) do
|
|
do
|
|
if not target or not IsValidEntity(target) or not target:IsAlive() then
|
|
goto __continue13
|
|
end
|
|
if target:entindex() == deadIndex then
|
|
goto __continue13
|
|
end
|
|
local damage = target:IsRangedAttacker() and baseDamage or baseDamage * 0.25
|
|
if target:GetTeamNumber() == parent:GetTeamNumber() then
|
|
damage = damage * 0.5
|
|
end
|
|
ApplyDamage({
|
|
victim = target,
|
|
attacker = parent,
|
|
damage = damage,
|
|
damage_type = DAMAGE_TYPE_PHYSICAL,
|
|
ability = ability
|
|
})
|
|
end
|
|
::__continue13::
|
|
end
|
|
end
|
|
modifier_zombie_death_explosion_listener = __TS__Decorate(
|
|
modifier_zombie_death_explosion_listener,
|
|
modifier_zombie_death_explosion_listener,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_zombie_death_explosion_listener"}
|
|
)
|
|
____exports.modifier_zombie_death_explosion_listener = modifier_zombie_death_explosion_listener
|
|
return ____exports
|