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 ____CardSystem = require("cards.CardSystem") local CardBase = ____CardSystem.CardBase local RegisterCard = ____CardSystem.RegisterCard local ____CardBaseModifier = require("cards.CardBaseModifier") local CardBaseModifier = ____CardBaseModifier.CardBaseModifier local ____dota_ts_adapter = require("lib.dota_ts_adapter") local registerModifier = ____dota_ts_adapter.registerModifier local ____modifier_card_56_homer = require("cards.modifier_card_56_homer") local CARD_56_HOMER_MODIFIER_NAME = ____modifier_card_56_homer.CARD_56_HOMER_MODIFIER_NAME local CARD_ID = 56 ____exports.card_56 = __TS__Class() local card_56 = ____exports.card_56 card_56.name = "card_56" card_56.____file_path = "scripts/vscripts/cards/examples/card_56.lua" __TS__ClassExtends(card_56, CardBase) function card_56.prototype.GetModifierName(self) return "modifier_card_56" end card_56 = __TS__Decorate(card_56, card_56, {RegisterCard}, {kind = "class", name = "card_56"}) ____exports.card_56 = card_56 ____exports.modifier_card_56 = __TS__Class() local modifier_card_56 = ____exports.modifier_card_56 modifier_card_56.name = "modifier_card_56" modifier_card_56.____file_path = "scripts/vscripts/cards/examples/card_56.lua" __TS__ClassExtends(modifier_card_56, CardBaseModifier) function modifier_card_56.prototype.OnCustomCreated(self, params) if not IsServer() then return end local applied = self:applyToHomer() if not applied then self:StartIntervalThink(1) end end function modifier_card_56.prototype.OnIntervalThink(self) if not IsServer() then return end local applied = self:applyToHomer() if applied then self:StartIntervalThink(-1) end end function modifier_card_56.prototype.OnDestroy(self) if not IsServer() then return end if self.homerReflectMod and not self.homerReflectMod:IsNull() then self.homerReflectMod:Destroy() end self.homerReflectMod = nil end function modifier_card_56.prototype.GetAttributes(self) return MODIFIER_ATTRIBUTE_MULTIPLE end function modifier_card_56.prototype.findHomer(self) local byTargetName = Entities:FindByName(nil, "npc_homer") if byTargetName and IsValidEntity(byTargetName) and not byTargetName:IsNull() and byTargetName:GetUnitName() == "npc_homer" then return byTargetName end local units = FindUnitsInRadius( DOTA_TEAM_GOODGUYS, Vector(0, 0, 0), nil, 30000, DOTA_UNIT_TARGET_TEAM_BOTH, DOTA_UNIT_TARGET_BASIC + DOTA_UNIT_TARGET_HERO, DOTA_UNIT_TARGET_FLAG_INVULNERABLE, FIND_ANY_ORDER, false ) for ____, unit in ipairs(units) do if unit and IsValidEntity(unit) and not unit:IsNull() and unit:GetUnitName() == "npc_homer" then return unit end end return nil end function modifier_card_56.prototype.applyToHomer(self) local owner = self:GetParent() if not owner or not IsValidEntity(owner) then return false end if self.homerReflectMod and not self.homerReflectMod:IsNull() then return true end local homer = self:findHomer() if not homer then return false end local reflectPct = math.max( 0, self:getScaledCardValue("creep_reflect_pct", 15, CARD_ID) ) self.homerReflectMod = homer:AddNewModifier( owner, getModifierSourceAbility(nil, owner), CARD_56_HOMER_MODIFIER_NAME, {reflect_pct = reflectPct} ) return self.homerReflectMod ~= nil and not self.homerReflectMod:IsNull() end modifier_card_56 = __TS__Decorate( modifier_card_56, modifier_card_56, {registerModifier(nil)}, {kind = "class", name = "modifier_card_56"} ) ____exports.modifier_card_56 = modifier_card_56 return ____exports