Files
Dota-Zombie-Invasion/scripts/vscripts/cards/examples/card_85.lua
T
2026-05-29 15:11:31 +07:00

81 lines
2.8 KiB
Lua

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 AddSlagToPlayerPool = ____CardSystem.AddSlagToPlayerPool
local CardBase = ____CardSystem.CardBase
local RegisterCard = ____CardSystem.RegisterCard
local ShowCardSelectionToPlayer = ____CardSystem.ShowCardSelectionToPlayer
local ____card_slag = require("cards.card_slag")
local FISHING_CARD_ID = ____card_slag.FISHING_CARD_ID
local ____card_value_resolver = require("cards.card_value_resolver")
local getCardValueByLevel = ____card_value_resolver.getCardValueByLevel
local CARD_ID = FISHING_CARD_ID
local BONUS_SELECTION_SOURCE = "card_85_fishing_bonus"
local SLAG_POOL_SOURCE = "card_85_fishing_slag"
____exports.card_85 = __TS__Class()
local card_85 = ____exports.card_85
card_85.name = "card_85"
card_85.____file_path = "scripts/vscripts/cards/examples/card_85.lua"
__TS__ClassExtends(card_85, CardBase)
function card_85.prototype.OnCreated(self)
if not IsServer() then
return
end
local hero = self:GetHero()
if not hero or not IsValidEntity(hero) or not hero:IsRealHero() then
return
end
local playerId = hero:GetPlayerOwnerID()
if playerId == nil or playerId == nil or playerId < 0 then
return
end
Timers:CreateTimer(
0,
function()
local slagCopies = math.max(
1,
math.floor(getCardValueByLevel(
nil,
CARD_ID,
hero,
"slag_pool_copies",
1
))
)
AddSlagToPlayerPool(
nil,
playerId,
1,
slagCopies,
SLAG_POOL_SOURCE
)
local ____opt_0 = PlayerResource:GetPlayer(playerId)
local cardSystem = ____opt_0 and ____opt_0.cardSystem
if cardSystem ~= nil then
cardSystem:SetPoolCardFromSource(CARD_ID, 1, BONUS_SELECTION_SOURCE)
end
local bonusChoices = math.max(
1,
math.floor(getCardValueByLevel(
nil,
CARD_ID,
hero,
"bonus_card_choices",
1
))
)
ShowCardSelectionToPlayer(nil, playerId, bonusChoices, BONUS_SELECTION_SOURCE)
return nil
end
)
end
function card_85.prototype.GetModifierName(self)
return nil
end
card_85 = __TS__Decorate(card_85, card_85, {RegisterCard}, {kind = "class", name = "card_85"})
____exports.card_85 = card_85
return ____exports