support for multiple RBWs

This commit is contained in:
Chr1Z93 2023-08-21 16:23:49 +02:00
parent 208a29ff33
commit 22b60f38b3
2 changed files with 9 additions and 8 deletions

View File

@ -2,7 +2,6 @@
"id": "02014",
"type": "Asset",
"class": "Neutral",
"startsInPlay": true,
"cost": 2,
"traits": "Ally. Creature.",
"cycle": "The Dunwich Legacy"

View File

@ -167,18 +167,20 @@ do
--- if a weakness is added.
internal.maybeDrawRandomWeakness = function(slots, playerColor)
local allCardsBag = getObjectFromGUID(configuration.card_bag_guid)
local hasRandomWeakness = false
local randomWeaknessAmount = 0
for cardId, cardCount in pairs(slots) do
if cardId == RANDOM_WEAKNESS_ID then
hasRandomWeakness = true
randomWeaknessAmount = cardCount
break
end
end
if hasRandomWeakness then
local weaknessId = allCardsBag.call("getRandomWeaknessId")
slots[weaknessId] = 1
slots[RANDOM_WEAKNESS_ID] = nil
internal.maybePrint("Random basic weakness added to deck", playerColor)
if randomWeaknessAmount ~= 0 then
for i=1, randomWeaknessAmount do
local weaknessId = allCardsBag.call("getRandomWeaknessId")
slots[weaknessId] = 1
slots[RANDOM_WEAKNESS_ID] = nil
end
internal.maybePrint("Added " .. randomWeaknessAmount .. " random basic weakness(es) to deck", playerColor)
end
end