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

153 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 ____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
local ____vampirism = require("utils.vampirism")
local addPhysicalVampirism = ____vampirism.addPhysicalVampirism
local reducePhysicalVampirism = ____vampirism.reducePhysicalVampirism
local HOWL_PARTICLE = "particles/units/heroes/hero_lycan/lycan_shapeshift_buff.vpcf"
____exports.item_wolf_hat = __TS__Class()
local item_wolf_hat = ____exports.item_wolf_hat
item_wolf_hat.name = "item_wolf_hat"
item_wolf_hat.____file_path = "scripts/vscripts/items/quest_items/item_wolf_hat.lua"
__TS__ClassExtends(item_wolf_hat, BaseItem)
function item_wolf_hat.prototype.Precache(self, context)
PrecacheResource("particle", HOWL_PARTICLE, context)
PrecacheResource("soundfile", "soundevents/game_sounds_heroes/game_sounds_lycan.vsndevts", context)
end
function item_wolf_hat.prototype.GetIntrinsicModifierName(self)
return ____exports.modifier_item_wolf_hat_passive.name
end
function item_wolf_hat.prototype.OnSpellStart(self)
if not IsServer() then
return
end
local caster = self:GetCaster()
local duration = self:GetSpecialValueFor("howl_duration")
caster:EmitSound("Hero_Lycan.Howl")
caster:AddNewModifier(caster, self, ____exports.modifier_item_wolf_hat_howl.name, {duration = duration})
end
item_wolf_hat = __TS__Decorate(
item_wolf_hat,
item_wolf_hat,
{registerAbility(nil)},
{kind = "class", name = "item_wolf_hat"}
)
____exports.item_wolf_hat = item_wolf_hat
--- Шапка вожака: сила, скорость, вампиризм, добивание раненых.
____exports.modifier_item_wolf_hat_passive = __TS__Class()
local modifier_item_wolf_hat_passive = ____exports.modifier_item_wolf_hat_passive
modifier_item_wolf_hat_passive.name = "modifier_item_wolf_hat_passive"
modifier_item_wolf_hat_passive.____file_path = "scripts/vscripts/items/quest_items/item_wolf_hat.lua"
__TS__ClassExtends(modifier_item_wolf_hat_passive, BaseModifier)
function modifier_item_wolf_hat_passive.prototype.IsHidden(self)
return true
end
function modifier_item_wolf_hat_passive.prototype.IsPurgable(self)
return false
end
function modifier_item_wolf_hat_passive.prototype.OnCreated(self)
if not IsServer() then
return
end
local hero = self:GetParent()
local lifesteal = self:GetAbility():GetSpecialValueFor("lifesteal_pct")
if lifesteal > 0 then
addPhysicalVampirism(nil, hero, lifesteal)
end
end
function modifier_item_wolf_hat_passive.prototype.OnDestroy(self)
if not IsServer() then
return
end
local hero = self:GetParent()
local lifesteal = self:GetAbility():GetSpecialValueFor("lifesteal_pct")
if lifesteal > 0 then
reducePhysicalVampirism(nil, hero, lifesteal)
end
end
function modifier_item_wolf_hat_passive.prototype.DeclareFunctions(self)
return {MODIFIER_PROPERTY_STATS_STRENGTH_BONUS, MODIFIER_PROPERTY_MOVESPEED_BONUS_CONSTANT, MODIFIER_PROPERTY_DAMAGEOUTGOING_PERCENTAGE}
end
function modifier_item_wolf_hat_passive.prototype.GetModifierBonusStats_Strength(self)
return self:GetAbility():GetSpecialValueFor("bonus_strength")
end
function modifier_item_wolf_hat_passive.prototype.GetModifierMoveSpeedBonus_Constant(self)
return self:GetAbility():GetSpecialValueFor("bonus_move_speed")
end
function modifier_item_wolf_hat_passive.prototype.GetModifierDamageOutgoing_Percentage(self, event)
local target = event and event.target
if not target or target:IsNull() or not target:IsAlive() then
return 0
end
if target:GetHealthPercent() > self:GetAbility():GetSpecialValueFor("low_hp_threshold") then
return 0
end
return self:GetAbility():GetSpecialValueFor("low_hp_damage_bonus")
end
modifier_item_wolf_hat_passive = __TS__Decorate(
modifier_item_wolf_hat_passive,
modifier_item_wolf_hat_passive,
{registerModifier(nil)},
{kind = "class", name = "modifier_item_wolf_hat_passive"}
)
____exports.modifier_item_wolf_hat_passive = modifier_item_wolf_hat_passive
--- Активное: вой стаи — скорость атаки и бег.
____exports.modifier_item_wolf_hat_howl = __TS__Class()
local modifier_item_wolf_hat_howl = ____exports.modifier_item_wolf_hat_howl
modifier_item_wolf_hat_howl.name = "modifier_item_wolf_hat_howl"
modifier_item_wolf_hat_howl.____file_path = "scripts/vscripts/items/quest_items/item_wolf_hat.lua"
__TS__ClassExtends(modifier_item_wolf_hat_howl, BaseModifier)
function modifier_item_wolf_hat_howl.prototype.IsHidden(self)
return false
end
function modifier_item_wolf_hat_howl.prototype.IsPurgable(self)
return true
end
function modifier_item_wolf_hat_howl.prototype.OnCreated(self)
if not IsServer() then
return
end
self.particleId = ParticleManager:CreateParticle(
HOWL_PARTICLE,
PATTACH_ABSORIGIN_FOLLOW,
self:GetParent()
)
end
function modifier_item_wolf_hat_howl.prototype.OnDestroy(self)
if not IsServer() then
return
end
if self.particleId ~= nil then
ParticleManager:DestroyParticle(self.particleId, false)
ParticleManager:ReleaseParticleIndex(self.particleId)
self.particleId = nil
end
end
function modifier_item_wolf_hat_howl.prototype.DeclareFunctions(self)
return {MODIFIER_PROPERTY_ATTACKSPEED_BONUS_CONSTANT, MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE}
end
function modifier_item_wolf_hat_howl.prototype.GetModifierAttackSpeedBonus_Constant(self)
return self:GetAbility():GetSpecialValueFor("howl_attack_speed")
end
function modifier_item_wolf_hat_howl.prototype.GetModifierMoveSpeedBonus_Percentage(self)
return self:GetAbility():GetSpecialValueFor("howl_move_speed_pct")
end
function modifier_item_wolf_hat_howl.prototype.GetTexture(self)
return "quest_items/wolf_claw"
end
modifier_item_wolf_hat_howl = __TS__Decorate(
modifier_item_wolf_hat_howl,
modifier_item_wolf_hat_howl,
{registerModifier(nil)},
{kind = "class", name = "modifier_item_wolf_hat_howl"}
)
____exports.modifier_item_wolf_hat_howl = modifier_item_wolf_hat_howl
return ____exports