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,10 +285,7 @@ function getTokenIndex(token)
end
function activeRedrawEffect(originParams)
triggeringCard = originParams.triggeringCard
redrawEligibilty = originParams.redrawEligibilty
redrawnTokenType = originParams.redrawnTokenType
tokenList = originParams.tokenList
dataFromLastReplacementEffect = originParams
end
function makeButtonsToRedraw()
@ -306,17 +303,17 @@ function makeButtonsToRedraw()
local chaosbag = findChaosBag()
local matchingTokensInPlay = {}
-- 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
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
end
end
elseif redrawEligibilty == "eligible" then
elseif dataFromLastReplacementEffect.redrawEligibilty == "eligible" then
-- cards that dictate only some tokens are eligible for replacement
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
end
end
@ -396,10 +393,10 @@ function returnAndRedraw(_, tokenGUID)
end
returnChaosTokenToBag(returnedToken)
if redrawnTokenType == "random" then
if dataFromLastReplacementEffect.redrawnTokenType == "random" then
token = drawChaosToken({mat = mat, drawAdditional = true, takeParameters = takeParameters})
else
token = drawChaosToken({mat = mat, drawAdditional = true, takeParameters = takeParameters, tokenType = redrawnTokenType})
token = drawChaosToken({mat = mat, drawAdditional = true, takeParameters = takeParameters, tokenType = dataFromLastReplacementEffect.redrawnTokenType})
end
chaosTokens[indexOfReturnedToken] = token
@ -411,10 +408,7 @@ function returnAndRedraw(_, tokenGUID)
token.UI.setXml("")
end
triggeringCard = nil
redrawEligibilty = nil
redrawnTokenType = nil
tokenList = nil
dataFromLastReplacementEffect = {}
end