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 ____custom_game_events = require("custom_game_events") local ensurePlayerCardSystem = ____custom_game_events.ensurePlayerCardSystem 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 = 45 ____exports.card_45 = __TS__Class() local card_45 = ____exports.card_45 card_45.name = "card_45" card_45.____file_path = "scripts/vscripts/cards/examples/card_45.lua" __TS__ClassExtends(card_45, CardBase) function card_45.prototype.GetModifierName(self) return "modifier_card_45" end card_45 = __TS__Decorate(card_45, card_45, {RegisterCard}, {kind = "class", name = "card_45"}) ____exports.card_45 = card_45 ____exports.modifier_card_45 = __TS__Class() local modifier_card_45 = ____exports.modifier_card_45 modifier_card_45.name = "modifier_card_45" modifier_card_45.____file_path = "scripts/vscripts/cards/examples/card_45.lua" __TS__ClassExtends(modifier_card_45, CardBaseModifier) function modifier_card_45.prototype.____constructor(self, ...) CardBaseModifier.prototype.____constructor(self, ...) self.speedBonusPct = 0 end function modifier_card_45.prototype.getValue(self, key, fallback) return self:getCardValue(key, fallback, CARD_ID) end function modifier_card_45.prototype.getMaxBonusPct(self) return self:getScaledCardValue("max_bonus_pct", 60) end function modifier_card_45.prototype.resetSpeedBonusToMax(self) self.speedBonusPct = self:getMaxBonusPct() local parent = self:GetParent() if parent and parent:IsHero() then parent:CalculateStatBonus(true) end end function modifier_card_45.prototype.OnCustomCreated(self, _params) if not IsServer() then return end self:resetSpeedBonusToMax() self:StartIntervalThink(60) end function modifier_card_45.prototype.OnCustomRefresh(self, _params) if not IsServer() then return end self.speedBonusPct = self.speedBonusPct + self:getValue("max_bonus_pct", 60) local parent = self:GetParent() if parent and parent:IsHero() then parent:CalculateStatBonus(true) end end function modifier_card_45.prototype.OnIntervalThink(self) if not IsServer() then return end local decay = math.floor(self:getValue("decay_pct_per_minute", 10)) self.speedBonusPct = math.max(0, self.speedBonusPct - decay) local parent = self:GetParent() if parent and parent:IsHero() then parent:CalculateStatBonus(true) end end function modifier_card_45.prototype.DeclareFunctions(self) return {MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE, MODIFIER_PROPERTY_TOOLTIP} end function modifier_card_45.prototype.GetModifierMoveSpeedBonus_Percentage(self) return self.speedBonusPct end function modifier_card_45.prototype.GetTexture(self) return "item_energy_drink" end modifier_card_45 = __TS__Decorate( modifier_card_45, modifier_card_45, {registerModifier(nil)}, {kind = "class", name = "modifier_card_45"} ) ____exports.modifier_card_45 = modifier_card_45 --- Рассвет: восстановить бонус до max_bonus_pct (вызывается из DayNightCycleManager). function ____exports.notifyCard45MorningStarted(self, _morningSequence) if not IsServer() then return end do local i = 0 while i < DOTA_MAX_PLAYERS do do local pid = i local player = PlayerResource:GetPlayer(pid) if not player then goto __continue20 end local cardSystem = ensurePlayerCardSystem(nil, pid) if not cardSystem or cardSystem:GetActiveCardCopies(CARD_ID) <= 0 then goto __continue20 end local hero = player:GetAssignedHero() if not hero or not IsValidEntity(hero) or not hero:IsRealHero() then goto __continue20 end local mod = hero:FindModifierByName("modifier_card_45") if mod then mod:resetSpeedBonusToMax() end end ::__continue20:: i = i + 1 end end end return ____exports