202 lines
7.3 KiB
Lua
202 lines
7.3 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 HOMER_UNIT_NAME = "npc_homer"
|
|
local HOMER_TRIGGER_RADIUS = 200
|
|
local JUMP_DURATION = 5
|
|
local EXPLOSION_DELAY = 2.5
|
|
local EXPLOSION_DAMAGE = 100000000
|
|
____exports.suicide_boys = __TS__Class()
|
|
local suicide_boys = ____exports.suicide_boys
|
|
suicide_boys.name = "suicide_boys"
|
|
suicide_boys.____file_path = "scripts/vscripts/abilities/zombie/Boss/suicide_boys.lua"
|
|
__TS__ClassExtends(suicide_boys, BaseAbility)
|
|
function suicide_boys.prototype.GetIntrinsicModifierName(self)
|
|
return ____exports.modifier_suicide_boys_homer_trigger.name
|
|
end
|
|
function suicide_boys.prototype.Precache(self, context)
|
|
PrecacheResource("particle", "particles/units/heroes/hero_techies/techies_suicide.vpcf", context)
|
|
PrecacheResource("particle", "particles/units/heroes/hero_tiny/tiny_toss_blur.vpcf", context)
|
|
end
|
|
function suicide_boys.prototype.GetBehavior(self)
|
|
return DOTA_ABILITY_BEHAVIOR_PASSIVE
|
|
end
|
|
suicide_boys = __TS__Decorate(
|
|
suicide_boys,
|
|
suicide_boys,
|
|
{registerAbility(nil)},
|
|
{kind = "class", name = "suicide_boys"}
|
|
)
|
|
____exports.suicide_boys = suicide_boys
|
|
____exports.modifier_suicide_boys_homer_trigger = __TS__Class()
|
|
local modifier_suicide_boys_homer_trigger = ____exports.modifier_suicide_boys_homer_trigger
|
|
modifier_suicide_boys_homer_trigger.name = "modifier_suicide_boys_homer_trigger"
|
|
modifier_suicide_boys_homer_trigger.____file_path = "scripts/vscripts/abilities/zombie/Boss/suicide_boys.lua"
|
|
__TS__ClassExtends(modifier_suicide_boys_homer_trigger, BaseModifier)
|
|
function modifier_suicide_boys_homer_trigger.prototype.IsHidden(self)
|
|
return true
|
|
end
|
|
function modifier_suicide_boys_homer_trigger.prototype.IsPurgable(self)
|
|
return false
|
|
end
|
|
function modifier_suicide_boys_homer_trigger.prototype.OnCreated(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
self:StartIntervalThink(0.1)
|
|
end
|
|
function modifier_suicide_boys_homer_trigger.prototype.OnIntervalThink(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local parent = self:GetParent()
|
|
local ability = self:GetAbility()
|
|
if not parent or not ability then
|
|
return
|
|
end
|
|
if not parent:IsAlive() then
|
|
return
|
|
end
|
|
if not ability:IsFullyCastable() then
|
|
return
|
|
end
|
|
if parent:HasModifier(____exports.modifier_tiny_toss_lua.name) then
|
|
return
|
|
end
|
|
local nearbyUnits = FindUnitsInRadius(
|
|
parent:GetTeamNumber(),
|
|
parent:GetAbsOrigin(),
|
|
nil,
|
|
HOMER_TRIGGER_RADIUS,
|
|
DOTA_UNIT_TARGET_TEAM_BOTH,
|
|
bit.bor(DOTA_UNIT_TARGET_HERO, DOTA_UNIT_TARGET_BASIC),
|
|
DOTA_UNIT_TARGET_FLAG_NONE,
|
|
FIND_CLOSEST,
|
|
false
|
|
)
|
|
for ____, unit in ipairs(nearbyUnits) do
|
|
do
|
|
if unit:GetUnitName() ~= HOMER_UNIT_NAME then
|
|
goto __continue15
|
|
end
|
|
self:TriggerPassiveSuicide(parent, ability)
|
|
return
|
|
end
|
|
::__continue15::
|
|
end
|
|
end
|
|
function modifier_suicide_boys_homer_trigger.prototype.TriggerPassiveSuicide(self, parent, ability)
|
|
parent:AddNewModifier(parent, ability, ____exports.modifier_tiny_toss_lua.name, {duration = JUMP_DURATION})
|
|
ability:UseResources(true, false, true, true)
|
|
Timers:CreateTimer(
|
|
EXPLOSION_DELAY,
|
|
function()
|
|
if not IsValidEntity(parent) or not parent:IsAlive() then
|
|
return
|
|
end
|
|
local radius = ability:GetSpecialValueFor("radius")
|
|
local origin = parent:GetAbsOrigin()
|
|
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 explosionFx = ParticleManager:CreateParticle("particles/units/heroes/hero_techies/techies_suicide.vpcf", PATTACH_CUSTOMORIGIN, parent)
|
|
ParticleManager:SetParticleControl(explosionFx, 0, origin)
|
|
ParticleManager:SetParticleControl(
|
|
explosionFx,
|
|
1,
|
|
Vector(radius, radius, radius)
|
|
)
|
|
ParticleManager:ReleaseParticleIndex(explosionFx)
|
|
for ____, unit in ipairs(units) do
|
|
ApplyDamage({
|
|
victim = unit,
|
|
attacker = parent,
|
|
damage = EXPLOSION_DAMAGE,
|
|
damage_type = DAMAGE_TYPE_PURE,
|
|
ability = ability
|
|
})
|
|
end
|
|
end
|
|
)
|
|
end
|
|
modifier_suicide_boys_homer_trigger = __TS__Decorate(
|
|
modifier_suicide_boys_homer_trigger,
|
|
modifier_suicide_boys_homer_trigger,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_suicide_boys_homer_trigger"}
|
|
)
|
|
____exports.modifier_suicide_boys_homer_trigger = modifier_suicide_boys_homer_trigger
|
|
____exports.modifier_tiny_toss_lua = __TS__Class()
|
|
local modifier_tiny_toss_lua = ____exports.modifier_tiny_toss_lua
|
|
modifier_tiny_toss_lua.name = "modifier_tiny_toss_lua"
|
|
modifier_tiny_toss_lua.____file_path = "scripts/vscripts/abilities/zombie/Boss/suicide_boys.lua"
|
|
__TS__ClassExtends(modifier_tiny_toss_lua, BaseModifier)
|
|
function modifier_tiny_toss_lua.prototype.IsHidden(self)
|
|
return true
|
|
end
|
|
function modifier_tiny_toss_lua.prototype.IsDebuff(self)
|
|
return self:GetCaster():GetTeamNumber() ~= self:GetParent():GetTeamNumber()
|
|
end
|
|
function modifier_tiny_toss_lua.prototype.IsStunDebuff(self)
|
|
return true
|
|
end
|
|
function modifier_tiny_toss_lua.prototype.IsPurgable(self)
|
|
return true
|
|
end
|
|
function modifier_tiny_toss_lua.prototype.OnCreated(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local caster = self:GetCaster()
|
|
local parent = self:GetParent()
|
|
local origin = parent:GetAbsOrigin()
|
|
parent:AddNewModifier(
|
|
caster,
|
|
self:GetAbility(),
|
|
"modifier_knockback",
|
|
{
|
|
should_stun = 1,
|
|
knockback_duration = JUMP_DURATION,
|
|
duration = JUMP_DURATION,
|
|
knockback_distance = 0,
|
|
knockback_height = 2500,
|
|
center_x = origin.x,
|
|
center_y = origin.y,
|
|
center_z = origin.z
|
|
}
|
|
)
|
|
EmitSoundOn("balah_babar", caster)
|
|
end
|
|
function modifier_tiny_toss_lua.prototype.CheckState(self)
|
|
return {[MODIFIER_STATE_STUNNED] = true}
|
|
end
|
|
function modifier_tiny_toss_lua.prototype.GetEffectName(self)
|
|
return "particles/units/heroes/hero_tiny/tiny_toss_blur.vpcf"
|
|
end
|
|
function modifier_tiny_toss_lua.prototype.GetEffectAttachType(self)
|
|
return PATTACH_ABSORIGIN_FOLLOW
|
|
end
|
|
modifier_tiny_toss_lua = __TS__Decorate(
|
|
modifier_tiny_toss_lua,
|
|
modifier_tiny_toss_lua,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_tiny_toss_lua"}
|
|
)
|
|
____exports.modifier_tiny_toss_lua = modifier_tiny_toss_lua
|
|
return ____exports
|