Added better handling for startsInPlay cards

This commit is contained in:
Entrox-Licher 2023-12-20 16:20:20 -05:00
parent 4a5db38bc6
commit 9b355ce5e6
2 changed files with 35 additions and 11 deletions

View File

@ -7,6 +7,8 @@ local playAreaApi = require("core/PlayAreaApi")
local playmatApi = require("playermat/PlaymatApi") local playmatApi = require("playermat/PlaymatApi")
local zones = require("playermat/Zones") local zones = require("playermat/Zones")
local startsInPlayCount = 0
function onLoad(script_state) function onLoad(script_state)
initializeUi(JSON.decode(script_state)) initializeUi(JSON.decode(script_state))
math.randomseed(os.time()) math.randomseed(os.time())
@ -31,7 +33,7 @@ function getDefaultCardZone(cardMetadata, bondedList)
elseif cardMetadata.type == "UpgradeSheet" then elseif cardMetadata.type == "UpgradeSheet" then
return "SetAside4" return "SetAside4"
elseif cardMetadata.startsInPlay then elseif cardMetadata.startsInPlay then
return "BlankTop" return startsInPlayTracker()
elseif cardMetadata.permanent then elseif cardMetadata.permanent then
return "SetAside1" return "SetAside1"
elseif bondedList[cardMetadata.id] then elseif bondedList[cardMetadata.id] then
@ -42,6 +44,16 @@ function getDefaultCardZone(cardMetadata, bondedList)
end end
end end
function startsInPlayTracker()
startsInPlayCount = startsInPlayCount + 1
if startsInPlayCount > 6 then
broadcastToAll("Card that should start in play was placed with permanents because no blank slots remained")
return "SetAside1"
else
return "Blank" .. startsInPlayCount
end
end
function buildDeck(playerColor, deckId) function buildDeck(playerColor, deckId)
local uiState = getUiState() local uiState = getUiState()
arkhamDb.getDecklist( arkhamDb.getDecklist(
@ -447,13 +459,13 @@ function handlePeteSignatureAssets(investigatorId, cardList)
if investigatorId == "02005" or investigatorId == "02005-pb" then -- regular Pete's front if investigatorId == "02005" or investigatorId == "02005-pb" then -- regular Pete's front
for i, card in ipairs(cardList) do for i, card in ipairs(cardList) do
if card.metadata.id == "02014" then -- Duke if card.metadata.id == "02014" then -- Duke
card.zone = "BlankTop" card.zone = startsInPlayTracker()
end end
end end
elseif investigatorId == "02005-p" or investigatorId == "02005-pf" then -- parallel Pete's front elseif investigatorId == "02005-p" or investigatorId == "02005-pf" then -- parallel Pete's front
for i, card in ipairs(cardList) do for i, card in ipairs(cardList) do
if card.metadata.id == "90047" then -- Pete's Guitar if card.metadata.id == "90047" then -- Pete's Guitar
card.zone = "BlankTop" card.zone = startsInPlayTracker()
end end
end end
end end

View File

@ -8,8 +8,8 @@
-- Investigator: Investigator card area. -- Investigator: Investigator card area.
-- Minicard: Placement for the investigator's minicard, just above the player mat -- Minicard: Placement for the investigator's minicard, just above the player mat
-- Deck, Discard: Standard locations for the deck and discard piles. -- Deck, Discard: Standard locations for the deck and discard piles.
-- BlankTop: used for assets that start in play (e.g. Duke) -- Blank1: used for assets that start in play (e.g. Duke)
-- Tarot, Hand1, Hand2, Ally, BlankBottom, Accessory, Arcane1, Arcane2, Body: Asset slot positions -- Tarot, Hand1, Hand2, Ally, Blank4, Accessory, Arcane1, Arcane2, Body: Asset slot positions
-- Threat[1-4]: Threat area slots. Threat[1-3] correspond to the named threat area slots, and Threat4 is the blank threat area slot. -- Threat[1-4]: Threat area slots. Threat[1-3] correspond to the named threat area slots, and Threat4 is the blank threat area slot.
-- SetAside[1-3]: Column closest to the player mat, with 1 at the top and 3 at the bottom. -- SetAside[1-3]: Column closest to the player mat, with 1 at the top and 3 at the bottom.
-- SetAside[4-6]: Column farther away from the mat, with 4 at the top and 6 at the bottom. -- SetAside[4-6]: Column farther away from the mat, with 4 at the top and 6 at the bottom.
@ -35,8 +35,12 @@ do
commonZones["Arcane2"] = { -0.171, 0, 0.557 } commonZones["Arcane2"] = { -0.171, 0, 0.557 }
commonZones["Tarot"] = { 0.602, 0, 0.033 } commonZones["Tarot"] = { 0.602, 0, 0.033 }
commonZones["Accessory"] = { 0.602, 0, 0.555 } commonZones["Accessory"] = { 0.602, 0, 0.555 }
commonZones["BlankTop"] = { 1.758, 0, 0.040 } commonZones["Blank1"] = { 1.758, 0, 0.040 }
commonZones["BlankBottom"] = { 1.754, 0, 0.563 } commonZones["Blank2"] = { 1.754, 0, 0.563 }
commonZones["Blank3"] = { 1.371, 0, 0.038 }
commonZones["Blank4"] = { 1.371, 0, 0.558 }
commonZones["Blank5"] = { 0.98, 0, 0.035 }
commonZones["Blank6"] = { 0.977, 0, 0.556 }
commonZones["Threat1"] = { -0.911, 0, -0.625 } commonZones["Threat1"] = { -0.911, 0, -0.625 }
commonZones["Threat2"] = { -0.454, 0, -0.625 } commonZones["Threat2"] = { -0.454, 0, -0.625 }
commonZones["Threat3"] = { 0.002, 0, -0.625 } commonZones["Threat3"] = { 0.002, 0, -0.625 }
@ -55,8 +59,12 @@ do
zoneData["White"]["Arcane2"] = commonZones["Arcane2"] zoneData["White"]["Arcane2"] = commonZones["Arcane2"]
zoneData["White"]["Tarot"] = commonZones["Tarot"] zoneData["White"]["Tarot"] = commonZones["Tarot"]
zoneData["White"]["Accessory"] = commonZones["Accessory"] zoneData["White"]["Accessory"] = commonZones["Accessory"]
zoneData["White"]["BlankTop"] = commonZones["BlankTop"] zoneData["White"]["Blank1"] = commonZones["Blank1"]
zoneData["White"]["BlankBottom"] = commonZones["BlankBottom"] zoneData["White"]["Blank2"] = commonZones["Blank2"]
zoneData["White"]["Blank3"] = commonZones["Blank3"]
zoneData["White"]["Blank4"] = commonZones["Blank4"]
zoneData["White"]["Blank5"] = commonZones["Blank5"]
zoneData["White"]["Blank6"] = commonZones["Blank6"]
zoneData["White"]["Threat1"] = commonZones["Threat1"] zoneData["White"]["Threat1"] = commonZones["Threat1"]
zoneData["White"]["Threat2"] = commonZones["Threat2"] zoneData["White"]["Threat2"] = commonZones["Threat2"]
zoneData["White"]["Threat3"] = commonZones["Threat3"] zoneData["White"]["Threat3"] = commonZones["Threat3"]
@ -83,8 +91,12 @@ do
zoneData["Orange"]["Arcane2"] = commonZones["Arcane2"] zoneData["Orange"]["Arcane2"] = commonZones["Arcane2"]
zoneData["Orange"]["Tarot"] = commonZones["Tarot"] zoneData["Orange"]["Tarot"] = commonZones["Tarot"]
zoneData["Orange"]["Accessory"] = commonZones["Accessory"] zoneData["Orange"]["Accessory"] = commonZones["Accessory"]
zoneData["Orange"]["BlankTop"] = commonZones["BlankTop"] zoneData["Orange"]["Blank1"] = commonZones["Blank1"]
zoneData["Orange"]["BlankBottom"] = commonZones["BlankBottom"] zoneData["Orange"]["Blank2"] = commonZones["Blank2"]
zoneData["Orange"]["Blank3"] = commonZones["Blank3"]
zoneData["Orange"]["Blank4"] = commonZones["Blank4"]
zoneData["Orange"]["Blank5"] = commonZones["Blank5"]
zoneData["Orange"]["Blank6"] = commonZones["Blank6"]
zoneData["Orange"]["Threat1"] = commonZones["Threat1"] zoneData["Orange"]["Threat1"] = commonZones["Threat1"]
zoneData["Orange"]["Threat2"] = commonZones["Threat2"] zoneData["Orange"]["Threat2"] = commonZones["Threat2"]
zoneData["Orange"]["Threat3"] = commonZones["Threat3"] zoneData["Orange"]["Threat3"] = commonZones["Threat3"]