Files
Dota-Zombie-Invasion/scripts/vscripts/abilities/creep/demon_dragon_satyr/fear.lua
T
2026-05-29 15:11:31 +07:00

133 lines
4.7 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.fear = __TS__Class()
local fear = ____exports.fear
fear.name = "fear"
fear.____file_path = "scripts/vscripts/abilities/creep/demon_dragon_satyr/fear.lua"
__TS__ClassExtends(fear, BaseAbility)
function fear.prototype.GetCastRange(self)
return self:GetSpecialValueFor("cast_range")
end
function fear.prototype.OnSpellStart(self)
local caster = self:GetCaster()
local duration = self:GetSpecialValueFor("duration")
if not caster then
return
end
local units = FindUnitsInRadius(
caster:GetTeamNumber(),
caster:GetAbsOrigin(),
nil,
1200,
DOTA_UNIT_TARGET_TEAM_ENEMY,
DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC,
DOTA_UNIT_TARGET_FLAG_NONE,
FIND_ANY_ORDER,
false
)
local particle = ParticleManager:CreateParticle("particles/econ/items/terrorblade/terrorblade_back_ti8/terrorblade_sunder_ti8_swirl_rope.vpcf", PATTACH_WORLDORIGIN, nil)
ParticleManager:SetParticleControl(
particle,
0,
caster:GetAbsOrigin()
)
ParticleManager:ReleaseParticleIndex(particle)
for ____, unit in ipairs(units) do
unit:AddNewModifier(caster, self, "modifier_fear_debuff", {duration = duration})
EmitSoundOn("Hero_NightStalker.Void", unit)
end
end
fear = __TS__Decorate(
fear,
fear,
{registerAbility(nil)},
{kind = "class", name = "fear"}
)
____exports.fear = fear
____exports.modifier_fear_debuff = __TS__Class()
local modifier_fear_debuff = ____exports.modifier_fear_debuff
modifier_fear_debuff.name = "modifier_fear_debuff"
modifier_fear_debuff.____file_path = "scripts/vscripts/abilities/creep/demon_dragon_satyr/fear.lua"
__TS__ClassExtends(modifier_fear_debuff, BaseModifier)
function modifier_fear_debuff.prototype.____constructor(self, ...)
BaseModifier.prototype.____constructor(self, ...)
self.interval = 0.03
end
function modifier_fear_debuff.prototype.IsHidden(self)
return false
end
function modifier_fear_debuff.prototype.IsDebuff(self)
return true
end
function modifier_fear_debuff.prototype.IsPurgable(self)
return true
end
function modifier_fear_debuff.prototype.GetEffectName(self)
return "particles/econ/items/nightstalker/nightstalker_black_nihility/nightstalker_black_nihility_void.vpcf"
end
function modifier_fear_debuff.prototype.GetEffectAttachType(self)
return PATTACH_CENTER_FOLLOW
end
function modifier_fear_debuff.prototype.OnCreated(self)
if not IsServer() then
return
end
self.particle = ParticleManager:CreateParticle(
"particles/generic_gameplay/generic_feared.vpcf",
PATTACH_OVERHEAD_FOLLOW,
self:GetParent()
)
self:StartIntervalThink(self.interval)
local ____opt_0 = self:GetCaster()
self.casterPos = ____opt_0 and ____opt_0:GetAbsOrigin()
end
function modifier_fear_debuff.prototype.OnDestroy(self)
if not IsServer() then
return
end
if self.particle then
ParticleManager:DestroyParticle(self.particle, false)
ParticleManager:ReleaseParticleIndex(self.particle)
end
end
function modifier_fear_debuff.prototype.OnIntervalThink(self)
if not IsServer() or not self.casterPos then
return
end
local unit = self:GetParent()
local unitPos = unit:GetAbsOrigin()
local direction = unitPos:__sub(self.casterPos):Normalized()
unit:MoveToPosition(unitPos:__add(direction:__mul(150)))
end
function modifier_fear_debuff.prototype.DeclareFunctions(self)
return {MODIFIER_PROPERTY_PROVIDES_FOW_POSITION, MODIFIER_PROPERTY_BONUS_VISION_PERCENTAGE, MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE}
end
function modifier_fear_debuff.prototype.BonusVisionPercentage(self)
return -100
end
function modifier_fear_debuff.prototype.MovespeedBonusPercentage(self)
return -100
end
function modifier_fear_debuff.prototype.GetModifierProvidesFOWVision(self)
return 0
end
function modifier_fear_debuff.prototype.CheckState(self)
return {[MODIFIER_STATE_FEARED] = true, [MODIFIER_STATE_COMMAND_RESTRICTED] = true}
end
modifier_fear_debuff = __TS__Decorate(
modifier_fear_debuff,
modifier_fear_debuff,
{registerModifier(nil)},
{kind = "class", name = "modifier_fear_debuff"}
)
____exports.modifier_fear_debuff = modifier_fear_debuff
return ____exports