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 local ____item_shameful_pipe = require("items.quest_items.item_shameful_pipe") local modifier_item_shameful_pipe = ____item_shameful_pipe.modifier_item_shameful_pipe local ____luck = require("utils.luck") local rollLuckChance = ____luck.rollLuckChance ____exports.bone_armor = __TS__Class() local bone_armor = ____exports.bone_armor bone_armor.name = "bone_armor" bone_armor.____file_path = "scripts/vscripts/abilities/creep/bone_armor.lua" __TS__ClassExtends(bone_armor, BaseAbility) function bone_armor.prototype.Precache(self, context) PrecacheResource("particle", "particles/econ/items/centaur/centaur_crownfall_belt/centaur_crownfall_belt_retaliate.vpcf", context) end function bone_armor.prototype.GetIntrinsicModifierName(self) return "modifier_bone_armor_passive" end bone_armor = __TS__Decorate( bone_armor, bone_armor, {registerAbility(nil)}, {kind = "class", name = "bone_armor"} ) ____exports.bone_armor = bone_armor ____exports.modifier_bone_armor_passive = __TS__Class() local modifier_bone_armor_passive = ____exports.modifier_bone_armor_passive modifier_bone_armor_passive.name = "modifier_bone_armor_passive" modifier_bone_armor_passive.____file_path = "scripts/vscripts/abilities/creep/bone_armor.lua" __TS__ClassExtends(modifier_bone_armor_passive, BaseModifier) function modifier_bone_armor_passive.prototype.IsHidden(self) return true end function modifier_bone_armor_passive.prototype.IsDebuff(self) return false end function modifier_bone_armor_passive.prototype.IsPurgable(self) return false end function modifier_bone_armor_passive.prototype.DeclareFunctions(self) return {MODIFIER_PROPERTY_PHYSICAL_ARMOR_BONUS, MODIFIER_EVENT_ON_ATTACK_LANDED} end function modifier_bone_armor_passive.prototype.GetModifierPhysicalArmorBonus(self) local ____opt_0 = self:GetAbility() return ____opt_0 and ____opt_0:GetSpecialValueFor("armor_bonus") or 0 end function modifier_bone_armor_passive.prototype.playRetaliateParticle(self) ParticleManager:CreateParticle( "particles/econ/items/centaur/centaur_crownfall_belt/centaur_crownfall_belt_retaliate.vpcf", PATTACH_ABSORIGIN_FOLLOW, self:GetParent() ) end function modifier_bone_armor_passive.prototype.hasHeroNearCreep(self, creep, radius) local heroes = FindUnitsInRadius( creep:GetTeamNumber(), creep:GetAbsOrigin(), nil, radius, DOTA_UNIT_TARGET_TEAM_ENEMY, DOTA_UNIT_TARGET_HERO, DOTA_UNIT_TARGET_FLAG_NONE, FIND_ANY_ORDER, false ) for ____, hero in ipairs(heroes) do if hero and IsValidEntity(hero) and hero:IsAlive() and hero:IsRealHero() then return true end end return false end function modifier_bone_armor_passive.prototype.applyReflectedDamage(self, attacker, parent, ability, eventDamage) local reflectChance = ability:GetSpecialValueFor("damage_reflect_chance") if not rollLuckChance(nil, attacker, reflectChance / 100) then return end local reflectPct = ability:GetSpecialValueFor("damage_reflect_pct") local reflectDamage = eventDamage * (reflectPct / 100) if reflectDamage <= 0 then return end ApplyDamage({ victim = attacker, attacker = parent, damage = reflectDamage, damage_type = DAMAGE_TYPE_PHYSICAL, ability = ability }) self:playRetaliateParticle() end function modifier_bone_armor_passive.prototype.OnAttackLanded(self, event) if not IsServer() then return end if event.target ~= self:GetParent() then return end local attacker = event.attacker if not attacker or not IsValidEntity(attacker) or not attacker:IsAlive() then return end if not attacker:IsHero() or not attacker:IsRealHero() then return end if not attacker:IsRangedAttacker() then return end if attacker:HasModifier(modifier_item_shameful_pipe.name) then return end local ability = self:GetAbility() if not ability then return end local parent = self:GetParent() local heroProximityRadius = ability:GetSpecialValueFor("hero_proximity_radius") local heroNearCreep = self:hasHeroNearCreep(parent, heroProximityRadius) if not heroNearCreep then local isolatedMultiplier = ability:GetSpecialValueFor("isolated_damage_multiplier") local damage = event.damage * isolatedMultiplier if damage > 0 then ApplyDamage({ victim = attacker, attacker = parent, damage = damage, damage_type = DAMAGE_TYPE_PHYSICAL, ability = ability }) self:playRetaliateParticle() end return end self:applyReflectedDamage(attacker, parent, ability, event.damage) end modifier_bone_armor_passive = __TS__Decorate( modifier_bone_armor_passive, modifier_bone_armor_passive, {registerModifier(nil)}, {kind = "class", name = "modifier_bone_armor_passive"} ) ____exports.modifier_bone_armor_passive = modifier_bone_armor_passive return ____exports