collapsed originParams into table in Global

This commit is contained in:
dscarpac 2024-06-23 16:56:21 -05:00
parent 99605b049a
commit 0f347b7574

View File

@ -285,14 +285,11 @@ function getTokenIndex(token)
end end
function activeRedrawEffect(originParams) function activeRedrawEffect(originParams)
triggeringCard = originParams.triggeringCard dataFromLastReplacementEffect = originParams
redrawEligibilty = originParams.redrawEligibilty
redrawnTokenType = originParams.redrawnTokenType
tokenList = originParams.tokenList
end end
function makeButtonsToRedraw() function makeButtonsToRedraw()
if isTokenXMLActive == true then if isTokenXMLActive == true then
broadcastToAll("Clear already active buttons first, then try again", "Red") broadcastToAll("Clear already active buttons first, then try again", "Red")
return return
end end
@ -306,17 +303,17 @@ function makeButtonsToRedraw()
local chaosbag = findChaosBag() local chaosbag = findChaosBag()
local matchingTokensInPlay = {} local matchingTokensInPlay = {}
-- 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
if redrawEligibilty == "ineligible" then if dataFromLastReplacementEffect.redrawEligibilty == "ineligible" then
-- create list of tokens that should not get an XML button -- create list of tokens that should not get an XML button
for _, token in ipairs(tokensInPlay) do for _, token in ipairs(tokensInPlay) do
if string.find(tokenList, token.getName(), 1, true) == nil then if string.find(dataFromLastReplacementEffect.tokenList, token.getName(), 1, true) == nil then
matchingTokensInPlay[#matchingTokensInPlay + 1] = token matchingTokensInPlay[#matchingTokensInPlay + 1] = token
end end
end end
elseif redrawEligibilty == "eligible" then elseif dataFromLastReplacementEffect.redrawEligibilty == "eligible" then
-- cards that dictate only some tokens are eligible for replacement -- cards that dictate only some tokens are eligible for replacement
for _, token in ipairs(tokensInPlay) do for _, token in ipairs(tokensInPlay) do
if string.find(tokenList, token.getName()) then if string.find(dataFromLastReplacementEffect.tokenList, token.getName()) then
matchingTokensInPlay[#matchingTokensInPlay + 1] = token matchingTokensInPlay[#matchingTokensInPlay + 1] = token
end end
end end
@ -396,10 +393,10 @@ function returnAndRedraw(_, tokenGUID)
end end
returnChaosTokenToBag(returnedToken) returnChaosTokenToBag(returnedToken)
if redrawnTokenType == "random" then if dataFromLastReplacementEffect.redrawnTokenType == "random" then
token = drawChaosToken({mat = mat, drawAdditional = true, takeParameters = takeParameters}) token = drawChaosToken({mat = mat, drawAdditional = true, takeParameters = takeParameters})
else else
token = drawChaosToken({mat = mat, drawAdditional = true, takeParameters = takeParameters, tokenType = redrawnTokenType}) token = drawChaosToken({mat = mat, drawAdditional = true, takeParameters = takeParameters, tokenType = dataFromLastReplacementEffect.redrawnTokenType})
end end
chaosTokens[indexOfReturnedToken] = token chaosTokens[indexOfReturnedToken] = token
@ -411,10 +408,7 @@ function returnAndRedraw(_, tokenGUID)
token.UI.setXml("") token.UI.setXml("")
end end
triggeringCard = nil dataFromLastReplacementEffect = {}
redrawEligibilty = nil
redrawnTokenType = nil
tokenList = nil
end end