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 GetPlayerActiveCardCountExcludingInherent = ____CardSystem.GetPlayerActiveCardCountExcludingInherent 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_stats_multiplier = require("modifiers.modifier_stats_multiplier") local removeStatsMultiplierSource = ____modifier_stats_multiplier.removeStatsMultiplierSource local setStatsMultiplierSource = ____modifier_stats_multiplier.setStatsMultiplierSource local CARD_5_SOURCE_SEQ = 1 ____exports.card_5 = __TS__Class() local card_5 = ____exports.card_5 card_5.name = "card_5" card_5.____file_path = "scripts/vscripts/cards/examples/card_5.lua" __TS__ClassExtends(card_5, CardBase) function card_5.prototype.GetModifierName(self) return "modifier_card_5" end card_5 = __TS__Decorate(card_5, card_5, {RegisterCard}, {kind = "class", name = "card_5"}) ____exports.card_5 = card_5 ____exports.modifier_card_5 = __TS__Class() local modifier_card_5 = ____exports.modifier_card_5 modifier_card_5.name = "modifier_card_5" modifier_card_5.____file_path = "scripts/vscripts/cards/examples/card_5.lua" __TS__ClassExtends(modifier_card_5, CardBaseModifier) function modifier_card_5.prototype.____constructor(self, ...) CardBaseModifier.prototype.____constructor(self, ...) self.sourceId = "" self.pctPerCard = 0 self.cumulativeCardsBeforeCopies = 0 self.accountedCopies = 0 end function modifier_card_5.prototype.GetAttributes(self) return MODIFIER_ATTRIBUTE_MULTIPLE end function modifier_card_5.prototype.OnCustomCreated(self, params) if not IsServer() then return end local hero = self:GetParent() if not hero or not IsValidEntity(hero) or not hero:IsRealHero() then return end local ____CARD_5_SOURCE_SEQ_0 = CARD_5_SOURCE_SEQ CARD_5_SOURCE_SEQ = ____CARD_5_SOURCE_SEQ_0 + 1 self.sourceId = "card_5_" .. tostring(____CARD_5_SOURCE_SEQ_0) local pid = hero:GetPlayerID() self.pctPerCard = self:getCardValue("card_bonus_pct", 0, 5) local activeNow = GetPlayerActiveCardCountExcludingInherent(nil, pid) self.cumulativeCardsBeforeCopies = math.max(0, activeNow - 1) self.accountedCopies = self:getCardCopies() print((((((((((("[card_5] OnCustomCreated player=" .. tostring(pid)) .. " active_now=") .. tostring(activeNow)) .. " copies=") .. tostring(self.accountedCopies)) .. " cumulative_before=") .. tostring(self.cumulativeCardsBeforeCopies)) .. " card_bonus_pct=") .. tostring(self.pctPerCard)) .. " source=") .. self.sourceId) setStatsMultiplierSource( nil, hero, self.sourceId, function() if not hero or not IsValidEntity(hero) or not hero:IsRealHero() then return 0 end return self.pctPerCard * self.cumulativeCardsBeforeCopies end ) end function modifier_card_5.prototype.OnCustomRefresh(self, _params) if not IsServer() then return end local hero = self:GetParent() if not hero or not IsValidEntity(hero) or not hero:IsRealHero() then return end local currentCopies = self:getCardCopies() if currentCopies <= self.accountedCopies then return end local ownerId = hero:GetPlayerID() if ownerId < 0 then return end local activeNow = GetPlayerActiveCardCountExcludingInherent(nil, ownerId) local newCopies = currentCopies - self.accountedCopies do local i = 0 while i < newCopies do self.cumulativeCardsBeforeCopies = self.cumulativeCardsBeforeCopies + math.max(0, activeNow - 1 - i) i = i + 1 end end self.accountedCopies = currentCopies end function modifier_card_5.prototype.OnDestroy(self) if not IsServer() then return end local hero = self:GetParent() if not hero or not IsValidEntity(hero) or not hero:IsRealHero() then return end if self.sourceId ~= "" then removeStatsMultiplierSource(nil, hero, self.sourceId) end end modifier_card_5 = __TS__Decorate( modifier_card_5, modifier_card_5, {registerModifier(nil)}, {kind = "class", name = "modifier_card_5"} ) ____exports.modifier_card_5 = modifier_card_5 return ____exports