some updates
This commit is contained in:
parent
0f347b7574
commit
7f836ed2d5
@ -286,6 +286,7 @@ end
|
|||||||
|
|
||||||
function activeRedrawEffect(originParams)
|
function activeRedrawEffect(originParams)
|
||||||
dataFromLastReplacementEffect = originParams
|
dataFromLastReplacementEffect = originParams
|
||||||
|
makeButtonsToRedraw()
|
||||||
end
|
end
|
||||||
|
|
||||||
function makeButtonsToRedraw()
|
function makeButtonsToRedraw()
|
||||||
@ -294,8 +295,7 @@ function makeButtonsToRedraw()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local tokensInPlay = getChaosTokensinPlay()
|
if #chaosTokens == 0 then
|
||||||
if #tokensInPlay == 0 then
|
|
||||||
broadcastToAll("No tokens found in play area", "Red")
|
broadcastToAll("No tokens found in play area", "Red")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -305,21 +305,21 @@ function makeButtonsToRedraw()
|
|||||||
-- 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
|
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(chaosTokens) do
|
||||||
if string.find(dataFromLastReplacementEffect.tokenList, token.getName(), 1, true) == nil then
|
if not dataFromLastReplacementEffect.tokenList[getReadableTokenName(token.getName())] then
|
||||||
matchingTokensInPlay[#matchingTokensInPlay + 1] = token
|
matchingTokensInPlay[#matchingTokensInPlay + 1] = token
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif dataFromLastReplacementEffect.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(chaosTokens) do
|
||||||
if string.find(dataFromLastReplacementEffect.tokenList, token.getName()) then
|
if dataFromLastReplacementEffect.tokenList[getReadableTokenName(token.getName())] then
|
||||||
matchingTokensInPlay[#matchingTokensInPlay + 1] = token
|
matchingTokensInPlay[#matchingTokensInPlay + 1] = token
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- for any cards that can replace any tokens
|
-- for any cards that can replace any tokens
|
||||||
matchingTokensInPlay = tokensInPlay
|
matchingTokensInPlay = chaosTokens
|
||||||
end
|
end
|
||||||
|
|
||||||
if #matchingTokensInPlay == 0 then
|
if #matchingTokensInPlay == 0 then
|
||||||
@ -375,7 +375,6 @@ function makeButtonsToRedraw()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function returnAndRedraw(_, tokenGUID)
|
function returnAndRedraw(_, tokenGUID)
|
||||||
local indexOfReturnedToken
|
|
||||||
local takeParameters = {}
|
local takeParameters = {}
|
||||||
local returnedToken = getObjectFromGUID(tokenGUID)
|
local returnedToken = getObjectFromGUID(tokenGUID)
|
||||||
local matColor = playmatApi.getMatColorByPosition(returnedToken.getPosition())
|
local matColor = playmatApi.getMatColorByPosition(returnedToken.getPosition())
|
||||||
@ -383,7 +382,7 @@ function returnAndRedraw(_, tokenGUID)
|
|||||||
|
|
||||||
isTokenXMLActive = false
|
isTokenXMLActive = false
|
||||||
trackChaosToken(returnedToken.getName(), mat.getGUID(), true)
|
trackChaosToken(returnedToken.getName(), mat.getGUID(), true)
|
||||||
indexOfReturnedToken = getTokenIndex(returnedToken)
|
local indexOfReturnedToken = getTokenIndex(returnedToken)
|
||||||
takeParameters.position = returnedToken.getPosition()
|
takeParameters.position = returnedToken.getPosition()
|
||||||
|
|
||||||
if #chaosTokens > indexOfReturnedToken then
|
if #chaosTokens > indexOfReturnedToken then
|
||||||
@ -400,7 +399,7 @@ function returnAndRedraw(_, tokenGUID)
|
|||||||
end
|
end
|
||||||
|
|
||||||
chaosTokens[indexOfReturnedToken] = token
|
chaosTokens[indexOfReturnedToken] = token
|
||||||
if triggeringCard == "FalseCovenant" then
|
if dataFromLastReplacementEffect.triggeringCard == "FalseCovenant" then
|
||||||
blessCurseManagerApi.removeToken("Curse")
|
blessCurseManagerApi.removeToken("Curse")
|
||||||
end
|
end
|
||||||
-- remove XML from tokens in play
|
-- remove XML from tokens in play
|
||||||
@ -463,8 +462,8 @@ function drawChaosToken(params)
|
|||||||
if params.drawAdditional or #chaosTokens == 0 then
|
if params.drawAdditional or #chaosTokens == 0 then
|
||||||
local chaosBag = findChaosBag()
|
local chaosBag = findChaosBag()
|
||||||
if #chaosBag.getObjects() == 0 then return end
|
if #chaosBag.getObjects() == 0 then return end
|
||||||
|
chaosBag.shuffle()
|
||||||
|
|
||||||
local indexOfReturnedToken
|
|
||||||
local takeParameters = {}
|
local takeParameters = {}
|
||||||
|
|
||||||
-- add the token to the list, compute new position based on list length
|
-- 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()
|
takeParameters.rotation = params.mat.getRotation()
|
||||||
end
|
end
|
||||||
|
|
||||||
chaosBag.shuffle()
|
|
||||||
local token
|
local token
|
||||||
|
|
||||||
if params.guidToBeResolved then
|
if params.guidToBeResolved then
|
||||||
|
@ -11,8 +11,6 @@ function onLoad(savedData)
|
|||||||
turnOnHelper = JSON.decode(savedData)
|
turnOnHelper = JSON.decode(savedData)
|
||||||
if turnOnHelper == true then
|
if turnOnHelper == true then
|
||||||
makeXMLButton()
|
makeXMLButton()
|
||||||
self.clearContextMenu()
|
|
||||||
self.addContextMenuItem("Clear Helper", deleteButton)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -21,35 +19,34 @@ function makeXMLButton()
|
|||||||
turnOnHelper = true
|
turnOnHelper = true
|
||||||
self.clearContextMenu()
|
self.clearContextMenu()
|
||||||
self.addContextMenuItem("Clear Helper", deleteButton)
|
self.addContextMenuItem("Clear Helper", deleteButton)
|
||||||
log(color)
|
|
||||||
local xmlTable = {{
|
local xmlTable = {{
|
||||||
tag = "Button",
|
tag = "Button",
|
||||||
attributes = {
|
attributes = {
|
||||||
height = 450,
|
height = buttonHeight or 450,
|
||||||
width = 1400,
|
width = buttonWidth or 1400,
|
||||||
rotation = rotation or "0 0 180",
|
rotation = buttonRotation or "0 0 180",
|
||||||
scale = "0.1 0.1 1",
|
scale = "0.1 0.1 1",
|
||||||
position = position or "0 -55 -22",
|
position = buttonPosition or "0 -55 -22",
|
||||||
padding = "50 50 50 50",
|
padding = "50 50 50 50",
|
||||||
font = "font_teutonic-arkham",
|
font = "font_teutonic-arkham",
|
||||||
fontSize = fontSize or 250,
|
fontSize = buttonFontSize or 250,
|
||||||
onClick = "triggerXMLTokenLabelCreation()",
|
onClick = "triggerXMLTokenLabelCreation()",
|
||||||
color = color or "#77674DE6",
|
color = buttonColor or "#77674DE6",
|
||||||
textColor = "White"
|
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.iconWidth = "400"
|
||||||
xmlTable[1].attributes.iconAlignment = "Right"
|
xmlTable[1].attributes.iconAlignment = "Right"
|
||||||
xmlTable[1].attributes.icon = icon
|
xmlTable[1].attributes.icon = buttonIcon
|
||||||
end
|
end
|
||||||
self.UI.setXmlTable(xmlTable)
|
self.UI.setXmlTable(xmlTable)
|
||||||
end
|
end
|
||||||
|
|
||||||
function triggerXMLTokenLabelCreation()
|
function triggerXMLTokenLabelCreation()
|
||||||
Global.call("activeRedrawEffect", originParams)
|
-- needs to be its own function in order to pass originParams as a table
|
||||||
Global.call("makeButtonsToRedraw")
|
Global.call("activeRedrawEffect", originParams)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Delete button
|
-- Delete button
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
value = "Cancel"
|
buttonValue = "Cancel"
|
||||||
icon = "token-frost"
|
buttonIcon = "token-frost"
|
||||||
color = "#404450E6"
|
buttonColor = "#404450E6"
|
||||||
fontSize = 300
|
buttonFontSize = 300
|
||||||
|
|
||||||
originParams = {
|
originParams = {
|
||||||
triggeringCard = "ClaypoolsFurs",
|
triggeringCard = "ClaypoolsFurs",
|
||||||
redrawEligibilty = "eligible",
|
redrawEligibilty = "eligible",
|
||||||
redrawnTokenType = "random",
|
redrawnTokenType = "random",
|
||||||
tokenList = "Frost"
|
tokenList = {
|
||||||
|
["Frost"] = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
require("playercards/CardsThatRedrawTokens")
|
require("playercards/CardsThatRedrawTokens")
|
@ -2,7 +2,9 @@ originParams = {
|
|||||||
triggeringCard = "CustomModifications",
|
triggeringCard = "CustomModifications",
|
||||||
redrawEligibilty = "ineligible",
|
redrawEligibilty = "ineligible",
|
||||||
redrawnTokenType = "random",
|
redrawnTokenType = "random",
|
||||||
tokenList = "Auto-fail"
|
tokenList = {
|
||||||
|
["Auto-fail"] = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
require("playercards/CardsThatRedrawTokens")
|
require("playercards/CardsThatRedrawTokens")
|
@ -1,13 +1,15 @@
|
|||||||
value = "Cancel"
|
buttonValue = "Cancel"
|
||||||
icon = "token-curse"
|
buttonIcon = "token-curse"
|
||||||
color = "#633A84E6"
|
buttonColor = "#633A84E6"
|
||||||
fontSize = 300
|
buttonFontSize = 300
|
||||||
|
|
||||||
originParams = {
|
originParams = {
|
||||||
triggeringCard = "FalseCovenant",
|
triggeringCard = "FalseCovenant",
|
||||||
redrawEligibilty = "eligible",
|
redrawEligibilty = "eligible",
|
||||||
redrawnTokenType = "random",
|
redrawnTokenType = "random",
|
||||||
tokenList = "Curse"
|
tokenList = {
|
||||||
|
["Curse"] = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
require("playercards/CardsThatRedrawTokens")
|
require("playercards/CardsThatRedrawTokens")
|
@ -2,7 +2,17 @@ originParams = {
|
|||||||
triggeringCard = "HeavyFurs",
|
triggeringCard = "HeavyFurs",
|
||||||
redrawEligibilty = "eligible",
|
redrawEligibilty = "eligible",
|
||||||
redrawnTokenType = "random",
|
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")
|
require("playercards/CardsThatRedrawTokens")
|
@ -50,7 +50,6 @@ function makeXMLButton()
|
|||||||
iconWidth = "400",
|
iconWidth = "400",
|
||||||
iconAlignment = "Right",
|
iconAlignment = "Right",
|
||||||
onClick = "resolveSigil",
|
onClick = "resolveSigil",
|
||||||
id = eligible,
|
|
||||||
icon = iconName,
|
icon = iconName,
|
||||||
color = tokenColor[sigil],
|
color = tokenColor[sigil],
|
||||||
textColor = "White"
|
textColor = "White"
|
||||||
@ -111,8 +110,11 @@ function resolveSigil()
|
|||||||
triggeringCard = "Nkosi",
|
triggeringCard = "Nkosi",
|
||||||
redrawEligibilty = "eligible",
|
redrawEligibilty = "eligible",
|
||||||
redrawnTokenType = sigil,
|
redrawnTokenType = sigil,
|
||||||
tokenList = "Tablet|Elder Thing|Cultist"
|
tokenList = {
|
||||||
|
["Tablet"] = true,
|
||||||
|
["Elder Thing"] = true,
|
||||||
|
["Cultist"] = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Global.call("activeRedrawEffect", originParams)
|
Global.call("activeRedrawEffect", originParams)
|
||||||
Global.call("makeButtonsToRedraw")
|
|
||||||
end
|
end
|
@ -1,12 +1,13 @@
|
|||||||
position = "70 -70 -22"
|
buttonHeight = "320"
|
||||||
fontSize = 200
|
buttonWidth = "1100"
|
||||||
rotation = "0 0 90"
|
buttonPosition = "70 -70 -22"
|
||||||
|
buttonFontSize = 200
|
||||||
|
buttonRotation = "0 0 90"
|
||||||
|
|
||||||
originParams = {
|
originParams = {
|
||||||
triggeringCard = "Wendy",
|
triggeringCard = "Wendy",
|
||||||
redrawEligibilty = "all",
|
redrawEligibilty = "all",
|
||||||
redrawnTokenType = "random",
|
redrawnTokenType = "random",
|
||||||
tokenList = "all"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
require("playercards/CardsThatRedrawTokens")
|
require("playercards/CardsThatRedrawTokens")
|
Loading…
x
Reference in New Issue
Block a user