more updates
This commit is contained in:
parent
7f836ed2d5
commit
ed79143964
@ -285,7 +285,7 @@ function getTokenIndex(token)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function activeRedrawEffect(originParams)
|
function activeRedrawEffect(originParams)
|
||||||
dataFromLastReplacementEffect = originParams
|
redrawData = originParams
|
||||||
makeButtonsToRedraw()
|
makeButtonsToRedraw()
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -302,24 +302,19 @@ 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 dataFromLastReplacementEffect.redrawEligibilty == "ineligible" then
|
for _, token in ipairs(chaosTokens) do
|
||||||
-- create list of tokens that should not get an XML button
|
local tokenName = getReadableTokenName(token.getName())
|
||||||
for _, token in ipairs(chaosTokens) do
|
-- nil handling
|
||||||
if not dataFromLastReplacementEffect.tokenList[getReadableTokenName(token.getName())] then
|
redrawData.VALID_TOKENS = redrawData.VALID_TOKENS or {}
|
||||||
matchingTokensInPlay[#matchingTokensInPlay + 1] = token
|
redrawData.INVALID_TOKENS = redrawData.INVALID_TOKENS or {}
|
||||||
end
|
|
||||||
|
-- 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
|
end
|
||||||
|
|
||||||
if #matchingTokensInPlay == 0 then
|
if #matchingTokensInPlay == 0 then
|
||||||
@ -392,14 +387,14 @@ function returnAndRedraw(_, tokenGUID)
|
|||||||
end
|
end
|
||||||
|
|
||||||
returnChaosTokenToBag(returnedToken)
|
returnChaosTokenToBag(returnedToken)
|
||||||
if dataFromLastReplacementEffect.redrawnTokenType == "random" then
|
if redrawData.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 = dataFromLastReplacementEffect.redrawnTokenType})
|
token = drawChaosToken({mat = mat, drawAdditional = true, takeParameters = takeParameters, tokenType = redrawData.redrawnTokenType})
|
||||||
end
|
end
|
||||||
|
|
||||||
chaosTokens[indexOfReturnedToken] = token
|
chaosTokens[indexOfReturnedToken] = token
|
||||||
if dataFromLastReplacementEffect.triggeringCard == "FalseCovenant" then
|
if redrawData.triggeringCard == "FalseCovenant" then
|
||||||
blessCurseManagerApi.removeToken("Curse")
|
blessCurseManagerApi.removeToken("Curse")
|
||||||
end
|
end
|
||||||
-- remove XML from tokens in play
|
-- remove XML from tokens in play
|
||||||
@ -407,8 +402,7 @@ function returnAndRedraw(_, tokenGUID)
|
|||||||
token.UI.setXml("")
|
token.UI.setXml("")
|
||||||
end
|
end
|
||||||
|
|
||||||
dataFromLastReplacementEffect = {}
|
redrawData = {}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens
|
-- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens
|
||||||
@ -509,8 +503,8 @@ function drawChaosToken(params)
|
|||||||
|
|
||||||
if params.takeParameters then
|
if params.takeParameters then
|
||||||
return token
|
return token
|
||||||
else
|
else
|
||||||
chaosTokens[#chaosTokens + 1] = token
|
table.insert(chaosTokens, token)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
returnChaosTokens()
|
returnChaosTokens()
|
||||||
@ -1818,3 +1812,11 @@ function removeValueFromTable(t, val)
|
|||||||
end
|
end
|
||||||
end
|
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()
|
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
|
||||||
|
|
||||||
|
@ -5,9 +5,8 @@ buttonFontSize = 300
|
|||||||
|
|
||||||
originParams = {
|
originParams = {
|
||||||
triggeringCard = "ClaypoolsFurs",
|
triggeringCard = "ClaypoolsFurs",
|
||||||
redrawEligibilty = "eligible",
|
|
||||||
redrawnTokenType = "random",
|
redrawnTokenType = "random",
|
||||||
tokenList = {
|
VALID_TOKENS = {
|
||||||
["Frost"] = true
|
["Frost"] = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
originParams = {
|
originParams = {
|
||||||
triggeringCard = "CustomModifications",
|
triggeringCard = "CustomModifications",
|
||||||
redrawEligibilty = "ineligible",
|
|
||||||
redrawnTokenType = "random",
|
redrawnTokenType = "random",
|
||||||
tokenList = {
|
VALID_TOKENS = {},
|
||||||
|
INVALID_TOKENS = {
|
||||||
["Auto-fail"] = true
|
["Auto-fail"] = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,8 @@ buttonFontSize = 300
|
|||||||
|
|
||||||
originParams = {
|
originParams = {
|
||||||
triggeringCard = "FalseCovenant",
|
triggeringCard = "FalseCovenant",
|
||||||
redrawEligibilty = "eligible",
|
|
||||||
redrawnTokenType = "random",
|
redrawnTokenType = "random",
|
||||||
tokenList = {
|
VALID_TOKENS = {
|
||||||
["Curse"] = true
|
["Curse"] = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
originParams = {
|
originParams = {
|
||||||
triggeringCard = "HeavyFurs",
|
triggeringCard = "HeavyFurs",
|
||||||
redrawEligibilty = "eligible",
|
|
||||||
redrawnTokenType = "random",
|
redrawnTokenType = "random",
|
||||||
tokenList = {
|
VALID_TOKENS = {
|
||||||
["Skull"] = true,
|
["Skull"] = true,
|
||||||
["Tablet"] = true,
|
["Tablet"] = true,
|
||||||
["Elder Thing"] = true,
|
["Elder Thing"] = true,
|
||||||
@ -12,7 +11,7 @@ originParams = {
|
|||||||
["Elder Sign"] = true,
|
["Elder Sign"] = true,
|
||||||
["Bless"] = true,
|
["Bless"] = true,
|
||||||
["Curse"] = true
|
["Curse"] = true
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
require("playercards/CardsThatRedrawTokens")
|
require("playercards/CardsThatRedrawTokens")
|
@ -108,9 +108,8 @@ function resolveSigil()
|
|||||||
|
|
||||||
originParams = {
|
originParams = {
|
||||||
triggeringCard = "Nkosi",
|
triggeringCard = "Nkosi",
|
||||||
redrawEligibilty = "eligible",
|
|
||||||
redrawnTokenType = sigil,
|
redrawnTokenType = sigil,
|
||||||
tokenList = {
|
VALID_TOKENS = {
|
||||||
["Tablet"] = true,
|
["Tablet"] = true,
|
||||||
["Elder Thing"] = true,
|
["Elder Thing"] = true,
|
||||||
["Cultist"] = true
|
["Cultist"] = true
|
||||||
|
@ -6,8 +6,9 @@ buttonRotation = "0 0 90"
|
|||||||
|
|
||||||
originParams = {
|
originParams = {
|
||||||
triggeringCard = "Wendy",
|
triggeringCard = "Wendy",
|
||||||
redrawEligibilty = "all",
|
|
||||||
redrawnTokenType = "random",
|
redrawnTokenType = "random",
|
||||||
|
VALID_TOKENS = {},
|
||||||
|
INVALID_TOKENS = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
require("playercards/CardsThatRedrawTokens")
|
require("playercards/CardsThatRedrawTokens")
|
Loading…
Reference in New Issue
Block a user