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 CARD_ID = 55 ____exports.card_55 = __TS__Class() local card_55 = ____exports.card_55 card_55.name = "card_55" card_55.____file_path = "scripts/vscripts/cards/examples/card_55.lua" __TS__ClassExtends(card_55, CardBase) function card_55.prototype.GetModifierName(self) return "modifier_card_55" end card_55 = __TS__Decorate(card_55, card_55, {RegisterCard}, {kind = "class", name = "card_55"}) ____exports.card_55 = card_55 ____exports.modifier_card_55 = __TS__Class() local modifier_card_55 = ____exports.modifier_card_55 modifier_card_55.name = "modifier_card_55" modifier_card_55.____file_path = "scripts/vscripts/cards/examples/card_55.lua" __TS__ClassExtends(modifier_card_55, CardBaseModifier) function modifier_card_55.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_55.prototype.OnIntervalThink(self) if not IsServer() then return end local applied = self:applyToHomer() if applied then self:StartIntervalThink(-1) end end function modifier_card_55.prototype.OnDestroy(self) if not IsServer() then return end if self.homerHealthMod and not self.homerHealthMod:IsNull() then self.homerHealthMod:Destroy() end self.homerHealthMod = nil end function modifier_card_55.prototype.GetAttributes(self) return MODIFIER_ATTRIBUTE_MULTIPLE end function modifier_card_55.prototype.getHealthBonusPct(self) return self:getScaledCardValue("max_health_bonus_pct", 25, CARD_ID) end function modifier_card_55.prototype.OnCustomRefresh(self, _params) if not IsServer() then return end if self.homerHealthMod and not self.homerHealthMod:IsNull() then local homerMod = self.homerHealthMod homerMod:setBonusPct(self:getScaledCardValue("max_health_bonus_pct", 25, CARD_ID)) end end function modifier_card_55.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_55.prototype.applyToHomer(self) local owner = self:GetParent() if not owner or not IsValidEntity(owner) then return false end if self.homerHealthMod and not self.homerHealthMod:IsNull() then return true end local homer = self:findHomer() if not homer then return false end self.homerHealthMod = homer:AddNewModifier( owner, getModifierSourceAbility(nil, owner), ____exports.modifier_card_55_homer.name, {bonus_pct = self:getHealthBonusPct()} ) return self.homerHealthMod ~= nil and not self.homerHealthMod:IsNull() end modifier_card_55 = __TS__Decorate( modifier_card_55, modifier_card_55, {registerModifier(nil)}, {kind = "class", name = "modifier_card_55"} ) ____exports.modifier_card_55 = modifier_card_55 ____exports.modifier_card_55_homer = __TS__Class() local modifier_card_55_homer = ____exports.modifier_card_55_homer modifier_card_55_homer.name = "modifier_card_55_homer" modifier_card_55_homer.____file_path = "scripts/vscripts/cards/examples/card_55.lua" __TS__ClassExtends(modifier_card_55_homer, CardBaseModifier) function modifier_card_55_homer.prototype.____constructor(self, ...) CardBaseModifier.prototype.____constructor(self, ...) self.bonusPct = 25 end function modifier_card_55_homer.prototype.setBonusPct(self, pct) self.bonusPct = pct local homer = self:GetParent() if homer and IsValidEntity(homer) and homer:IsRealHero() then homer:CalculateStatBonus(true) end end function modifier_card_55_homer.prototype.OnCustomCreated(self, params) if params and params.bonus_pct ~= nil then self.bonusPct = params.bonus_pct end end function modifier_card_55_homer.prototype.IsHidden(self) return true end function modifier_card_55_homer.prototype.GetAttributes(self) return MODIFIER_ATTRIBUTE_MULTIPLE end function modifier_card_55_homer.prototype.DeclareFunctions(self) return {MODIFIER_PROPERTY_EXTRA_HEALTH_PERCENTAGE} end function modifier_card_55_homer.prototype.GetModifierExtraHealthPercentage(self) return self.bonusPct end modifier_card_55_homer = __TS__Decorate( modifier_card_55_homer, modifier_card_55_homer, {registerModifier(nil)}, {kind = "class", name = "modifier_card_55_homer"} ) ____exports.modifier_card_55_homer = modifier_card_55_homer return ____exports