more updates
This commit is contained in:
parent
7f836ed2d5
commit
ed79143964
@ -285,7 +285,7 @@ function getTokenIndex(token)
|
||||
end
|
||||
|
||||
function activeRedrawEffect(originParams)
|
||||
dataFromLastReplacementEffect = originParams
|
||||
redrawData = originParams
|
||||
makeButtonsToRedraw()
|
||||
end
|
||||
|
||||
@ -302,25 +302,20 @@ function makeButtonsToRedraw()
|
||||
|
||||
local chaosbag = findChaosBag()
|
||||
local matchingTokensInPlay = {}
|
||||
|
||||
-- determine if only some tokens are able to be returned to the bag
|
||||
if dataFromLastReplacementEffect.redrawEligibilty == "ineligible" then
|
||||
-- create list of tokens that should not get an XML button
|
||||
for _, token in ipairs(chaosTokens) do
|
||||
if not dataFromLastReplacementEffect.tokenList[getReadableTokenName(token.getName())] then
|
||||
matchingTokensInPlay[#matchingTokensInPlay + 1] = token
|
||||
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
|
||||
if (redrawData.VALID_TOKENS[tokenName] and #redrawData.INVALID_TOKENS == 0) ~= nil or (isTableEmpty(redrawData.VALID_TOKENS) and not redrawData.INVALID_TOKENS[tokenName]) or
|
||||
(isTableEmpty(redrawData.VALID_TOKENS) and isTableEmpty(redrawData.INVALID_TOKENS)) then
|
||||
table.insert(matchingTokensInPlay, token)
|
||||
end
|
||||
end
|
||||
elseif dataFromLastReplacementEffect.redrawEligibilty == "eligible" then
|
||||
-- cards that dictate only some tokens are eligible for replacement
|
||||
for _, token in ipairs(chaosTokens) do
|
||||
if dataFromLastReplacementEffect.tokenList[getReadableTokenName(token.getName())] then
|
||||
matchingTokensInPlay[#matchingTokensInPlay + 1] = token
|
||||
end
|
||||
end
|
||||
else
|
||||
-- for any cards that can replace any tokens
|
||||
matchingTokensInPlay = chaosTokens
|
||||
end
|
||||
|
||||
if #matchingTokensInPlay == 0 then
|
||||
broadcastToAll("No eligible token found in play area", "Red")
|
||||
@ -392,14 +387,14 @@ function returnAndRedraw(_, tokenGUID)
|
||||
end
|
||||
|
||||
returnChaosTokenToBag(returnedToken)
|
||||
if dataFromLastReplacementEffect.redrawnTokenType == "random" then
|
||||
if redrawData.redrawnTokenType == "random" then
|
||||
token = drawChaosToken({mat = mat, drawAdditional = true, takeParameters = takeParameters})
|
||||
else
|
||||
token = drawChaosToken({mat = mat, drawAdditional = true, takeParameters = takeParameters, tokenType = dataFromLastReplacementEffect.redrawnTokenType})
|
||||
token = drawChaosToken({mat = mat, drawAdditional = true, takeParameters = takeParameters, tokenType = redrawData.redrawnTokenType})
|
||||
end
|
||||
|
||||
chaosTokens[indexOfReturnedToken] = token
|
||||
if dataFromLastReplacementEffect.triggeringCard == "FalseCovenant" then
|
||||
if redrawData.triggeringCard == "FalseCovenant" then
|
||||
blessCurseManagerApi.removeToken("Curse")
|
||||
end
|
||||
-- remove XML from tokens in play
|
||||
@ -407,8 +402,7 @@ function returnAndRedraw(_, tokenGUID)
|
||||
token.UI.setXml("")
|
||||
end
|
||||
|
||||
dataFromLastReplacementEffect = {}
|
||||
|
||||
redrawData = {}
|
||||
end
|
||||
|
||||
-- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens
|
||||
@ -510,7 +504,7 @@ function drawChaosToken(params)
|
||||
if params.takeParameters then
|
||||
return token
|
||||
else
|
||||
chaosTokens[#chaosTokens + 1] = token
|
||||
table.insert(chaosTokens, token)
|
||||
end
|
||||
else
|
||||
returnChaosTokens()
|
||||
@ -1818,3 +1812,11 @@ function removeValueFromTable(t, val)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function isTableEmpty(tbl)
|
||||
if next(tbl) == nil then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
@ -46,6 +46,7 @@ end
|
||||
|
||||
function triggerXMLTokenLabelCreation()
|
||||
-- needs to be its own function in order to pass originParams as a table
|
||||
log(originParams)
|
||||
Global.call("activeRedrawEffect", originParams)
|
||||
end
|
||||
|
||||
|
@ -5,9 +5,8 @@ buttonFontSize = 300
|
||||
|
||||
originParams = {
|
||||
triggeringCard = "ClaypoolsFurs",
|
||||
redrawEligibilty = "eligible",
|
||||
redrawnTokenType = "random",
|
||||
tokenList = {
|
||||
VALID_TOKENS = {
|
||||
["Frost"] = true
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
originParams = {
|
||||
triggeringCard = "CustomModifications",
|
||||
redrawEligibilty = "ineligible",
|
||||
redrawnTokenType = "random",
|
||||
tokenList = {
|
||||
VALID_TOKENS = {},
|
||||
INVALID_TOKENS = {
|
||||
["Auto-fail"] = true
|
||||
}
|
||||
}
|
||||
|
@ -5,9 +5,8 @@ buttonFontSize = 300
|
||||
|
||||
originParams = {
|
||||
triggeringCard = "FalseCovenant",
|
||||
redrawEligibilty = "eligible",
|
||||
redrawnTokenType = "random",
|
||||
tokenList = {
|
||||
VALID_TOKENS = {
|
||||
["Curse"] = true
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
originParams = {
|
||||
triggeringCard = "HeavyFurs",
|
||||
redrawEligibilty = "eligible",
|
||||
redrawnTokenType = "random",
|
||||
tokenList = {
|
||||
VALID_TOKENS = {
|
||||
["Skull"] = true,
|
||||
["Tablet"] = true,
|
||||
["Elder Thing"] = true,
|
||||
@ -12,7 +11,7 @@ originParams = {
|
||||
["Elder Sign"] = true,
|
||||
["Bless"] = true,
|
||||
["Curse"] = true
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
require("playercards/CardsThatRedrawTokens")
|
@ -108,9 +108,8 @@ function resolveSigil()
|
||||
|
||||
originParams = {
|
||||
triggeringCard = "Nkosi",
|
||||
redrawEligibilty = "eligible",
|
||||
redrawnTokenType = sigil,
|
||||
tokenList = {
|
||||
VALID_TOKENS = {
|
||||
["Tablet"] = true,
|
||||
["Elder Thing"] = true,
|
||||
["Cultist"] = true
|
||||
|
@ -6,8 +6,9 @@ buttonRotation = "0 0 90"
|
||||
|
||||
originParams = {
|
||||
triggeringCard = "Wendy",
|
||||
redrawEligibilty = "all",
|
||||
redrawnTokenType = "random",
|
||||
VALID_TOKENS = {},
|
||||
INVALID_TOKENS = {}
|
||||
}
|
||||
|
||||
require("playercards/CardsThatRedrawTokens")
|
Loading…
Reference in New Issue
Block a user