137 lines
5.0 KiB
Lua
137 lines
5.0 KiB
Lua
local ____lualib = require("lualib_bundle")
|
|
local __TS__Class = ____lualib.__TS__Class
|
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
|
|
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.agro_leader = __TS__Class()
|
|
local agro_leader = ____exports.agro_leader
|
|
agro_leader.name = "agro_leader"
|
|
agro_leader.____file_path = "scripts/vscripts/abilities/creep/agro_leader.lua"
|
|
__TS__ClassExtends(agro_leader, BaseAbility)
|
|
function agro_leader.prototype.Precache(self, context)
|
|
PrecacheResource("particle", "particles/units/heroes/hero_axe/axe_beserkers_call_owner.vpcf", context)
|
|
PrecacheResource("particle", "particles/status_fx/status_effect_beserkers_call.vpcf", context)
|
|
PrecacheResource("soundfile", "soundevents/game_sounds_heroes/game_sounds_axe.vsndevts", context)
|
|
end
|
|
function agro_leader.prototype.OnAbilityPhaseStart(self)
|
|
if IsServer() then
|
|
self:GetCaster():StartGestureWithPlaybackRate(ACT_DOTA_CAST_ABILITY_4, 0.7)
|
|
self.preParticle = ParticleManager:CreateParticle(
|
|
"particles/darkmoon_creep_warning.vpcf",
|
|
PATTACH_ABSORIGIN_FOLLOW,
|
|
self:GetCaster()
|
|
)
|
|
ParticleManager:SetParticleControlEnt(
|
|
self.preParticle,
|
|
0,
|
|
self:GetCaster(),
|
|
PATTACH_ABSORIGIN_FOLLOW,
|
|
"",
|
|
self:GetCaster():GetOrigin(),
|
|
true
|
|
)
|
|
ParticleManager:SetParticleControl(
|
|
self.preParticle,
|
|
1,
|
|
Vector(100, 100, 100)
|
|
)
|
|
end
|
|
return true
|
|
end
|
|
function agro_leader.prototype.OnAbilityPhaseInterrupted(self)
|
|
if IsClient() or not self.preParticle then
|
|
return
|
|
end
|
|
self:GetCaster():FadeGesture(ACT_DOTA_CAST_ABILITY_4)
|
|
ParticleManager:DestroyParticle(self.preParticle, false)
|
|
end
|
|
function agro_leader.prototype.OnSpellStart(self)
|
|
local caster = self:GetCaster()
|
|
if self.preParticle then
|
|
ParticleManager:DestroyParticle(self.preParticle, false)
|
|
end
|
|
caster:FadeGesture(ACT_DOTA_CAST_ABILITY_4)
|
|
local radius = self:GetSpecialValueFor("radius")
|
|
local particle = ParticleManager:CreateParticle("particles/units/heroes/hero_axe/axe_beserkers_call_owner.vpcf", PATTACH_ABSORIGIN_FOLLOW, caster)
|
|
ParticleManager:SetParticleControl(
|
|
particle,
|
|
2,
|
|
Vector(radius, radius, radius)
|
|
)
|
|
caster:EmitSound("Hero_Axe.Berserkers_Call")
|
|
local enemies = FindUnitsInRadius(
|
|
caster:GetTeamNumber(),
|
|
caster:GetAbsOrigin(),
|
|
nil,
|
|
radius,
|
|
DOTA_UNIT_TARGET_TEAM_ENEMY,
|
|
DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC,
|
|
DOTA_UNIT_TARGET_FLAG_MAGIC_IMMUNE_ENEMIES,
|
|
FIND_ANY_ORDER,
|
|
false
|
|
)
|
|
__TS__ArrayForEach(
|
|
enemies,
|
|
function(____, enemy)
|
|
enemy:MoveToTargetToAttack(caster)
|
|
____exports.modifier_agro_leader_debuff:apply(
|
|
enemy,
|
|
caster,
|
|
self,
|
|
{duration = self:GetSpecialValueFor("duration")}
|
|
)
|
|
end
|
|
)
|
|
end
|
|
agro_leader = __TS__Decorate(
|
|
agro_leader,
|
|
agro_leader,
|
|
{registerAbility(nil)},
|
|
{kind = "class", name = "agro_leader"}
|
|
)
|
|
____exports.agro_leader = agro_leader
|
|
____exports.modifier_agro_leader_debuff = __TS__Class()
|
|
local modifier_agro_leader_debuff = ____exports.modifier_agro_leader_debuff
|
|
modifier_agro_leader_debuff.name = "modifier_agro_leader_debuff"
|
|
modifier_agro_leader_debuff.____file_path = "scripts/vscripts/abilities/creep/agro_leader.lua"
|
|
__TS__ClassExtends(modifier_agro_leader_debuff, BaseModifier)
|
|
function modifier_agro_leader_debuff.prototype.IsHidden(self)
|
|
return false
|
|
end
|
|
function modifier_agro_leader_debuff.prototype.IsPurgable(self)
|
|
return false
|
|
end
|
|
function modifier_agro_leader_debuff.prototype.IsDebuff(self)
|
|
return true
|
|
end
|
|
function modifier_agro_leader_debuff.prototype.CheckState(self)
|
|
return {[MODIFIER_STATE_COMMAND_RESTRICTED] = true}
|
|
end
|
|
function modifier_agro_leader_debuff.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_EVENT_ON_DEATH}
|
|
end
|
|
function modifier_agro_leader_debuff.prototype.OnDeath(self, event)
|
|
if event.unit == self:GetCaster() then
|
|
self:Destroy()
|
|
end
|
|
end
|
|
function modifier_agro_leader_debuff.prototype.OnDestroy(self)
|
|
end
|
|
function modifier_agro_leader_debuff.prototype.GetStatusEffectName(self)
|
|
return "particles/status_fx/status_effect_beserkers_call.vpcf"
|
|
end
|
|
modifier_agro_leader_debuff = __TS__Decorate(
|
|
modifier_agro_leader_debuff,
|
|
modifier_agro_leader_debuff,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_agro_leader_debuff"}
|
|
)
|
|
____exports.modifier_agro_leader_debuff = modifier_agro_leader_debuff
|
|
return ____exports
|