local ____lualib = require("lualib_bundle") local __TS__Class = ____lualib.__TS__Class local __TS__ClassExtends = ____lualib.__TS__ClassExtends local __TS__Decorate = ____lualib.__TS__Decorate local __TS__StringStartsWith = ____lualib.__TS__StringStartsWith 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 ____incoming_damage_reduction_combine = require("utils.incoming_damage_reduction_combine") local removeIncomingDamageReductionSource = ____incoming_damage_reduction_combine.removeIncomingDamageReductionSource local setIncomingDamageReductionSource = ____incoming_damage_reduction_combine.setIncomingDamageReductionSource local DEMON_SLAYER_OWNER_INCOMING_SOURCE = "modifier_item_demon_slayer" --- Demon Slayer: пассивы Zombie Slayer + статы/эффект Mage Slayer (маг. сопр., регены, DoT + штраф spell amp на цели), -- плюс снижение входящего и бонус ко всему исходящему урону у носителя. ____exports.item_demon_slayer = __TS__Class() local item_demon_slayer = ____exports.item_demon_slayer item_demon_slayer.name = "item_demon_slayer" item_demon_slayer.____file_path = "scripts/vscripts/items/default_items/item_demon_slayer.lua" __TS__ClassExtends(item_demon_slayer, BaseItem) function item_demon_slayer.prototype.Precache(self, context) PrecacheResource("particle", "particles/demon_slayer_slash.vpcf", context) PrecacheResource("particle", "particles/items2_fx/mage_slayer_debuff.vpcf", context) PrecacheResource("particle", "particles/units/heroes/hero_dark_willow/dark_willow_wisp_spell_debuff.vpcf", context) end function item_demon_slayer.prototype.GetIntrinsicModifierName(self) return "modifier_item_demon_slayer" end item_demon_slayer = __TS__Decorate( item_demon_slayer, item_demon_slayer, {registerAbility(nil)}, {kind = "class", name = "item_demon_slayer"} ) ____exports.item_demon_slayer = item_demon_slayer ____exports.modifier_item_demon_slayer = __TS__Class() local modifier_item_demon_slayer = ____exports.modifier_item_demon_slayer modifier_item_demon_slayer.name = "modifier_item_demon_slayer" modifier_item_demon_slayer.____file_path = "scripts/vscripts/items/default_items/item_demon_slayer.lua" __TS__ClassExtends(modifier_item_demon_slayer, BaseModifier) function modifier_item_demon_slayer.prototype.IsHidden(self) return true end function modifier_item_demon_slayer.prototype.IsPurgable(self) return false end function modifier_item_demon_slayer.prototype.DeclareFunctions(self) return { MODIFIER_PROPERTY_PREATTACK_BONUS_DAMAGE, MODIFIER_PROPERTY_STATS_AGILITY_BONUS, MODIFIER_PROPERTY_MANA_REGEN_CONSTANT, MODIFIER_PROPERTY_HEALTH_BONUS, MODIFIER_PROPERTY_HEALTH_REGEN_CONSTANT, MODIFIER_PROPERTY_MAGICAL_RESISTANCE_BONUS, MODIFIER_EVENT_ON_ATTACK_LANDED, MODIFIER_PROPERTY_DAMAGEOUTGOING_PERCENTAGE } end function modifier_item_demon_slayer.prototype.OnCreated(self) if not IsServer() then return end setIncomingDamageReductionSource( nil, self:GetParent(), DEMON_SLAYER_OWNER_INCOMING_SOURCE, function() local ability = self:GetAbility() if not ability then return 0 end return math.max( 0, math.abs(ability:GetSpecialValueFor("incoming_damage_reduction")) ) end ) end function modifier_item_demon_slayer.prototype.OnDestroy(self) if not IsServer() then return end removeIncomingDamageReductionSource( nil, self:GetParent(), DEMON_SLAYER_OWNER_INCOMING_SOURCE ) end function modifier_item_demon_slayer.prototype.GetModifierHealthBonus(self) return self:GetAbility():GetSpecialValueFor("bonus_health") end function modifier_item_demon_slayer.prototype.GetModifierConstantManaRegen(self) return self:GetAbility():GetSpecialValueFor("bonus_mana_regen") end function modifier_item_demon_slayer.prototype.GetModifierConstantHealthRegen(self) return self:GetAbility():GetSpecialValueFor("bonus_health_regen") end function modifier_item_demon_slayer.prototype.GetModifierMagicalResistanceBonus(self) return self:GetAbility():GetSpecialValueFor("bonus_magic_resistance") end function modifier_item_demon_slayer.prototype.GetModifierPreAttack_BonusDamage(self) return self:GetAbility():GetSpecialValueFor("bonus_damage") end function modifier_item_demon_slayer.prototype.GetModifierBonusStats_Agility(self) return self:GetAbility():GetSpecialValueFor("bonus_agility") end function modifier_item_demon_slayer.prototype.GetModifierDamageOutgoing_Percentage(self) return self:GetAbility():GetSpecialValueFor("outgoing_damage_bonus") end function modifier_item_demon_slayer.prototype.OnAttackLanded(self, event) if not IsServer() then return end if event.attacker ~= self:GetParent() then return end if not event.target or event.target:IsBuilding() or event.target:IsOther() then return end if event.target ~= nil then local ability = self:GetAbility() local durCorrosion = ability and ability:GetSpecialValueFor("debuff_duration") or 4 local durMage = ability and ability:GetSpecialValueFor("duration") or 3 event.target:AddNewModifier( self:GetParent(), ability, "modifier_item_demon_slayer_debuff_2", {duration = durCorrosion} ) event.target:AddNewModifier( self:GetParent(), ability, "modifier_item_demon_slayer_mage", {duration = durMage} ) local ____this_5 ____this_5 = event.target local ____opt_4 = ____this_5.GetUnitName local targetName = ____opt_4 and ____opt_4(____this_5) or "" if __TS__StringStartsWith(targetName, "npc_wave") then ParticleManager:CreateParticle("particles/demon_slayer_slash.vpcf", PATTACH_ABSORIGIN_FOLLOW, event.target) event.target:AddNewModifier( self:GetParent(), ability, "modifier_item_demon_slayer_debuff", {duration = durCorrosion} ) return end end end modifier_item_demon_slayer = __TS__Decorate( modifier_item_demon_slayer, modifier_item_demon_slayer, {registerModifier(nil)}, {kind = "class", name = "modifier_item_demon_slayer"} ) ____exports.modifier_item_demon_slayer = modifier_item_demon_slayer --- Доп. урон по нежити волн (как Zombie Slayer). ____exports.modifier_item_demon_slayer_debuff = __TS__Class() local modifier_item_demon_slayer_debuff = ____exports.modifier_item_demon_slayer_debuff modifier_item_demon_slayer_debuff.name = "modifier_item_demon_slayer_debuff" modifier_item_demon_slayer_debuff.____file_path = "scripts/vscripts/items/default_items/item_demon_slayer.lua" __TS__ClassExtends(modifier_item_demon_slayer_debuff, BaseModifier) function modifier_item_demon_slayer_debuff.prototype.IsDebuff(self) return true end function modifier_item_demon_slayer_debuff.prototype.IsPurgable(self) return true end function modifier_item_demon_slayer_debuff.prototype.IsHidden(self) return true end function modifier_item_demon_slayer_debuff.prototype.GetEffectName(self) return "particles/items2_fx/mage_slayer_debuff.vpcf" end function modifier_item_demon_slayer_debuff.prototype.GetEffectAttachType(self) return PATTACH_ABSORIGIN_FOLLOW end function modifier_item_demon_slayer_debuff.prototype.DeclareFunctions(self) return {MODIFIER_PROPERTY_INCOMING_DAMAGE_PERCENTAGE} end function modifier_item_demon_slayer_debuff.prototype.GetModifierIncomingDamage_Percentage(self, event) return self:GetAbility():GetSpecialValueFor("incress_damage") end modifier_item_demon_slayer_debuff = __TS__Decorate( modifier_item_demon_slayer_debuff, modifier_item_demon_slayer_debuff, {registerModifier(nil)}, {kind = "class", name = "modifier_item_demon_slayer_debuff"} ) ____exports.modifier_item_demon_slayer_debuff = modifier_item_demon_slayer_debuff --- Коррозия (броня / хил / скорость), без дублирования штрафа spell amp — его даёт Mage Slayer-дебафф. ____exports.modifier_item_demon_slayer_debuff_2 = __TS__Class() local modifier_item_demon_slayer_debuff_2 = ____exports.modifier_item_demon_slayer_debuff_2 modifier_item_demon_slayer_debuff_2.name = "modifier_item_demon_slayer_debuff_2" modifier_item_demon_slayer_debuff_2.____file_path = "scripts/vscripts/items/default_items/item_demon_slayer.lua" __TS__ClassExtends(modifier_item_demon_slayer_debuff_2, BaseModifier) function modifier_item_demon_slayer_debuff_2.prototype.IsDebuff(self) return true end function modifier_item_demon_slayer_debuff_2.prototype.IsPurgable(self) return true end function modifier_item_demon_slayer_debuff_2.prototype.IsHidden(self) return true end function modifier_item_demon_slayer_debuff_2.prototype.GetEffectName(self) return "particles/units/heroes/hero_dark_willow/dark_willow_wisp_spell_debuff.vpcf" end function modifier_item_demon_slayer_debuff_2.prototype.GetEffectAttachType(self) return PATTACH_OVERHEAD_FOLLOW end function modifier_item_demon_slayer_debuff_2.prototype.DeclareFunctions(self) return {MODIFIER_PROPERTY_PHYSICAL_ARMOR_BONUS, MODIFIER_PROPERTY_HEALTH_REGEN_PERCENTAGE, MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE} end function modifier_item_demon_slayer_debuff_2.prototype.GetModifierMoveSpeedBonus_Percentage(self) return self:GetAbility():GetSpecialValueFor("movespeed_reduction") end function modifier_item_demon_slayer_debuff_2.prototype.GetModifierHealthRegenPercentage(self) return 1 + (self:GetAbility():GetSpecialValueFor("health_reduction") - 100) * 0.01 end function modifier_item_demon_slayer_debuff_2.prototype.GetModifierPhysicalArmorBonus(self, event) return self:GetAbility():GetSpecialValueFor("armor_reduction") end modifier_item_demon_slayer_debuff_2 = __TS__Decorate( modifier_item_demon_slayer_debuff_2, modifier_item_demon_slayer_debuff_2, {registerModifier(nil)}, {kind = "class", name = "modifier_item_demon_slayer_debuff_2"} ) ____exports.modifier_item_demon_slayer_debuff_2 = modifier_item_demon_slayer_debuff_2 --- Эффект как у Mage Slayer: −spell amp и магический DoT раз в секунду. ____exports.modifier_item_demon_slayer_mage = __TS__Class() local modifier_item_demon_slayer_mage = ____exports.modifier_item_demon_slayer_mage modifier_item_demon_slayer_mage.name = "modifier_item_demon_slayer_mage" modifier_item_demon_slayer_mage.____file_path = "scripts/vscripts/items/default_items/item_demon_slayer.lua" __TS__ClassExtends(modifier_item_demon_slayer_mage, BaseModifier) function modifier_item_demon_slayer_mage.prototype.IsDebuff(self) return true end function modifier_item_demon_slayer_mage.prototype.IsPurgable(self) return true end function modifier_item_demon_slayer_mage.prototype.IsHidden(self) return true end function modifier_item_demon_slayer_mage.prototype.GetEffectName(self) return "particles/items2_fx/mage_slayer_debuff.vpcf" end function modifier_item_demon_slayer_mage.prototype.GetEffectAttachType(self) return PATTACH_ABSORIGIN_FOLLOW end function modifier_item_demon_slayer_mage.prototype.DeclareFunctions(self) return {MODIFIER_PROPERTY_SPELL_AMPLIFY_PERCENTAGE} end function modifier_item_demon_slayer_mage.prototype.GetModifierSpellAmplify_Percentage(self) return -math.abs(self:GetAbility():GetSpecialValueFor("spell_amp_debuff")) end function modifier_item_demon_slayer_mage.prototype.OnCreated(self) if not IsServer() then return end self:PulseDps() self:StartIntervalThink(1) end function modifier_item_demon_slayer_mage.prototype.OnIntervalThink(self) if not IsServer() then return end self:PulseDps() end function modifier_item_demon_slayer_mage.prototype.PulseDps(self) local parent = self:GetParent() local ability = self:GetAbility() local caster = self:GetCaster() if not ability or not caster or not (parent and parent:IsAlive()) then return end local d = ability:GetSpecialValueFor("dps") ApplyDamage({ victim = parent, attacker = caster, damage = d, damage_type = DAMAGE_TYPE_MAGICAL, ability = ability, damage_flags = DOTA_DAMAGE_FLAG_NO_SPELL_AMPLIFICATION }) end modifier_item_demon_slayer_mage = __TS__Decorate( modifier_item_demon_slayer_mage, modifier_item_demon_slayer_mage, {registerModifier(nil)}, {kind = "class", name = "modifier_item_demon_slayer_mage"} ) ____exports.modifier_item_demon_slayer_mage = modifier_item_demon_slayer_mage return ____exports