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_cursed = require("cards.modifier_card_cursed") local addCursedStack = ____modifier_card_cursed.addCursedStack local getCursedStackCount = ____modifier_card_cursed.getCursedStackCount local removeCursedStack = ____modifier_card_cursed.removeCursedStack local CARD_ID = 31 ____exports.card_31 = __TS__Class() local card_31 = ____exports.card_31 card_31.name = "card_31" card_31.____file_path = "scripts/vscripts/cards/examples/card_31.lua" __TS__ClassExtends(card_31, CardBase) function card_31.prototype.GetModifierName(self) return "modifier_card_31" end card_31 = __TS__Decorate(card_31, card_31, {RegisterCard}, {kind = "class", name = "card_31"}) ____exports.card_31 = card_31 ____exports.modifier_card_31 = __TS__Class() local modifier_card_31 = ____exports.modifier_card_31 modifier_card_31.name = "modifier_card_31" modifier_card_31.____file_path = "scripts/vscripts/cards/examples/card_31.lua" __TS__ClassExtends(modifier_card_31, CardBaseModifier) function modifier_card_31.prototype.____constructor(self, ...) CardBaseModifier.prototype.____constructor(self, ...) self.cursedApplied = false self.levelOnPickup = 1 end function modifier_card_31.prototype.getValue(self, key, fallback) return self:getCardValue(key, fallback, CARD_ID) end function modifier_card_31.prototype.OnCustomCreated(self, params) if not IsServer() then return end self:capturePickupLevel() self:applyCursed() end function modifier_card_31.prototype.OnDestroy(self) if not IsServer() then return end local hero = self:GetParent() if not hero or not IsValidEntity(hero) then return end if not self.cursedApplied then return end removeCursedStack(nil, hero) self.cursedApplied = false end function modifier_card_31.prototype.DeclareFunctions(self) return {MODIFIER_PROPERTY_STATS_STRENGTH_BONUS, MODIFIER_PROPERTY_STATS_AGILITY_BONUS, MODIFIER_PROPERTY_STATS_INTELLECT_BONUS, MODIFIER_PROPERTY_TOOLTIP} end function modifier_card_31.prototype.GetModifierBonusStats_Strength(self) local hero = self:GetParent() if not hero or not IsValidEntity(hero) then return 0 end local level = self:getLevelsAfterPickup(hero) local curses = getCursedStackCount(nil, hero) if level <= 0 or curses <= 0 then return 0 end local strengthPenaltyPerLevel = self:getValue("strength_penalty_per_level", 1) return -level * strengthPenaltyPerLevel * curses * self:getCardCopies() end function modifier_card_31.prototype.GetModifierBonusStats_Agility(self) local hero = self:GetParent() if not hero or not IsValidEntity(hero) then return 0 end local level = self:getLevelsAfterPickup(hero) local curses = getCursedStackCount(nil, hero) if level <= 0 or curses <= 0 then return 0 end local agilityPerLevel = self:getValue("agility_per_level", 2) return level * agilityPerLevel * curses * self:getCardCopies() end function modifier_card_31.prototype.GetModifierBonusStats_Intellect(self) local hero = self:GetParent() if not hero or not IsValidEntity(hero) then return 0 end local level = self:getLevelsAfterPickup(hero) local curses = getCursedStackCount(nil, hero) if level <= 0 or curses <= 0 then return 0 end local intellectPenaltyPerLevel = self:getValue("intellect_penalty_per_level", 1) return -level * intellectPenaltyPerLevel * curses * self:getCardCopies() end function modifier_card_31.prototype.applyCursed(self) if self.cursedApplied then return end local hero = self:GetParent() if not hero or not IsValidEntity(hero) or not hero:IsRealHero() then return end addCursedStack(nil, hero) self.cursedApplied = true end function modifier_card_31.prototype.getLevelsAfterPickup(self, hero) return math.max( 0, hero:GetLevel() - self.levelOnPickup ) end function modifier_card_31.prototype.capturePickupLevel(self) local hero = self:GetParent() if not hero or not IsValidEntity(hero) or not hero:IsRealHero() then return end self.levelOnPickup = hero:GetLevel() end modifier_card_31 = __TS__Decorate( modifier_card_31, modifier_card_31, {registerModifier(nil)}, {kind = "class", name = "modifier_card_31"} ) ____exports.modifier_card_31 = modifier_card_31 return ____exports