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_magical_divine_rapier = __TS__Class() local item_magical_divine_rapier = ____exports.item_magical_divine_rapier item_magical_divine_rapier.name = "item_magical_divine_rapier" item_magical_divine_rapier.____file_path = "scripts/vscripts/items/default_items/item_magical_divine_rapier.lua" __TS__ClassExtends(item_magical_divine_rapier, BaseItem) function item_magical_divine_rapier.prototype.GetIntrinsicModifierName(self) return "modifier_magical_divine_rapier" end item_magical_divine_rapier = __TS__Decorate( item_magical_divine_rapier, item_magical_divine_rapier, {registerAbility(nil)}, {kind = "class", name = "item_magical_divine_rapier"} ) ____exports.item_magical_divine_rapier = item_magical_divine_rapier ____exports.modifier_magical_divine_rapier = __TS__Class() local modifier_magical_divine_rapier = ____exports.modifier_magical_divine_rapier modifier_magical_divine_rapier.name = "modifier_magical_divine_rapier" modifier_magical_divine_rapier.____file_path = "scripts/vscripts/items/default_items/item_magical_divine_rapier.lua" __TS__ClassExtends(modifier_magical_divine_rapier, BaseModifier) function modifier_magical_divine_rapier.prototype.____constructor(self, ...) BaseModifier.prototype.____constructor(self, ...) self.Lock = false end function modifier_magical_divine_rapier.prototype.IsHidden(self) return true end function modifier_magical_divine_rapier.prototype.IsDebuff(self) return false end function modifier_magical_divine_rapier.prototype.IsPurgable(self) return false end function modifier_magical_divine_rapier.prototype.DeclareFunctions(self) return { MODIFIER_PROPERTY_SPELL_AMPLIFY_PERCENTAGE, MODIFIER_PROPERTY_STATS_INTELLECT_BONUS, MODIFIER_PROPERTY_STATS_STRENGTH_BONUS, MODIFIER_PROPERTY_STATS_AGILITY_BONUS, MODIFIER_PROPERTY_MANA_REGEN_CONSTANT, MODIFIER_PROPERTY_MANA_BONUS, MODIFIER_PROPERTY_FORCE_MAX_MANA, MODIFIER_EVENT_ON_TAKEDAMAGE } end function modifier_magical_divine_rapier.prototype.GetModifierBonusStats_Intellect(self) return self:GetAbility():GetSpecialValueFor("bonus_intellect") end function modifier_magical_divine_rapier.prototype.GetModifierSpellAmplify_Percentage(self, event) return self:GetAbility():GetSpecialValueFor("bonus_spell_amplify") end function modifier_magical_divine_rapier.prototype.GetModifierBonusStats_Strength(self) return self:GetAbility():GetSpecialValueFor("bonus_strength") end function modifier_magical_divine_rapier.prototype.GetModifierBonusStats_Agility(self) return self:GetAbility():GetSpecialValueFor("bonus_agility") end function modifier_magical_divine_rapier.prototype.GetModifierConstantManaRegen(self) return self:GetAbility():GetSpecialValueFor("bonus_mana_regen") end function modifier_magical_divine_rapier.prototype.GetModifierManaBonus(self) if not IsServer() then return 0 end if self.Lock then return 0 end self.Lock = true local mana = self:GetParent():GetMaxMana() self.Lock = false local bonus = self:GetAbility():GetSpecialValueFor("bonus_mana_pct") * mana / 100 return bonus end function modifier_magical_divine_rapier.prototype.OnTakeDamage(self, event) if not IsServer() then return end local caster = self:GetParent() local rapierAbility = self:GetAbility() if not caster:IsRealHero() or not rapierAbility then return end local target = event.unit if not target then return end if target:GetTeamNumber() == caster:GetTeamNumber() then return end if event.attacker ~= caster then return end if not event.inflictor then return end if event.inflictor == rapierAbility then return end if event.damage <= 0 then return end if event.damage <= 300 then return end local bonusDamage = caster:GetMana() * (rapierAbility:GetSpecialValueFor("damage_per_cast_hand") / 100) + rapierAbility:GetSpecialValueFor("damage_per_cast") local spellAmpFrac = math.max( 0, caster:GetSpellAmplification(false) ) local damageToApply = bonusDamage / math.max(0.000001, 1 + spellAmpFrac) SendOverheadEventMessage( nil, OVERHEAD_ALERT_BONUS_SPELL_DAMAGE, target, math.floor(bonusDamage), nil ) rapierAbility:UseResources(true, false, false, true) ApplyDamage({ victim = target, attacker = caster, damage = damageToApply, damage_type = DAMAGE_TYPE_MAGICAL, damage_flags = DOTA_DAMAGE_FLAG_NO_SPELL_AMPLIFICATION, ability = nil }) target:AddNewModifier( caster, rapierAbility, "modifier_magic_rapier_debuff", {duration = rapierAbility:GetSpecialValueFor("slow_duration")} ) local particle = ParticleManager:CreateParticle("particles/items_fx/phylactery_target.vpcf", PATTACH_ABSORIGIN_FOLLOW, target) ParticleManager:SetParticleControlEnt( particle, 0, target, PATTACH_POINT_FOLLOW, "attach_hitloc", target:GetAbsOrigin(), true ) ParticleManager:ReleaseParticleIndex(particle) local particle_2 = ParticleManager:CreateParticle("particles/items_fx/phylactery.vpcf", PATTACH_ABSORIGIN_FOLLOW, caster) ParticleManager:SetParticleControlEnt( particle_2, 0, caster, PATTACH_POINT_FOLLOW, "attach_hitloc", caster:GetAbsOrigin(), true ) ParticleManager:SetParticleControlEnt( particle_2, 1, target, PATTACH_POINT_FOLLOW, "attach_hitloc", target:GetAbsOrigin(), true ) ParticleManager:ReleaseParticleIndex(particle_2) target:EmitSound("Item.Phylactery.Target") end modifier_magical_divine_rapier = __TS__Decorate( modifier_magical_divine_rapier, modifier_magical_divine_rapier, {registerModifier(nil)}, {kind = "class", name = "modifier_magical_divine_rapier"} ) ____exports.modifier_magical_divine_rapier = modifier_magical_divine_rapier ____exports.modifier_magic_rapier_debuff = __TS__Class() local modifier_magic_rapier_debuff = ____exports.modifier_magic_rapier_debuff modifier_magic_rapier_debuff.name = "modifier_magic_rapier_debuff" modifier_magic_rapier_debuff.____file_path = "scripts/vscripts/items/default_items/item_magical_divine_rapier.lua" __TS__ClassExtends(modifier_magic_rapier_debuff, BaseModifier) function modifier_magic_rapier_debuff.prototype.IsHidden(self) return false end function modifier_magic_rapier_debuff.prototype.IsDebuff(self) return true end function modifier_magic_rapier_debuff.prototype.IsPurgable(self) return true end function modifier_magic_rapier_debuff.prototype.GetAttributes(self) return MODIFIER_ATTRIBUTE_MULTIPLE end function modifier_magic_rapier_debuff.prototype.DeclareFunctions(self) return {MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE, MODIFIER_PROPERTY_MAGICAL_RESISTANCE_BONUS} end function modifier_magic_rapier_debuff.prototype.CheckState(self) local state = {[MODIFIER_STATE_PASSIVES_DISABLED] = true} return state end function modifier_magic_rapier_debuff.prototype.GetModifierMoveSpeedBonus_Percentage(self) return -self:GetAbility():GetSpecialValueFor("slow_pct") end function modifier_magic_rapier_debuff.prototype.GetModifierMagicalResistanceBonus(self, event) return self:GetAbility():GetSpecialValueFor("magical_resist_reduction") end function modifier_magic_rapier_debuff.prototype.GetTexture(self) return "default_items/magicpier" end modifier_magic_rapier_debuff = __TS__Decorate( modifier_magic_rapier_debuff, modifier_magic_rapier_debuff, {registerModifier(nil)}, {kind = "class", name = "modifier_magic_rapier_debuff"} ) ____exports.modifier_magic_rapier_debuff = modifier_magic_rapier_debuff return ____exports