284 lines
11 KiB
Lua
284 lines
11 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.ability_pudge_rot_custom = __TS__Class()
|
|
local ability_pudge_rot_custom = ____exports.ability_pudge_rot_custom
|
|
ability_pudge_rot_custom.name = "ability_pudge_rot_custom"
|
|
ability_pudge_rot_custom.____file_path = "scripts/vscripts/abilities/heroes/pudge/ability_pudge_rot_custom.lua"
|
|
__TS__ClassExtends(ability_pudge_rot_custom, BaseAbility)
|
|
function ability_pudge_rot_custom.prototype.GetIntrinsicModifierName(self)
|
|
return ____exports.modifier_pudge_rot_aspect_damage_custom.name
|
|
end
|
|
function ability_pudge_rot_custom.prototype.Precache(self, context)
|
|
PrecacheResource("particle", "particles/units/heroes/hero_pudge/pudge_rot.vpcf", context)
|
|
PrecacheResource("particle", "particles/units/heroes/hero_pudge/pudge_rot_recipient.vpcf", context)
|
|
end
|
|
function ability_pudge_rot_custom.prototype.GetAOERadius(self)
|
|
local caster = self:GetCaster()
|
|
return self:GetSpecialValueFor("rot_radius") + (caster and caster:HasScepter() and self:GetSpecialValueFor("scepter_bonus_radius") or 0)
|
|
end
|
|
function ability_pudge_rot_custom.prototype.OnToggle(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local caster = self:GetCaster()
|
|
if self:GetToggleState() then
|
|
____exports.modifier_pudge_rot_custom:apply(caster, caster, self, {})
|
|
caster:StartGesture(ACT_DOTA_CAST_ABILITY_ROT)
|
|
self.nfx = ParticleManager:CreateParticle("particles/units/heroes/hero_pudge/pudge_rot.vpcf", PATTACH_ABSORIGIN_FOLLOW, caster)
|
|
ParticleManager:SetParticleControlEnt(
|
|
self.nfx,
|
|
0,
|
|
caster,
|
|
PATTACH_ABSORIGIN_FOLLOW,
|
|
"attach_hitloc",
|
|
caster:GetAbsOrigin(),
|
|
true
|
|
)
|
|
ParticleManager:SetParticleControl(
|
|
self.nfx,
|
|
1,
|
|
Vector(
|
|
self:GetAOERadius(),
|
|
self:GetAOERadius(),
|
|
self:GetAOERadius()
|
|
)
|
|
)
|
|
EmitSoundOn("Hero_Pudge.Rot", caster)
|
|
else
|
|
caster:RemoveModifierByName(____exports.modifier_pudge_rot_custom.name)
|
|
if self.nfx ~= nil then
|
|
ParticleManager:DestroyParticle(self.nfx, true)
|
|
ParticleManager:ReleaseParticleIndex(self.nfx)
|
|
self.nfx = nil
|
|
end
|
|
StopSoundOn("Hero_Pudge.Rot", caster)
|
|
end
|
|
end
|
|
ability_pudge_rot_custom = __TS__Decorate(
|
|
ability_pudge_rot_custom,
|
|
ability_pudge_rot_custom,
|
|
{registerAbility(nil)},
|
|
{kind = "class", name = "ability_pudge_rot_custom"}
|
|
)
|
|
____exports.ability_pudge_rot_custom = ability_pudge_rot_custom
|
|
____exports.modifier_pudge_rot_aspect_damage_custom = __TS__Class()
|
|
local modifier_pudge_rot_aspect_damage_custom = ____exports.modifier_pudge_rot_aspect_damage_custom
|
|
modifier_pudge_rot_aspect_damage_custom.name = "modifier_pudge_rot_aspect_damage_custom"
|
|
modifier_pudge_rot_aspect_damage_custom.____file_path = "scripts/vscripts/abilities/heroes/pudge/ability_pudge_rot_custom.lua"
|
|
__TS__ClassExtends(modifier_pudge_rot_aspect_damage_custom, BaseModifier)
|
|
function modifier_pudge_rot_aspect_damage_custom.prototype.IsHidden(self)
|
|
return true
|
|
end
|
|
function modifier_pudge_rot_aspect_damage_custom.prototype.IsPurgable(self)
|
|
return false
|
|
end
|
|
function modifier_pudge_rot_aspect_damage_custom.prototype.RemoveOnDeath(self)
|
|
return false
|
|
end
|
|
function modifier_pudge_rot_aspect_damage_custom.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_PROPERTY_BASEDAMAGEOUTGOING_PERCENTAGE}
|
|
end
|
|
function modifier_pudge_rot_aspect_damage_custom.prototype.GetModifierBaseDamageOutgoing_Percentage(self)
|
|
return 0
|
|
end
|
|
modifier_pudge_rot_aspect_damage_custom = __TS__Decorate(
|
|
modifier_pudge_rot_aspect_damage_custom,
|
|
modifier_pudge_rot_aspect_damage_custom,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_pudge_rot_aspect_damage_custom"}
|
|
)
|
|
____exports.modifier_pudge_rot_aspect_damage_custom = modifier_pudge_rot_aspect_damage_custom
|
|
____exports.modifier_pudge_rot_custom = __TS__Class()
|
|
local modifier_pudge_rot_custom = ____exports.modifier_pudge_rot_custom
|
|
modifier_pudge_rot_custom.name = "modifier_pudge_rot_custom"
|
|
modifier_pudge_rot_custom.____file_path = "scripts/vscripts/abilities/heroes/pudge/ability_pudge_rot_custom.lua"
|
|
__TS__ClassExtends(modifier_pudge_rot_custom, BaseModifier)
|
|
function modifier_pudge_rot_custom.prototype.____constructor(self, ...)
|
|
BaseModifier.prototype.____constructor(self, ...)
|
|
self.currentDamagePerSec = 0
|
|
self.damageIncreasePerSec = 0
|
|
self.tickInterval = 0.2
|
|
end
|
|
function modifier_pudge_rot_custom.prototype.IsHidden(self)
|
|
return false
|
|
end
|
|
function modifier_pudge_rot_custom.prototype.IsDebuff(self)
|
|
return false
|
|
end
|
|
function modifier_pudge_rot_custom.prototype.IsPurgable(self)
|
|
return false
|
|
end
|
|
function modifier_pudge_rot_custom.prototype.OnCreated(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local ability = self:GetAbility()
|
|
if not ability then
|
|
return
|
|
end
|
|
self.tickInterval = ability:GetSpecialValueFor("tick_interval")
|
|
self.currentDamagePerSec = ability:GetSpecialValueFor("rot_damage_per_sec")
|
|
self.damageIncreasePerSec = ability:GetSpecialValueFor("rot_damage_increase_per_sec")
|
|
self:StartIntervalThink(self.tickInterval)
|
|
end
|
|
function modifier_pudge_rot_custom.prototype.OnDestroy(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
StopSoundOn(
|
|
"Hero_Pudge.Rot",
|
|
self:GetParent()
|
|
)
|
|
end
|
|
function modifier_pudge_rot_custom.prototype.OnIntervalThink(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local parent = self:GetParent()
|
|
local ability = self:GetAbility()
|
|
if not ability or not parent:IsAlive() then
|
|
return
|
|
end
|
|
self.currentDamagePerSec = self.currentDamagePerSec + self.damageIncreasePerSec * self.tickInterval
|
|
local selfDamagePct = ability:GetSpecialValueFor("self_damage_pct_per_sec")
|
|
local selfDamage = parent:GetMaxHealth() * selfDamagePct * 0.01 * self.tickInterval
|
|
ApplyDamage({
|
|
victim = parent,
|
|
attacker = parent,
|
|
damage = selfDamage,
|
|
damage_type = DAMAGE_TYPE_MAGICAL,
|
|
ability = ability,
|
|
damage_flags = DOTA_DAMAGE_FLAG_NON_LETHAL
|
|
})
|
|
end
|
|
function modifier_pudge_rot_custom.prototype.IsAura(self)
|
|
return true
|
|
end
|
|
function modifier_pudge_rot_custom.prototype.GetAuraRadius(self)
|
|
local ability = self:GetAbility()
|
|
local parent = self:GetParent()
|
|
if not ability then
|
|
return 0
|
|
end
|
|
return ability:GetSpecialValueFor("rot_radius") + (parent:HasScepter() and ability:GetSpecialValueFor("scepter_bonus_radius") or 0)
|
|
end
|
|
function modifier_pudge_rot_custom.prototype.GetAuraSearchTeam(self)
|
|
return DOTA_UNIT_TARGET_TEAM_ENEMY
|
|
end
|
|
function modifier_pudge_rot_custom.prototype.GetAuraSearchType(self)
|
|
return bit.bor(DOTA_UNIT_TARGET_HERO, DOTA_UNIT_TARGET_BASIC)
|
|
end
|
|
function modifier_pudge_rot_custom.prototype.GetAuraDuration(self)
|
|
return 0.5
|
|
end
|
|
function modifier_pudge_rot_custom.prototype.GetModifierAura(self)
|
|
return ____exports.modifier_pudge_rot_slow_custom.name
|
|
end
|
|
function modifier_pudge_rot_custom.prototype.GetCurrentDamagePerSec(self)
|
|
return self.currentDamagePerSec
|
|
end
|
|
modifier_pudge_rot_custom = __TS__Decorate(
|
|
modifier_pudge_rot_custom,
|
|
modifier_pudge_rot_custom,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_pudge_rot_custom"}
|
|
)
|
|
____exports.modifier_pudge_rot_custom = modifier_pudge_rot_custom
|
|
____exports.modifier_pudge_rot_slow_custom = __TS__Class()
|
|
local modifier_pudge_rot_slow_custom = ____exports.modifier_pudge_rot_slow_custom
|
|
modifier_pudge_rot_slow_custom.name = "modifier_pudge_rot_slow_custom"
|
|
modifier_pudge_rot_slow_custom.____file_path = "scripts/vscripts/abilities/heroes/pudge/ability_pudge_rot_custom.lua"
|
|
__TS__ClassExtends(modifier_pudge_rot_slow_custom, BaseModifier)
|
|
function modifier_pudge_rot_slow_custom.prototype.IsHidden(self)
|
|
return false
|
|
end
|
|
function modifier_pudge_rot_slow_custom.prototype.IsDebuff(self)
|
|
return true
|
|
end
|
|
function modifier_pudge_rot_slow_custom.prototype.IsPurgable(self)
|
|
return true
|
|
end
|
|
function modifier_pudge_rot_slow_custom.prototype.GetEffectName(self)
|
|
return "particles/units/heroes/hero_pudge/pudge_rot_recipient.vpcf"
|
|
end
|
|
function modifier_pudge_rot_slow_custom.prototype.GetEffectAttachType(self)
|
|
return PATTACH_ABSORIGIN_FOLLOW
|
|
end
|
|
function modifier_pudge_rot_slow_custom.prototype.OnCreated(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local ____self_StartIntervalThink_2 = self.StartIntervalThink
|
|
local ____opt_0 = self:GetAbility()
|
|
____self_StartIntervalThink_2(
|
|
self,
|
|
____opt_0 and ____opt_0:GetSpecialValueFor("tick_interval") or 0.2
|
|
)
|
|
end
|
|
function modifier_pudge_rot_slow_custom.prototype.OnIntervalThink(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local ability = self:GetAbility()
|
|
local caster = self:GetCaster()
|
|
local parent = self:GetParent()
|
|
if not ability or not caster or not parent or not caster:IsAlive() or not caster:HasModifier(____exports.modifier_pudge_rot_custom.name) then
|
|
return
|
|
end
|
|
local auraOwner = caster:FindModifierByName(____exports.modifier_pudge_rot_custom.name)
|
|
if not auraOwner then
|
|
return
|
|
end
|
|
local tickInterval = ability:GetSpecialValueFor("tick_interval")
|
|
local rampDamage = auraOwner:GetCurrentDamagePerSec() * tickInterval
|
|
local maxHpPct = ability:GetSpecialValueFor("max_health_damage_pct") * 0.01
|
|
local maxHpDamage = caster:GetMaxHealth() * maxHpPct * tickInterval
|
|
local damage = rampDamage + maxHpDamage
|
|
if damage <= 0 then
|
|
return
|
|
end
|
|
ApplyDamage({
|
|
victim = parent,
|
|
attacker = caster,
|
|
damage = damage,
|
|
damage_type = DAMAGE_TYPE_MAGICAL,
|
|
ability = ability
|
|
})
|
|
end
|
|
function modifier_pudge_rot_slow_custom.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE, MODIFIER_PROPERTY_HP_REGEN_AMPLIFY_PERCENTAGE}
|
|
end
|
|
function modifier_pudge_rot_slow_custom.prototype.GetModifierMoveSpeedBonus_Percentage(self)
|
|
local ability = self:GetAbility()
|
|
local caster = self:GetCaster()
|
|
if not ability or not caster then
|
|
return 0
|
|
end
|
|
local slowPct = ability:GetSpecialValueFor("rot_slow_pct")
|
|
return -slowPct
|
|
end
|
|
function modifier_pudge_rot_slow_custom.prototype.GetModifierHPRegenAmplify_Percentage(self)
|
|
local ability = self:GetAbility()
|
|
local caster = self:GetCaster()
|
|
if not ability or not caster or not caster:HasScepter() then
|
|
return 0
|
|
end
|
|
return -ability:GetSpecialValueFor("scepter_enemy_hp_regen_reduction_pct")
|
|
end
|
|
modifier_pudge_rot_slow_custom = __TS__Decorate(
|
|
modifier_pudge_rot_slow_custom,
|
|
modifier_pudge_rot_slow_custom,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_pudge_rot_slow_custom"}
|
|
)
|
|
____exports.modifier_pudge_rot_slow_custom = modifier_pudge_rot_slow_custom
|
|
return ____exports
|