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

138 lines
5.5 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.weaking_impetus = __TS__Class()
local weaking_impetus = ____exports.weaking_impetus
weaking_impetus.name = "weaking_impetus"
weaking_impetus.____file_path = "scripts/vscripts/abilities/creep/weaking_impetus.lua"
__TS__ClassExtends(weaking_impetus, BaseAbility)
function weaking_impetus.prototype.GetIntrinsicModifierName(self)
return "modifier_weaking_impetus_passive"
end
weaking_impetus = __TS__Decorate(
weaking_impetus,
weaking_impetus,
{registerAbility(nil)},
{kind = "class", name = "weaking_impetus"}
)
____exports.weaking_impetus = weaking_impetus
____exports.modifier_weaking_impetus_passive = __TS__Class()
local modifier_weaking_impetus_passive = ____exports.modifier_weaking_impetus_passive
modifier_weaking_impetus_passive.name = "modifier_weaking_impetus_passive"
modifier_weaking_impetus_passive.____file_path = "scripts/vscripts/abilities/creep/weaking_impetus.lua"
__TS__ClassExtends(modifier_weaking_impetus_passive, BaseModifier)
function modifier_weaking_impetus_passive.prototype.IsHidden(self)
return true
end
function modifier_weaking_impetus_passive.prototype.IsDebuff(self)
return false
end
function modifier_weaking_impetus_passive.prototype.IsPurgable(self)
return false
end
function modifier_weaking_impetus_passive.prototype.GetStatusEffectName(self)
return "particles/status_fx/status_effect_abaddon_borrowed_time.vpcf"
end
function modifier_weaking_impetus_passive.prototype.GetEffectName(self)
return "particles/units/heroes/hero_abaddon/abaddon_borrowed_time.vpcf"
end
function modifier_weaking_impetus_passive.prototype.StatusEffectPriority(self)
return 10
end
function modifier_weaking_impetus_passive.prototype.DeclareFunctions(self)
return {MODIFIER_EVENT_ON_ATTACK_LANDED}
end
function modifier_weaking_impetus_passive.prototype.OnAttackLanded(self, event)
if not IsServer() then
return
end
if event.attacker ~= self:GetParent() then
return
end
local target = event.target
if not target then
return
end
local parent = self:GetParent()
local ability = self:GetAbility()
if parent:GetMana() < self:GetAbility():GetSpecialValueFor("mana_hit") then
return
end
parent:SpendMana(
self:GetAbility():GetSpecialValueFor("mana_hit"),
ability
)
local duration = ability:GetSpecialValueFor("debuff_duration")
local modifier = target:FindModifierByName("modifier_weaking_impetus_debuff")
if modifier then
modifier:SetDuration(duration, true)
if modifier:GetStackCount() < self:GetAbility():GetSpecialValueFor("max_stacks") then
modifier:IncrementStackCount()
end
else
modifier = target:AddNewModifier(
self:GetParent(),
ability,
"modifier_weaking_impetus_debuff",
{duration = duration}
)
modifier:SetStackCount(1)
end
end
modifier_weaking_impetus_passive = __TS__Decorate(
modifier_weaking_impetus_passive,
modifier_weaking_impetus_passive,
{registerModifier(nil)},
{kind = "class", name = "modifier_weaking_impetus_passive"}
)
____exports.modifier_weaking_impetus_passive = modifier_weaking_impetus_passive
____exports.modifier_weaking_impetus_debuff = __TS__Class()
local modifier_weaking_impetus_debuff = ____exports.modifier_weaking_impetus_debuff
modifier_weaking_impetus_debuff.name = "modifier_weaking_impetus_debuff"
modifier_weaking_impetus_debuff.____file_path = "scripts/vscripts/abilities/creep/weaking_impetus.lua"
__TS__ClassExtends(modifier_weaking_impetus_debuff, BaseModifier)
function modifier_weaking_impetus_debuff.prototype.____constructor(self, ...)
BaseModifier.prototype.____constructor(self, ...)
self.damage_reduction = 0
end
function modifier_weaking_impetus_debuff.prototype.IsHidden(self)
return false
end
function modifier_weaking_impetus_debuff.prototype.IsDebuff(self)
return true
end
function modifier_weaking_impetus_debuff.prototype.IsPurgable(self)
return true
end
function modifier_weaking_impetus_debuff.prototype.OnCreated(self)
local ability = self:GetAbility()
if not ability then
return
end
self.damage_reduction = ability:GetSpecialValueFor("damage_reduction")
end
function modifier_weaking_impetus_debuff.prototype.DeclareFunctions(self)
return {MODIFIER_PROPERTY_DAMAGEOUTGOING_PERCENTAGE, MODIFIER_PROPERTY_SPELL_AMPLIFY_PERCENTAGE}
end
function modifier_weaking_impetus_debuff.prototype.GetModifierDamageOutgoing_Percentage(self, event)
return -self.damage_reduction * self:GetStackCount()
end
function modifier_weaking_impetus_debuff.prototype.GetModifierSpellAmplify_Percentage(self, event)
return -self.damage_reduction * self:GetStackCount()
end
modifier_weaking_impetus_debuff = __TS__Decorate(
modifier_weaking_impetus_debuff,
modifier_weaking_impetus_debuff,
{registerModifier(nil)},
{kind = "class", name = "modifier_weaking_impetus_debuff"}
)
____exports.modifier_weaking_impetus_debuff = modifier_weaking_impetus_debuff
return ____exports