Updated topcard handling

This commit is contained in:
Chr1Z93 2024-07-31 23:58:06 +02:00
parent cd694e04ea
commit ec64ca6f76
3 changed files with 11 additions and 11 deletions

View File

@ -113,7 +113,7 @@ function startSearch(messageColor, number)
-- get draw deck
local deckAreaObjects = playermatApi.getDeckAreaObjects(matColor)
if deckAreaObjects.draw == nil then
if deckAreaObjects.draw == nil and deckAreaObjects.topCard == nil then
printToColor(matColor .. " draw deck could not be found!", messageColor, "Red")
return
end
@ -158,16 +158,18 @@ function startSearch(messageColor, number)
-- handling for Norman Withers
if deckAreaObjects.topCard then
deckAreaObjects.topCard.setRotation(setAsideRotation)
deckAreaObjects.topCard.deal(1, handColor)
number = number - 1
topCardDetected = true
end
searchView()
Wait.time(function()
deckAreaObjects = playermatApi.getDeckAreaObjects(matColor)
deckAreaObjects.draw.deal(number, handColor)
end, 1)
if number > 0 then
Wait.time(function()
deckAreaObjects.draw.deal(number, handColor)
end, 0.1)
end
end
-- place handCards back into deck and optionally shuffle

View File

@ -258,7 +258,7 @@ function onObjectNumberTyped(hoveredObject, playerColor, number)
end
-- check whether the hovered object is part of a players draw objects
for _, color in ipairs(playermatApi.getUsedMatColors()) do
for color, _ in ipairs(guidReferenceApi.getObjectsByType("Playermat")) do
local deckAreaObjects = playermatApi.getDeckAreaObjects(color)
if deckAreaObjects.topCard == hoveredObject or deckAreaObjects.draw == hoveredObject then
playermatApi.drawCardsWithReshuffle(color, number)

View File

@ -473,8 +473,7 @@ function drawCardsWithReshuffle(numCards)
if deckSize >= numCards then
drawCards(numCards)
-- flip top card again for Norman
if topCardDetected and string.match(activeInvestigatorId, "%d%d%d%d%d") == "08004" then
if topCardDetected then
flipTopCardFromDeck()
end
else
@ -483,8 +482,7 @@ function drawCardsWithReshuffle(numCards)
shuffleDiscardIntoDeck()
Wait.time(function()
drawCards(numCards - deckSize)
-- flip top card again for Norman
if topCardDetected and string.match(activeInvestigatorId, "%d%d%d%d%d") == "08004" then
if topCardDetected then
flipTopCardFromDeck()
end
end, 1)