Merge pull request #347 from argonui/pete-deckbuilder

Deckbuilder Updates
This commit is contained in:
BootleggerFinn 2023-08-22 12:47:41 -05:00 committed by GitHub
commit fea12454de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 10 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
for i=1, randomWeaknessAmount do
local weaknessId = allCardsBag.call("getRandomWeaknessId") local weaknessId = allCardsBag.call("getRandomWeaknessId")
slots[weaknessId] = 1 slots[weaknessId] = 1
slots[RANDOM_WEAKNESS_ID] = nil slots[RANDOM_WEAKNESS_ID] = nil
internal.maybePrint("Random basic weakness added to deck", playerColor) end
internal.maybePrint("Added " .. randomWeaknessAmount .. " random basic weakness(es) to deck", playerColor)
end end
end end
@ -199,7 +201,7 @@ do
local altArt = { front = "normal", back = "normal" } local altArt = { front = "normal", back = "normal" }
-- translating front ID -- translating front ID
if altFrontId > 90000 and altFrontId < 90038 then if altFrontId > 90000 and altFrontId < 90047 then
altArt.front = "parallel" altArt.front = "parallel"
elseif altFrontId > 01500 and altFrontId < 01506 then elseif altFrontId > 01500 and altFrontId < 01506 then
altArt.front = "revised" altArt.front = "revised"
@ -208,7 +210,7 @@ do
end end
-- translating back ID -- translating back ID
if altBackId > 90000 and altBackId < 90038 then if altBackId > 90000 and altBackId < 90047 then
altArt.back = "parallel" altArt.back = "parallel"
elseif altBackId > 01500 and altBackId < 01506 then elseif altBackId > 01500 and altBackId < 01506 then
altArt.back = "revised" altArt.back = "revised"
@ -233,6 +235,7 @@ do
end end
end end
slots[investigatorId] = 1 slots[investigatorId] = 1
deck.investigator_code = investigatorId
return loadAltInvestigator return loadAltInvestigator
end end

View File

@ -91,6 +91,7 @@ function loadCards(slots, investigatorId, bondedList, customizations, playerColo
handleUnderworldMarket(cardsToSpawn, playerColor) handleUnderworldMarket(cardsToSpawn, playerColor)
handleHunchDeck(investigatorId, cardsToSpawn, playerColor) handleHunchDeck(investigatorId, cardsToSpawn, playerColor)
handleCustomizableUpgrades(cardsToSpawn, customizations) handleCustomizableUpgrades(cardsToSpawn, customizations)
handlePeteSignatureAssets(investigatorId, cardsToSpawn)
-- Split the card list into separate lists for each zone -- Split the card list into separate lists for each zone
local zoneDecks = buildZoneLists(cardsToSpawn) local zoneDecks = buildZoneLists(cardsToSpawn)
@ -392,6 +393,27 @@ function handleCustomizableUpgrades(cardList, customizations)
end end
end end
-- Handles cards that start in play under specific conditions for Ashcan Pete (Regular Pete - Duke, Parallel Pete - Guitar)
---@param investigatorId String ID for the deck's investigator card. Passed separately because the
--- investigator may not be included in the cardList
---@param cardList Table Deck list being created
function handlePeteSignatureAssets(investigatorId, cardList)
log(investigatorId)
if investigatorId == "02005" or investigatorId == "02005-pb" then -- regular Pete's front
for i, card in ipairs(cardList) do
if card.metadata.id == "02014" then -- Duke
card.zone = "BlankTop"
end
end
elseif investigatorId == "02005-p" or investigatorId == "02005-pf" then -- parallel Pete's front
for i, card in ipairs(cardList) do
if card.metadata.id == "90047" then -- Pete's Guitar
card.zone = "BlankTop"
end
end
end
end
-- Callback function for investigator cards and minicards to set the correct state for alt art -- Callback function for investigator cards and minicards to set the correct state for alt art
---@param card Object Card which needs to be set the state for ---@param card Object Card which needs to be set the state for
---@param loadAltInvestigator String Contains the name of alternative art for the investigator ("normal", "revised" or "promo") ---@param loadAltInvestigator String Contains the name of alternative art for the investigator ("normal", "revised" or "promo")