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 ____luck = require("utils.luck") local rollLuckChance = ____luck.rollLuckChance --- Бедный щит: броня и шанс заблокировать физический урон от атак; шанс для героев с Luck. ____exports.item_poor_shield = __TS__Class() local item_poor_shield = ____exports.item_poor_shield item_poor_shield.name = "item_poor_shield" item_poor_shield.____file_path = "scripts/vscripts/items/default_items/item_poor_shield.lua" __TS__ClassExtends(item_poor_shield, BaseItem) function item_poor_shield.prototype.GetIntrinsicModifierName(self) return ____exports.modifier_item_poor_shield.name end item_poor_shield = __TS__Decorate( item_poor_shield, item_poor_shield, {registerAbility(nil)}, {kind = "class", name = "item_poor_shield"} ) ____exports.item_poor_shield = item_poor_shield ____exports.modifier_item_poor_shield = __TS__Class() local modifier_item_poor_shield = ____exports.modifier_item_poor_shield modifier_item_poor_shield.name = "modifier_item_poor_shield" modifier_item_poor_shield.____file_path = "scripts/vscripts/items/default_items/item_poor_shield.lua" __TS__ClassExtends(modifier_item_poor_shield, BaseModifier) function modifier_item_poor_shield.prototype.IsHidden(self) return true end function modifier_item_poor_shield.prototype.IsPurgable(self) return false end function modifier_item_poor_shield.prototype.DeclareFunctions(self) return {MODIFIER_PROPERTY_PHYSICAL_CONSTANT_BLOCK, MODIFIER_PROPERTY_PHYSICAL_ARMOR_BONUS} end function modifier_item_poor_shield.prototype.GetModifierPhysicalArmorBonus(self) return self:GetAbility():GetSpecialValueFor("bonus_physical_armor") end function modifier_item_poor_shield.prototype.GetModifierPhysical_ConstantBlock(self) if not IsServer() then return 0 end local ability = self:GetAbility() if not ability then return 0 end local chancePct = ability:GetSpecialValueFor("damage_block_chance") local parent = self:GetParent() local ____parent_IsRealHero_result_0 if parent:IsRealHero() then ____parent_IsRealHero_result_0 = rollLuckChance(nil, parent, chancePct / 100) else ____parent_IsRealHero_result_0 = RollPercentage(chancePct) end local blocked = ____parent_IsRealHero_result_0 if blocked then return self:GetCaster():IsRangedAttacker() and ability:GetSpecialValueFor("damage_block") * 0.5 or ability:GetSpecialValueFor("damage_block") end return 0 end modifier_item_poor_shield = __TS__Decorate( modifier_item_poor_shield, modifier_item_poor_shield, {registerModifier(nil)}, {kind = "class", name = "modifier_item_poor_shield"} ) ____exports.modifier_item_poor_shield = modifier_item_poor_shield return ____exports