some updates

This commit is contained in:
dscarpac 2024-06-24 10:04:09 -05:00
parent 0f347b7574
commit 7f836ed2d5
8 changed files with 59 additions and 45 deletions

View File

@ -286,6 +286,7 @@ end
function activeRedrawEffect(originParams)
dataFromLastReplacementEffect = originParams
makeButtonsToRedraw()
end
function makeButtonsToRedraw()
@ -294,8 +295,7 @@ function makeButtonsToRedraw()
return
end
local tokensInPlay = getChaosTokensinPlay()
if #tokensInPlay == 0 then
if #chaosTokens == 0 then
broadcastToAll("No tokens found in play area", "Red")
return
end
@ -305,21 +305,21 @@ function makeButtonsToRedraw()
-- 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(tokensInPlay) do
if string.find(dataFromLastReplacementEffect.tokenList, token.getName(), 1, true) == nil then
for _, token in ipairs(chaosTokens) do
if not dataFromLastReplacementEffect.tokenList[getReadableTokenName(token.getName())] then
matchingTokensInPlay[#matchingTokensInPlay + 1] = token
end
end
elseif dataFromLastReplacementEffect.redrawEligibilty == "eligible" then
-- cards that dictate only some tokens are eligible for replacement
for _, token in ipairs(tokensInPlay) do
if string.find(dataFromLastReplacementEffect.tokenList, token.getName()) then
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 = tokensInPlay
matchingTokensInPlay = chaosTokens
end
if #matchingTokensInPlay == 0 then
@ -375,7 +375,6 @@ function makeButtonsToRedraw()
end
function returnAndRedraw(_, tokenGUID)
local indexOfReturnedToken
local takeParameters = {}
local returnedToken = getObjectFromGUID(tokenGUID)
local matColor = playmatApi.getMatColorByPosition(returnedToken.getPosition())
@ -383,7 +382,7 @@ function returnAndRedraw(_, tokenGUID)
isTokenXMLActive = false
trackChaosToken(returnedToken.getName(), mat.getGUID(), true)
indexOfReturnedToken = getTokenIndex(returnedToken)
local indexOfReturnedToken = getTokenIndex(returnedToken)
takeParameters.position = returnedToken.getPosition()
if #chaosTokens > indexOfReturnedToken then
@ -400,7 +399,7 @@ function returnAndRedraw(_, tokenGUID)
end
chaosTokens[indexOfReturnedToken] = token
if triggeringCard == "FalseCovenant" then
if dataFromLastReplacementEffect.triggeringCard == "FalseCovenant" then
blessCurseManagerApi.removeToken("Curse")
end
-- remove XML from tokens in play
@ -463,8 +462,8 @@ function drawChaosToken(params)
if params.drawAdditional or #chaosTokens == 0 then
local chaosBag = findChaosBag()
if #chaosBag.getObjects() == 0 then return end
chaosBag.shuffle()
local indexOfReturnedToken
local takeParameters = {}
-- add the token to the list, compute new position based on list length
@ -477,7 +476,6 @@ function drawChaosToken(params)
takeParameters.rotation = params.mat.getRotation()
end
chaosBag.shuffle()
local token
if params.guidToBeResolved then

View File

@ -11,8 +11,6 @@ function onLoad(savedData)
turnOnHelper = JSON.decode(savedData)
if turnOnHelper == true then
makeXMLButton()
self.clearContextMenu()
self.addContextMenuItem("Clear Helper", deleteButton)
end
end
end
@ -21,35 +19,34 @@ function makeXMLButton()
turnOnHelper = true
self.clearContextMenu()
self.addContextMenuItem("Clear Helper", deleteButton)
log(color)
local xmlTable = {{
tag = "Button",
attributes = {
height = 450,
width = 1400,
rotation = rotation or "0 0 180",
height = buttonHeight or 450,
width = buttonWidth or 1400,
rotation = buttonRotation or "0 0 180",
scale = "0.1 0.1 1",
position = position or "0 -55 -22",
position = buttonPosition or "0 -55 -22",
padding = "50 50 50 50",
font = "font_teutonic-arkham",
fontSize = fontSize or 250,
fontSize = buttonFontSize or 250,
onClick = "triggerXMLTokenLabelCreation()",
color = color or "#77674DE6",
color = buttonColor or "#77674DE6",
textColor = "White"
},
value = value or "Redraw Token"
value = buttonValue or "Redraw Token"
}}
if icon then
if buttonIcon then
xmlTable[1].attributes.iconWidth = "400"
xmlTable[1].attributes.iconAlignment = "Right"
xmlTable[1].attributes.icon = icon
xmlTable[1].attributes.icon = buttonIcon
end
self.UI.setXmlTable(xmlTable)
end
function triggerXMLTokenLabelCreation()
Global.call("activeRedrawEffect", originParams)
Global.call("makeButtonsToRedraw")
-- needs to be its own function in order to pass originParams as a table
Global.call("activeRedrawEffect", originParams)
end
-- Delete button

View File

@ -1,13 +1,15 @@
value = "Cancel"
icon = "token-frost"
color = "#404450E6"
fontSize = 300
buttonValue = "Cancel"
buttonIcon = "token-frost"
buttonColor = "#404450E6"
buttonFontSize = 300
originParams = {
triggeringCard = "ClaypoolsFurs",
redrawEligibilty = "eligible",
redrawnTokenType = "random",
tokenList = "Frost"
tokenList = {
["Frost"] = true
}
}
require("playercards/CardsThatRedrawTokens")

View File

@ -2,7 +2,9 @@ originParams = {
triggeringCard = "CustomModifications",
redrawEligibilty = "ineligible",
redrawnTokenType = "random",
tokenList = "Auto-fail"
tokenList = {
["Auto-fail"] = true
}
}
require("playercards/CardsThatRedrawTokens")

View File

@ -1,13 +1,15 @@
value = "Cancel"
icon = "token-curse"
color = "#633A84E6"
fontSize = 300
buttonValue = "Cancel"
buttonIcon = "token-curse"
buttonColor = "#633A84E6"
buttonFontSize = 300
originParams = {
triggeringCard = "FalseCovenant",
redrawEligibilty = "eligible",
redrawnTokenType = "random",
tokenList = "Curse"
tokenList = {
["Curse"] = true
}
}
require("playercards/CardsThatRedrawTokens")

View File

@ -2,7 +2,17 @@ originParams = {
triggeringCard = "HeavyFurs",
redrawEligibilty = "eligible",
redrawnTokenType = "random",
tokenList = "Skull|Tablet|Elder Thing|Cultist|Frost|Custom Token|Elder Sign|Bless|Curse"
tokenList = {
["Skull"] = true,
["Tablet"] = true,
["Elder Thing"] = true,
["Cultist"] = true,
["Frost"] = true,
["Custom Token"] = true,
["Elder Sign"] = true,
["Bless"] = true,
["Curse"] = true
}
}
require("playercards/CardsThatRedrawTokens")

View File

@ -50,7 +50,6 @@ function makeXMLButton()
iconWidth = "400",
iconAlignment = "Right",
onClick = "resolveSigil",
id = eligible,
icon = iconName,
color = tokenColor[sigil],
textColor = "White"
@ -111,8 +110,11 @@ function resolveSigil()
triggeringCard = "Nkosi",
redrawEligibilty = "eligible",
redrawnTokenType = sigil,
tokenList = "Tablet|Elder Thing|Cultist"
tokenList = {
["Tablet"] = true,
["Elder Thing"] = true,
["Cultist"] = true
}
}
Global.call("activeRedrawEffect", originParams)
Global.call("makeButtonsToRedraw")
end

View File

@ -1,12 +1,13 @@
position = "70 -70 -22"
fontSize = 200
rotation = "0 0 90"
buttonHeight = "320"
buttonWidth = "1100"
buttonPosition = "70 -70 -22"
buttonFontSize = 200
buttonRotation = "0 0 90"
originParams = {
triggeringCard = "Wendy",
redrawEligibilty = "all",
redrawnTokenType = "random",
tokenList = "all"
}
require("playercards/CardsThatRedrawTokens")