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", "id": "02014",
"type": "Asset", "type": "Asset",
"class": "Neutral", "class": "Neutral",
"startsInPlay": true,
"cost": 2, "cost": 2,
"traits": "Ally. Creature.", "traits": "Ally. Creature.",
"cycle": "The Dunwich Legacy" "cycle": "The Dunwich Legacy"

View File

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