Merge pull request #357 from argonui/randomweakness
Bugfix for deck importer
This commit is contained in:
commit
05561e5053
@ -168,18 +168,13 @@ 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 randomWeaknessAmount = 0
|
local randomWeaknessAmount = slots[RANDOM_WEAKNESS_ID] or 0
|
||||||
for cardId, cardCount in pairs(slots) do
|
slots[RANDOM_WEAKNESS_ID] = nil
|
||||||
if cardId == RANDOM_WEAKNESS_ID then
|
|
||||||
randomWeaknessAmount = cardCount
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if randomWeaknessAmount ~= 0 then
|
if randomWeaknessAmount ~= 0 then
|
||||||
for i=1, randomWeaknessAmount do
|
for i=1, randomWeaknessAmount do
|
||||||
local weaknessId = allCardsBag.call("getRandomWeaknessId")
|
local weaknessId = allCardsBag.call("getRandomWeaknessId")
|
||||||
slots[weaknessId] = 1
|
slots[weaknessId] = (slots[weaknessId] or 0) + 1
|
||||||
slots[RANDOM_WEAKNESS_ID] = nil
|
|
||||||
end
|
end
|
||||||
internal.maybePrint("Added " .. randomWeaknessAmount .. " random basic weakness(es) to deck", playerColor)
|
internal.maybePrint("Added " .. randomWeaknessAmount .. " random basic weakness(es) to deck", playerColor)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user