99 lines
3.4 KiB
Lua
99 lines
3.4 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 AddCardToPlayerPool = ____CardSystem.AddCardToPlayerPool
|
|
local CardBase = ____CardSystem.CardBase
|
|
local RegisterCard = ____CardSystem.RegisterCard
|
|
local ShowCardSelectionExactOptionsToPlayer = ____CardSystem.ShowCardSelectionExactOptionsToPlayer
|
|
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_value_resolver = require("cards.card_value_resolver")
|
|
local getCardValueByLevel = ____card_value_resolver.getCardValueByLevel
|
|
local CARD_ID = 41
|
|
local BLADE_CARD_IDS = {27, 28}
|
|
local POOL_SOURCE = "card_41_injected_pool_cards"
|
|
local BLADE_CHOICE_SOURCE = "card_41_blade_choice"
|
|
local function injectBladePairsToPool(self, playerId, ____pairs)
|
|
local normalizedPairs = math.max(
|
|
1,
|
|
math.floor(____pairs)
|
|
)
|
|
do
|
|
local pairIndex = 0
|
|
while pairIndex < normalizedPairs do
|
|
for ____, bladeId in ipairs(BLADE_CARD_IDS) do
|
|
AddCardToPlayerPool(
|
|
nil,
|
|
playerId,
|
|
bladeId,
|
|
1,
|
|
1,
|
|
POOL_SOURCE
|
|
)
|
|
end
|
|
pairIndex = pairIndex + 1
|
|
end
|
|
end
|
|
end
|
|
____exports.card_41 = __TS__Class()
|
|
local card_41 = ____exports.card_41
|
|
card_41.name = "card_41"
|
|
card_41.____file_path = "scripts/vscripts/cards/examples/card_41.lua"
|
|
__TS__ClassExtends(card_41, CardBase)
|
|
function card_41.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
|
|
local player = PlayerResource:GetPlayer(playerId)
|
|
local ____opt_0 = player and player.cardSystem
|
|
local level = ____opt_0 and ____opt_0:GetCardLevel(CARD_ID) or 1
|
|
local ____pairs = math.max(
|
|
1,
|
|
math.floor(getCardValueByLevel(
|
|
nil,
|
|
CARD_ID,
|
|
hero,
|
|
"pool_pairs",
|
|
1
|
|
))
|
|
)
|
|
injectBladePairsToPool(nil, playerId, ____pairs)
|
|
if level >= 2 then
|
|
ShowCardSelectionExactOptionsToPlayer(nil, playerId, BLADE_CARD_IDS, BLADE_CHOICE_SOURCE)
|
|
end
|
|
end
|
|
function card_41.prototype.GetModifierName(self)
|
|
return "modifier_card_41"
|
|
end
|
|
function card_41.prototype.IsHidden(self)
|
|
return true
|
|
end
|
|
card_41 = __TS__Decorate(card_41, card_41, {RegisterCard}, {kind = "class", name = "card_41"})
|
|
____exports.card_41 = card_41
|
|
____exports.modifier_card_41 = __TS__Class()
|
|
local modifier_card_41 = ____exports.modifier_card_41
|
|
modifier_card_41.name = "modifier_card_41"
|
|
modifier_card_41.____file_path = "scripts/vscripts/cards/examples/card_41.lua"
|
|
__TS__ClassExtends(modifier_card_41, CardBaseModifier)
|
|
modifier_card_41 = __TS__Decorate(
|
|
modifier_card_41,
|
|
modifier_card_41,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_card_41"}
|
|
)
|
|
____exports.modifier_card_41 = modifier_card_41
|
|
return ____exports
|