168 lines
6.4 KiB
Lua
168 lines
6.4 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 modifier_ability_last_word, modifier_ability_last_word_silence
|
|
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_last_word = __TS__Class()
|
|
local ability_last_word = ____exports.ability_last_word
|
|
ability_last_word.name = "ability_last_word"
|
|
ability_last_word.____file_path = "scripts/vscripts/abilities/heroes/silencer/ability_last_word.lua"
|
|
__TS__ClassExtends(ability_last_word, BaseAbility)
|
|
function ability_last_word.prototype.OnSpellStart(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local caster = self:GetCaster()
|
|
local target = self:GetCursorTarget()
|
|
if not target then
|
|
return
|
|
end
|
|
local debuffDuration = self:GetSpecialValueFor("debuff_duration")
|
|
target:AddNewModifier(caster, self, modifier_ability_last_word.name, {duration = debuffDuration})
|
|
local direction = target:GetOrigin() - caster:GetOrigin()
|
|
direction.z = 0
|
|
local normalized = direction:Normalized()
|
|
local castFx = ParticleManager:CreateParticle("particles/units/heroes/hero_silencer/silencer_last_word_status_cast.vpcf", PATTACH_ABSORIGIN_FOLLOW, caster)
|
|
ParticleManager:SetParticleControlEnt(
|
|
castFx,
|
|
0,
|
|
caster,
|
|
PATTACH_POINT_FOLLOW,
|
|
"attach_attack1",
|
|
Vector(0, 0, 0),
|
|
true
|
|
)
|
|
ParticleManager:SetParticleControlForward(castFx, 1, normalized)
|
|
ParticleManager:ReleaseParticleIndex(castFx)
|
|
EmitSoundOn("Hero_Silencer.LastWord.Cast", caster)
|
|
end
|
|
ability_last_word = __TS__Decorate(
|
|
ability_last_word,
|
|
ability_last_word,
|
|
{registerAbility(nil)},
|
|
{kind = "class", name = "ability_last_word"}
|
|
)
|
|
____exports.ability_last_word = ability_last_word
|
|
modifier_ability_last_word = __TS__Class()
|
|
modifier_ability_last_word.name = "modifier_ability_last_word"
|
|
modifier_ability_last_word.____file_path = "scripts/vscripts/abilities/heroes/silencer/ability_last_word.lua"
|
|
__TS__ClassExtends(modifier_ability_last_word, BaseModifier)
|
|
function modifier_ability_last_word.prototype.____constructor(self, ...)
|
|
BaseModifier.prototype.____constructor(self, ...)
|
|
self.silenceDuration = 0
|
|
self.damage = 0
|
|
self.intPct = 0
|
|
end
|
|
function modifier_ability_last_word.prototype.IsDebuff(self)
|
|
return true
|
|
end
|
|
function modifier_ability_last_word.prototype.IsPurgable(self)
|
|
return true
|
|
end
|
|
function modifier_ability_last_word.prototype.OnCreated(self, params)
|
|
local ability = self:GetAbility()
|
|
if not ability then
|
|
return
|
|
end
|
|
self.silenceDuration = ability:GetSpecialValueFor("duration")
|
|
self.damage = ability:GetSpecialValueFor("damage")
|
|
self.intPct = ability:GetSpecialValueFor("int")
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
self:StartIntervalThink(params.duration or 0)
|
|
EmitSoundOn(
|
|
"Hero_Silencer.LastWord.Target",
|
|
self:GetParent()
|
|
)
|
|
end
|
|
function modifier_ability_last_word.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_PROPERTY_PROVIDES_FOW_POSITION, MODIFIER_EVENT_ON_ABILITY_FULLY_CAST}
|
|
end
|
|
function modifier_ability_last_word.prototype.GetModifierProvidesFOWVision(self)
|
|
return 1
|
|
end
|
|
function modifier_ability_last_word.prototype.OnAbilityFullyCast(self, event)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
if event.unit ~= self:GetParent() then
|
|
return
|
|
end
|
|
if not event.ability or event.ability:IsItem() then
|
|
return
|
|
end
|
|
self:TriggerLastWord()
|
|
end
|
|
function modifier_ability_last_word.prototype.OnIntervalThink(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
self:TriggerLastWord()
|
|
end
|
|
function modifier_ability_last_word.prototype.TriggerLastWord(self)
|
|
local ability = self:GetAbility()
|
|
local caster = self:GetCaster()
|
|
local parent = self:GetParent()
|
|
if not ability or not caster then
|
|
return
|
|
end
|
|
parent:AddNewModifier(caster, ability, modifier_ability_last_word_silence.name, {duration = self.silenceDuration})
|
|
ApplyDamage({
|
|
victim = parent,
|
|
attacker = caster,
|
|
damage = self.damage + caster:GetIntellect(true) * (self.intPct / 100),
|
|
damage_type = ability:GetAbilityDamageType(),
|
|
ability = ability
|
|
})
|
|
local dmgFx = ParticleManager:CreateParticle("particles/units/heroes/hero_silencer/silencer_last_word_dmg.vpcf", PATTACH_ABSORIGIN_FOLLOW, parent)
|
|
ParticleManager:ReleaseParticleIndex(dmgFx)
|
|
EmitSoundOn("Hero_Silencer.LastWord.Damage", parent)
|
|
StopSoundOn("Hero_Silencer.LastWord.Target", parent)
|
|
self:Destroy()
|
|
end
|
|
function modifier_ability_last_word.prototype.GetEffectName(self)
|
|
return "particles/units/heroes/hero_silencer/silencer_last_word_status.vpcf"
|
|
end
|
|
function modifier_ability_last_word.prototype.GetEffectAttachType(self)
|
|
return PATTACH_ABSORIGIN_FOLLOW
|
|
end
|
|
modifier_ability_last_word = __TS__Decorate(
|
|
modifier_ability_last_word,
|
|
modifier_ability_last_word,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_ability_last_word"}
|
|
)
|
|
modifier_ability_last_word_silence = __TS__Class()
|
|
modifier_ability_last_word_silence.name = "modifier_ability_last_word_silence"
|
|
modifier_ability_last_word_silence.____file_path = "scripts/vscripts/abilities/heroes/silencer/ability_last_word.lua"
|
|
__TS__ClassExtends(modifier_ability_last_word_silence, BaseModifier)
|
|
function modifier_ability_last_word_silence.prototype.IsDebuff(self)
|
|
return true
|
|
end
|
|
function modifier_ability_last_word_silence.prototype.IsPurgable(self)
|
|
return true
|
|
end
|
|
function modifier_ability_last_word_silence.prototype.CheckState(self)
|
|
return {[MODIFIER_STATE_SILENCED] = true}
|
|
end
|
|
function modifier_ability_last_word_silence.prototype.GetEffectName(self)
|
|
return "particles/generic_gameplay/generic_silenced.vpcf"
|
|
end
|
|
function modifier_ability_last_word_silence.prototype.GetEffectAttachType(self)
|
|
return PATTACH_OVERHEAD_FOLLOW
|
|
end
|
|
modifier_ability_last_word_silence = __TS__Decorate(
|
|
modifier_ability_last_word_silence,
|
|
modifier_ability_last_word_silence,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_ability_last_word_silence"}
|
|
)
|
|
return ____exports
|