fix for "hidden" cards

This commit is contained in:
Chr1Z93 2023-03-10 19:47:07 +01:00
parent e9dcfdb38d
commit c701e2a472
2 changed files with 8 additions and 7 deletions

View File

@ -526,6 +526,11 @@ function setSpawnedPlayerCardGuid(params)
end end
end end
-- deprecated, use metadata (GM Notes) instead (still used by custom data helpers)
-- Encounter Cards with "Hidden."
HIDDEN_CARD_DATA = {}
-- called by "Global" during encounter card drawing
function checkHiddenCard(name) function checkHiddenCard(name)
for _, n in ipairs(HIDDEN_CARD_DATA) do for _, n in ipairs(HIDDEN_CARD_DATA) do
if name == n then if name == n then
@ -535,6 +540,7 @@ function checkHiddenCard(name)
return false return false
end end
-- called by custom data helpers
function updateHiddenCards(args) function updateHiddenCards(args)
local custom_data_helper = getObjectFromGUID(args[1]) local custom_data_helper = getObjectFromGUID(args[1])
local data_hiddenCards = custom_data_helper.getTable("HIDDEN_CARD_DATA") local data_hiddenCards = custom_data_helper.getTable("HIDDEN_CARD_DATA")
@ -565,12 +571,6 @@ end
-- } -- }
-- }]]) -- }]])
-- deprecated, use metadata (GM Notes) instead
-- Encounter Cards with "Hidden."
-- HIDDEN_CARD_DATA = {
-- "Visions in Your Mind (Death)"
-- }
-- deprecated, included in TokenManager -- deprecated, included in TokenManager
-- PLAYER_CARD_TOKEN_OFFSETS = { -- PLAYER_CARD_TOKEN_OFFSETS = {
-- [1] = {{ 0, 3, -0.2 }} -- [1] = {{ 0, 3, -0.2 }}

View File

@ -217,7 +217,8 @@ function actualEncounterCardDraw(card, params)
local alwaysFaceUp = params[3] local alwaysFaceUp = params[3]
local faceUpRotation = 0 local faceUpRotation = 0
if not alwaysFaceUp then if not alwaysFaceUp then
if getObjectFromGUID(DATA_HELPER_GUID).call('checkHiddenCard', card.getName()) then local metadata = JSON.decode(card.getGMNotes()) or {}
if metadata.hidden or getObjectFromGUID(DATA_HELPER_GUID).call('checkHiddenCard', card.getName()) then
faceUpRotation = 180 faceUpRotation = 180
end end
end end