more fixes

This commit is contained in:
dscarpac 2024-06-24 15:52:27 -05:00
parent ed79143964
commit 956e35f5e3
3 changed files with 8 additions and 10 deletions

View File

@ -300,18 +300,19 @@ function makeButtonsToRedraw()
return return
end end
local chaosbag = findChaosBag()
local matchingTokensInPlay = {} local matchingTokensInPlay = {}
-- nil handling
redrawData.VALID_TOKENS = redrawData.VALID_TOKENS or {}
redrawData.INVALID_TOKENS = redrawData.INVALID_TOKENS or {}
-- determine if only some tokens are able to be returned to the bag -- determine if only some tokens are able to be returned to the bag
for _, token in ipairs(chaosTokens) do for _, token in ipairs(chaosTokens) do
local tokenName = getReadableTokenName(token.getName()) local tokenName = getReadableTokenName(token.getName())
-- nil handling
redrawData.VALID_TOKENS = redrawData.VALID_TOKENS or {}
redrawData.INVALID_TOKENS = redrawData.INVALID_TOKENS or {}
-- allow valid tokens or not invalid tokens, also allow any token if both lists empty -- allow valid tokens or not invalid tokens, also allow any token if both lists empty
if (redrawData.VALID_TOKENS[tokenName] and #redrawData.INVALID_TOKENS == 0) ~= nil or (isTableEmpty(redrawData.VALID_TOKENS) and not redrawData.INVALID_TOKENS[tokenName]) or if (redrawData.VALID_TOKENS[tokenName] ~= nil and isTableEmpty(redrawData.INVALID_TOKENS)) or (isTableEmpty(redrawData.VALID_TOKENS) and not redrawData.INVALID_TOKENS[tokenName]) or
(isTableEmpty(redrawData.VALID_TOKENS) and isTableEmpty(redrawData.INVALID_TOKENS)) then (isTableEmpty(redrawData.VALID_TOKENS) and isTableEmpty(redrawData.INVALID_TOKENS)) then
table.insert(matchingTokensInPlay, token) table.insert(matchingTokensInPlay, token)
end end
@ -388,9 +389,9 @@ function returnAndRedraw(_, tokenGUID)
returnChaosTokenToBag(returnedToken) returnChaosTokenToBag(returnedToken)
if redrawData.redrawnTokenType == "random" then if redrawData.redrawnTokenType == "random" then
token = drawChaosToken({mat = mat, drawAdditional = true, takeParameters = takeParameters}) chaosTokens[indexOfReturnedToken] = drawChaosToken({mat = mat, drawAdditional = true, takeParameters = takeParameters})
else else
token = drawChaosToken({mat = mat, drawAdditional = true, takeParameters = takeParameters, tokenType = redrawData.redrawnTokenType}) chaosTokens[indexOfReturnedToken] = drawChaosToken({mat = mat, drawAdditional = true, takeParameters = takeParameters, tokenType = redrawData.redrawnTokenType})
end end
chaosTokens[indexOfReturnedToken] = token chaosTokens[indexOfReturnedToken] = token

View File

@ -46,7 +46,6 @@ end
function triggerXMLTokenLabelCreation() function triggerXMLTokenLabelCreation()
-- needs to be its own function in order to pass originParams as a table -- needs to be its own function in order to pass originParams as a table
log(originParams)
Global.call("activeRedrawEffect", originParams) Global.call("activeRedrawEffect", originParams)
end end

View File

@ -7,8 +7,6 @@ buttonRotation = "0 0 90"
originParams = { originParams = {
triggeringCard = "Wendy", triggeringCard = "Wendy",
redrawnTokenType = "random", redrawnTokenType = "random",
VALID_TOKENS = {},
INVALID_TOKENS = {}
} }
require("playercards/CardsThatRedrawTokens") require("playercards/CardsThatRedrawTokens")