Files
Dota-Zombie-Invasion/scripts/vscripts/items/quest_items/kunkka_sword.lua
T
2026-05-29 15:11:31 +07:00

176 lines
6.8 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 BaseItem = ____dota_ts_adapter.BaseItem
local BaseModifier = ____dota_ts_adapter.BaseModifier
local registerAbility = ____dota_ts_adapter.registerAbility
local registerModifier = ____dota_ts_adapter.registerModifier
____exports.item_kunkka_sword = __TS__Class()
local item_kunkka_sword = ____exports.item_kunkka_sword
item_kunkka_sword.name = "item_kunkka_sword"
item_kunkka_sword.____file_path = "scripts/vscripts/items/quest_items/kunkka_sword.lua"
__TS__ClassExtends(item_kunkka_sword, BaseItem)
function item_kunkka_sword.prototype.GetIntrinsicModifierName(self)
return "modifier_item_kunkka_sword_passive"
end
function item_kunkka_sword.prototype.OnSpellStart(self)
local caster = self:GetCaster()
caster:AddNewModifier(
caster,
self,
"modifier_item_kunkka_sword_active",
{duration = self:GetSpecialValueFor("duration")}
)
end
item_kunkka_sword = __TS__Decorate(
item_kunkka_sword,
item_kunkka_sword,
{registerAbility(nil)},
{kind = "class", name = "item_kunkka_sword"}
)
____exports.item_kunkka_sword = item_kunkka_sword
____exports.modifier_item_kunkka_sword_passive = __TS__Class()
local modifier_item_kunkka_sword_passive = ____exports.modifier_item_kunkka_sword_passive
modifier_item_kunkka_sword_passive.name = "modifier_item_kunkka_sword_passive"
modifier_item_kunkka_sword_passive.____file_path = "scripts/vscripts/items/quest_items/kunkka_sword.lua"
__TS__ClassExtends(modifier_item_kunkka_sword_passive, BaseModifier)
function modifier_item_kunkka_sword_passive.prototype.IsHidden(self)
return true
end
function modifier_item_kunkka_sword_passive.prototype.IsDebuff(self)
return false
end
function modifier_item_kunkka_sword_passive.prototype.IsPurgable(self)
return false
end
function modifier_item_kunkka_sword_passive.prototype.DeclareFunctions(self)
return {MODIFIER_PROPERTY_PREATTACK_BONUS_DAMAGE, MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE}
end
function modifier_item_kunkka_sword_passive.prototype.GetModifierMoveSpeedBonus_Percentage(self)
return -self:GetAbility():GetSpecialValueFor("move_speed_bonus")
end
function modifier_item_kunkka_sword_passive.prototype.GetModifierPreAttack_BonusDamage(self)
return self:GetAbility():GetSpecialValueFor("bonus_damage")
end
modifier_item_kunkka_sword_passive = __TS__Decorate(
modifier_item_kunkka_sword_passive,
modifier_item_kunkka_sword_passive,
{registerModifier(nil)},
{kind = "class", name = "modifier_item_kunkka_sword_passive"}
)
____exports.modifier_item_kunkka_sword_passive = modifier_item_kunkka_sword_passive
____exports.modifier_item_kunkka_sword_active = __TS__Class()
local modifier_item_kunkka_sword_active = ____exports.modifier_item_kunkka_sword_active
modifier_item_kunkka_sword_active.name = "modifier_item_kunkka_sword_active"
modifier_item_kunkka_sword_active.____file_path = "scripts/vscripts/items/quest_items/kunkka_sword.lua"
__TS__ClassExtends(modifier_item_kunkka_sword_active, BaseModifier)
function modifier_item_kunkka_sword_active.prototype.IsHidden(self)
return false
end
function modifier_item_kunkka_sword_active.prototype.IsDebuff(self)
return false
end
function modifier_item_kunkka_sword_active.prototype.IsPurgable(self)
return true
end
function modifier_item_kunkka_sword_active.prototype.GetAttributes(self)
return MODIFIER_ATTRIBUTE_MULTIPLE
end
function modifier_item_kunkka_sword_active.prototype.DeclareFunctions(self)
return {MODIFIER_EVENT_ON_ATTACK_LANDED}
end
function modifier_item_kunkka_sword_active.prototype.OnAttackLanded(self, event)
if not IsServer() then
return
end
if self:GetParent() ~= event.attacker then
return
end
self:DecrementStackCount()
local target = event.target
if target ~= nil then
local particle = ParticleManager:CreateParticle("particles/units/heroes/hero_morphling/morphling_adaptive_strike.vpcf", PATTACH_ABSORIGIN, target)
ParticleManager:SetParticleControl(
particle,
1,
target:GetAbsOrigin()
)
ParticleManager:SetParticleControl(
particle,
3,
target:GetAbsOrigin()
)
ParticleManager:SetParticleControl(
particle,
5,
target:GetAbsOrigin()
)
ParticleManager:ReleaseParticleIndex(particle)
end
if self:GetStackCount() == 0 then
self:Destroy()
end
end
function modifier_item_kunkka_sword_active.prototype.GetEffectName(self)
return "particles/units/heroes/hero_brewmaster/brewmaster_drunken_haze_debuff.vpcf"
end
function modifier_item_kunkka_sword_active.prototype.GetEffectAttachType(self)
return PATTACH_ABSORIGIN_FOLLOW
end
function modifier_item_kunkka_sword_active.prototype.OnCreated(self)
if not IsServer() then
return
end
local ____self_SetStackCount_2 = self.SetStackCount
local ____opt_0 = self:GetAbility()
____self_SetStackCount_2(
self,
____opt_0 and ____opt_0:GetSpecialValueFor("attack_count") or 0
)
local stackingCritMod = self:GetParent():FindModifierByName("modifier_stacking_crit")
if stackingCritMod then
local ability = self:GetAbility()
local ____self_8 = stackingCritMod
local ____self_8_AddCustomCrit_9 = ____self_8.AddCustomCrit
local ____opt_3 = self:GetAbility()
local ____temp_7 = ____opt_3 and ____opt_3:GetSpecialValueFor("crit_chance") or 0
local ____opt_5 = self:GetAbility()
____self_8_AddCustomCrit_9(
____self_8,
____temp_7,
____opt_5 and ____opt_5:GetSpecialValueFor("crit_mult") or 0,
"item_kunkka_sword",
ability
)
end
end
function modifier_item_kunkka_sword_active.prototype.OnDestroy(self)
if IsClient() then
return
end
local parent = self:GetParent()
if not parent or not IsValidEntity(parent) then
return
end
local stackingCritModifier = parent:FindModifierByName("modifier_stacking_crit")
if not stackingCritModifier then
return
end
local ability = self:GetAbility()
stackingCritModifier:RemoveCrit("item_kunkka_sword", ability)
end
function modifier_item_kunkka_sword_active.prototype.GetTexture(self)
return "default_items/kunkka_sword"
end
modifier_item_kunkka_sword_active = __TS__Decorate(
modifier_item_kunkka_sword_active,
modifier_item_kunkka_sword_active,
{registerModifier(nil)},
{kind = "class", name = "modifier_item_kunkka_sword_active"}
)
____exports.modifier_item_kunkka_sword_active = modifier_item_kunkka_sword_active
return ____exports