added topcard flipping

This commit is contained in:
Chr1Z93 2023-10-21 12:47:29 +02:00
parent c18ab6384e
commit 3c5d9e3070
2 changed files with 22 additions and 2 deletions

View File

@ -1,7 +1,7 @@
local playmatApi = require("playermat/PlaymatApi") local playmatApi = require("playermat/PlaymatApi")
-- forward declaration of variables that are used across functions -- forward declaration of variables that are used across functions
local matColor, handColor, setAsidePosition, setAsideRotation, drawDeckPosition local matColor, handColor, setAsidePosition, setAsideRotation, drawDeckPosition, topCardDetected
local quickParameters = {} local quickParameters = {}
quickParameters.function_owner = self quickParameters.function_owner = self
@ -101,6 +101,7 @@ end
function startSearch(messageColor, number) function startSearch(messageColor, number)
matColor = playmatApi.getMatColorByPosition(self.getPosition()) matColor = playmatApi.getMatColorByPosition(self.getPosition())
handColor = playmatApi.getPlayerColor(matColor) handColor = playmatApi.getPlayerColor(matColor)
topCardDetected = false
-- get draw deck -- get draw deck
local drawDeck = playmatApi.getDrawDeck(matColor) local drawDeck = playmatApi.getDrawDeck(matColor)
@ -134,6 +135,7 @@ function startSearch(messageColor, number)
local object = v.hit_object local object = v.hit_object
if object.tag == "Card" and not object.is_face_down then if object.tag == "Card" and not object.is_face_down then
object.flip() object.flip()
topCardDetected = true
Wait.time(function() drawDeck = playmatApi.getDrawDeck(matColor) end, 1) Wait.time(function() drawDeck = playmatApi.getDrawDeck(matColor) end, 1)
break break
end end
@ -177,6 +179,14 @@ function endSearch(_, _, isRightClick)
end end
normalView() normalView()
-- Norman Withers handling
if topCardDetected then
local deck = playmatApi.getDrawDeck(matColor)
if deck then
deck.takeObject({ position = deck.getPosition() + Vector(0, 1, 0), flip = true })
end
end
end end
-- utility function -- utility function

View File

@ -421,6 +421,7 @@ function drawCardsWithReshuffle(numCards)
getDrawDiscardDecks() getDrawDiscardDecks()
-- Norman Withers handling -- Norman Withers handling
local topCardDrawn = false
if string.match(activeInvestigatorId, "%d%d%d%d%d") == "08004" then if string.match(activeInvestigatorId, "%d%d%d%d%d") == "08004" then
local harbinger = false local harbinger = false
if topCard ~= nil and topCard.getName() == "The Harbinger" then if topCard ~= nil and topCard.getName() == "The Harbinger" then
@ -438,7 +439,8 @@ function drawCardsWithReshuffle(numCards)
end end
if topCard ~= nil then if topCard ~= nil then
topCard.deal(numCards, playerColor) topCard.deal(1, playerColor)
topCardDrawn = true
numCards = numCards - 1 numCards = numCards - 1
if numCards == 0 then return end if numCards == 0 then return end
end end
@ -462,6 +464,14 @@ function drawCardsWithReshuffle(numCards)
Wait.time(|| drawCards(numCards - deckSize), 1) Wait.time(|| drawCards(numCards - deckSize), 1)
end end
printToColor("Take 1 horror (drawing card from empty deck)", messageColor) printToColor("Take 1 horror (drawing card from empty deck)", messageColor)
-- more Norman Withers handling
if topCardDrawn then
getDrawDiscardDecks()
if drawDeck then
drawDeck.takeObject({ position = drawDeck.getPosition() + Vector(0, 1, 0), flip = true })
end
end
end end
-- get the draw deck and discard pile objects -- get the draw deck and discard pile objects