Merge branch 'main' into token-stack
This commit is contained in:
commit
6fa0baac86
@ -33,7 +33,7 @@
|
|||||||
"IgnoreFoW": false,
|
"IgnoreFoW": false,
|
||||||
"LayoutGroupSortIndex": 0,
|
"LayoutGroupSortIndex": 0,
|
||||||
"Locked": false,
|
"Locked": false,
|
||||||
"LuaScript": "",
|
"LuaScript": "require(\"playercards/cards/Analysis\")",
|
||||||
"LuaScriptState": "",
|
"LuaScriptState": "",
|
||||||
"MeasureMovement": false,
|
"MeasureMovement": false,
|
||||||
"Name": "Card",
|
"Name": "Card",
|
||||||
|
@ -58,5 +58,5 @@
|
|||||||
"scaleZ": 1
|
"scaleZ": 1
|
||||||
},
|
},
|
||||||
"Value": 0,
|
"Value": 0,
|
||||||
"XmlUI": ""
|
"XmlUI": "\u003cInclude src=\"playercards/FamilyInheritance.xml\"/\u003e"
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
"IgnoreFoW": false,
|
"IgnoreFoW": false,
|
||||||
"LayoutGroupSortIndex": 0,
|
"LayoutGroupSortIndex": 0,
|
||||||
"Locked": false,
|
"Locked": false,
|
||||||
"LuaScript": "",
|
"LuaScript": "require(\"playercards/cards/Strong-Armed\")",
|
||||||
"LuaScriptState": "",
|
"LuaScriptState": "",
|
||||||
"MeasureMovement": false,
|
"MeasureMovement": false,
|
||||||
"Name": "Card",
|
"Name": "Card",
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
"IgnoreFoW": false,
|
"IgnoreFoW": false,
|
||||||
"LayoutGroupSortIndex": 0,
|
"LayoutGroupSortIndex": 0,
|
||||||
"Locked": false,
|
"Locked": false,
|
||||||
"LuaScript": "",
|
"LuaScript": "require(\"playercards/cards/ThirdTimesaCharm\")",
|
||||||
"LuaScriptState": "",
|
"LuaScriptState": "",
|
||||||
"MeasureMovement": false,
|
"MeasureMovement": false,
|
||||||
"Name": "Card",
|
"Name": "Card",
|
||||||
|
@ -1 +1 @@
|
|||||||
{"acknowledgedUpgradeVersions":[],"chaosTokensGUID":[],"optionPanel":{"cardLanguage":"en","changePlayAreaImage":false,"enableCardHelpers":false,"playAreaConnectionColor":{"a":1,"b":0.4,"g":0.4,"r":0.4},"playAreaConnections":true,"playAreaSnapTags":true,"showAttachmentHelper":false,"showCleanUpHelper":false,"showCYOA":false,"showDisplacementTool":false,"showDrawButton":false,"showHandHelper":false,"showSearchAssistant":false,"showTitleSplash":true,"useClassTexture":true,"useClueClickers":false,"useResourceCounters":"disabled","useSnapTags":true}}
|
{"acknowledgedUpgradeVersions":[],"chaosTokensGUID":[],"optionPanel":{"cardLanguage":"en","changePlayAreaImage":false,"enableCardHelpers":true,"playAreaConnectionColor":{"a":1,"b":0.4,"g":0.4,"r":0.4},"playAreaConnections":true,"playAreaSnapTags":true,"showAttachmentHelper":false,"showCleanUpHelper":false,"showCYOA":false,"showDisplacementTool":false,"showDrawButton":false,"showHandHelper":false,"showSearchAssistant":false,"showTitleSplash":true,"useClassTexture":true,"useClueClickers":false,"useResourceCounters":"disabled","useSnapTags":true}}
|
||||||
|
@ -4,6 +4,7 @@ local searchLib = require("util/SearchLib")
|
|||||||
|
|
||||||
-- forward declaration of variables that are used across functions
|
-- forward declaration of variables that are used across functions
|
||||||
local matColor, handColor, setAsidePosition, setAsideRotation, drawDeckPosition, topCardDetected
|
local matColor, handColor, setAsidePosition, setAsideRotation, drawDeckPosition, topCardDetected
|
||||||
|
local addedVectorLines, addedSnapPoint
|
||||||
|
|
||||||
local quickParameters = {}
|
local quickParameters = {}
|
||||||
quickParameters.function_owner = self
|
quickParameters.function_owner = self
|
||||||
@ -34,6 +35,7 @@ inputParameters.validation = 2
|
|||||||
|
|
||||||
function onLoad()
|
function onLoad()
|
||||||
normalView()
|
normalView()
|
||||||
|
self.max_typed_number = 9999
|
||||||
end
|
end
|
||||||
|
|
||||||
-- regular view with search box
|
-- regular view with search box
|
||||||
@ -89,6 +91,10 @@ function updateSearchNumber(_, _, input)
|
|||||||
inputParameters.value = tonumber(input)
|
inputParameters.value = tonumber(input)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function onNumberTyped(playerColor, number)
|
||||||
|
startSearch(playerColor, number)
|
||||||
|
end
|
||||||
|
|
||||||
-- starts the search with the number from the input field
|
-- starts the search with the number from the input field
|
||||||
function searchCustom(_, messageColor)
|
function searchCustom(_, messageColor)
|
||||||
local number = inputParameters.value
|
local number = inputParameters.value
|
||||||
@ -115,7 +121,7 @@ function startSearch(messageColor, number)
|
|||||||
-- get bounds to know the height of the deck
|
-- get bounds to know the height of the deck
|
||||||
local bounds = deckAreaObjects.draw.getBounds()
|
local bounds = deckAreaObjects.draw.getBounds()
|
||||||
drawDeckPosition = bounds.center + Vector(0, bounds.size.y / 2 + 0.2, 0)
|
drawDeckPosition = bounds.center + Vector(0, bounds.size.y / 2 + 0.2, 0)
|
||||||
printToColor("Place target(s) of search on set aside hand.", messageColor, "Green")
|
printToColor("Place target(s) of search on set aside spot.", messageColor, "Green")
|
||||||
|
|
||||||
-- get playermat orientation
|
-- get playermat orientation
|
||||||
local offset = -15
|
local offset = -15
|
||||||
@ -127,10 +133,28 @@ function startSearch(messageColor, number)
|
|||||||
local handData = Player[handColor].getHandTransform()
|
local handData = Player[handColor].getHandTransform()
|
||||||
local handCards = Player[handColor].getHandObjects()
|
local handCards = Player[handColor].getHandObjects()
|
||||||
setAsidePosition = (handData.position + offset * handData.right):setAt("y", 1.5)
|
setAsidePosition = (handData.position + offset * handData.right):setAt("y", 1.5)
|
||||||
setAsideRotation = { handData.rotation.x, handData.rotation.y + 180, 180 }
|
setAsideRotation = Vector(handData.rotation.x, handData.rotation.y + 180, 180)
|
||||||
|
|
||||||
-- place hand cards set aside
|
-- place hand cards set aside
|
||||||
|
if #handCards > 0 then
|
||||||
deckLib.placeOrMergeIntoDeck(handCards, setAsidePosition, setAsideRotation)
|
deckLib.placeOrMergeIntoDeck(handCards, setAsidePosition, setAsideRotation)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- add a temporary snap point for the set aside spot
|
||||||
|
addedSnapPoint = { position = setAsidePosition, rotation = setAsideRotation }
|
||||||
|
local snapPoints = Global.getSnapPoints() or {}
|
||||||
|
table.insert(snapPoints, addedSnapPoint)
|
||||||
|
Global.setSnapPoints(snapPoints)
|
||||||
|
|
||||||
|
-- add a temporary box for the set aside spot
|
||||||
|
local vectorLines = Global.getVectorLines() or {}
|
||||||
|
local boxSize = Vector(2.5, 0, 3.5)
|
||||||
|
addedVectorLines = generateBoxData(setAsidePosition, boxSize, setAsideRotation.y, handColor)
|
||||||
|
|
||||||
|
for _, line in ipairs(addedVectorLines) do
|
||||||
|
table.insert(vectorLines, line)
|
||||||
|
end
|
||||||
|
Global.setVectorLines(vectorLines)
|
||||||
|
|
||||||
-- handling for Norman Withers
|
-- handling for Norman Withers
|
||||||
if deckAreaObjects.topCard then
|
if deckAreaObjects.topCard then
|
||||||
@ -182,4 +206,77 @@ function drawSetAsideCards()
|
|||||||
end
|
end
|
||||||
obj.deal(count, handColor)
|
obj.deal(count, handColor)
|
||||||
end
|
end
|
||||||
|
removeAddedSnapAndLines()
|
||||||
|
end
|
||||||
|
|
||||||
|
function removeAddedSnapAndLines()
|
||||||
|
local vectorLines = Global.getVectorLines() or {}
|
||||||
|
local snapPoints = Global.getSnapPoints() or {}
|
||||||
|
|
||||||
|
-- look for previously added data and remove it (iterate in reverse because we're removing entries)
|
||||||
|
for i = #vectorLines, 1, -1 do
|
||||||
|
for _, boxLine in ipairs(addedVectorLines) do
|
||||||
|
if vectorLines[i].points[1] == boxLine.points[1] and vectorLines[i].points[2] == boxLine.points[2] then
|
||||||
|
table.remove(vectorLines, i)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for i = #snapPoints, 1, -1 do
|
||||||
|
if snapPoints[i].position == addedSnapPoint.position then
|
||||||
|
table.remove(snapPoints, i)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Global.setVectorLines(vectorLines)
|
||||||
|
Global.setSnapPoints(snapPoints)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- generates the lines data for a rectangular box
|
||||||
|
---@param center tts__Vector Center of the box
|
||||||
|
---@param size tts__Vector X and Z dimension of the box
|
||||||
|
---@param rotation number Rotation around the Y-axis for the box
|
||||||
|
---@param boxColor string Color for the box
|
||||||
|
---@return table lines Vector line data for the box
|
||||||
|
function generateBoxData(center, size, rotation, boxColor)
|
||||||
|
local halfWidth = size.x / 2
|
||||||
|
local halfDepth = size.z / 2
|
||||||
|
|
||||||
|
-- corners of the box in local coordinates
|
||||||
|
local corners = {
|
||||||
|
Vector(-halfWidth, 0, -halfDepth),
|
||||||
|
Vector(halfWidth, 0, -halfDepth),
|
||||||
|
Vector(halfWidth, 0, halfDepth),
|
||||||
|
Vector(-halfWidth, 0, halfDepth)
|
||||||
|
}
|
||||||
|
|
||||||
|
-- translate corners to global coordinates
|
||||||
|
for i, cornerVec in ipairs(corners) do
|
||||||
|
local rotatedCornerVec = cornerVec:rotateOver('y', rotation)
|
||||||
|
corners[i] = rotatedCornerVec + center
|
||||||
|
end
|
||||||
|
|
||||||
|
-- generate the lines data
|
||||||
|
local lines = {
|
||||||
|
{
|
||||||
|
points = { corners[1], corners[2] },
|
||||||
|
color = boxColor
|
||||||
|
},
|
||||||
|
{
|
||||||
|
points = { corners[2], corners[3] },
|
||||||
|
color = boxColor
|
||||||
|
},
|
||||||
|
{
|
||||||
|
points = { corners[3], corners[4] },
|
||||||
|
color = boxColor
|
||||||
|
},
|
||||||
|
{
|
||||||
|
points = { corners[4], corners[1] },
|
||||||
|
color = boxColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return lines
|
||||||
end
|
end
|
||||||
|
@ -4,7 +4,7 @@ do
|
|||||||
-- respawns the chaos bag with a new state of tokens
|
-- respawns the chaos bag with a new state of tokens
|
||||||
---@param tokenList table List of chaos token ids
|
---@param tokenList table List of chaos token ids
|
||||||
ChaosBagApi.setChaosBagState = function(tokenList)
|
ChaosBagApi.setChaosBagState = function(tokenList)
|
||||||
return Global.call("setChaosBagState", tokenList)
|
Global.call("setChaosBagState", tokenList)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- returns a Table List of chaos token ids in the current chaos bag
|
-- returns a Table List of chaos token ids in the current chaos bag
|
||||||
@ -31,31 +31,31 @@ do
|
|||||||
-- returns all sealed tokens on cards to the chaos bag
|
-- returns all sealed tokens on cards to the chaos bag
|
||||||
---@param playerColor string Color of the player to show the broadcast to
|
---@param playerColor string Color of the player to show the broadcast to
|
||||||
ChaosBagApi.releaseAllSealedTokens = function(playerColor)
|
ChaosBagApi.releaseAllSealedTokens = function(playerColor)
|
||||||
return Global.call("releaseAllSealedTokens", playerColor)
|
Global.call("releaseAllSealedTokens", playerColor)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- returns all drawn tokens to the chaos bag
|
-- returns all drawn tokens to the chaos bag
|
||||||
ChaosBagApi.returnChaosTokens = function()
|
ChaosBagApi.returnChaosTokens = function()
|
||||||
return Global.call("returnChaosTokens")
|
Global.call("returnChaosTokens")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- removes the specified chaos token from the chaos bag
|
-- removes the specified chaos token from the chaos bag
|
||||||
---@param id string ID of the chaos token
|
---@param id string ID of the chaos token
|
||||||
ChaosBagApi.removeChaosToken = function(id)
|
ChaosBagApi.removeChaosToken = function(id)
|
||||||
return Global.call("removeChaosToken", id)
|
Global.call("removeChaosToken", id)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- returns a chaos token to the bag and calls all relevant functions
|
-- returns a chaos token to the bag and calls all relevant functions
|
||||||
---@param token tts__Object Chaos token to return
|
---@param token tts__Object Chaos token to return
|
||||||
---@param fromBag boolean whether or not the token to return was in the middle of being drawn (true) or elsewhere (false)
|
---@param fromBag boolean whether or not the token to return was in the middle of being drawn (true) or elsewhere (false)
|
||||||
ChaosBagApi.returnChaosTokenToBag = function(token, fromBag)
|
ChaosBagApi.returnChaosTokenToBag = function(token, fromBag)
|
||||||
return Global.call("returnChaosTokenToBag", { token = token, fromBag = fromBag })
|
Global.call("returnChaosTokenToBag", { token = token, fromBag = fromBag })
|
||||||
end
|
end
|
||||||
|
|
||||||
-- spawns the specified chaos token and puts it into the chaos bag
|
-- spawns the specified chaos token and puts it into the chaos bag
|
||||||
---@param id string ID of the chaos token
|
---@param id string ID of the chaos token
|
||||||
ChaosBagApi.spawnChaosToken = function(id)
|
ChaosBagApi.spawnChaosToken = function(id)
|
||||||
return Global.call("spawnChaosToken", id)
|
Global.call("spawnChaosToken", id)
|
||||||
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
|
||||||
|
@ -452,6 +452,9 @@ function returnAndRedraw(_, tokenGUID)
|
|||||||
end
|
end
|
||||||
|
|
||||||
redrawData = {}
|
redrawData = {}
|
||||||
|
|
||||||
|
-- return a reference to the freshly drawn token
|
||||||
|
return chaosTokens[indexOfReturnedToken]
|
||||||
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
|
||||||
@ -1735,7 +1738,7 @@ function onClick_defaultSettings()
|
|||||||
optionPanel = {
|
optionPanel = {
|
||||||
cardLanguage = "en",
|
cardLanguage = "en",
|
||||||
changePlayAreaImage = false,
|
changePlayAreaImage = false,
|
||||||
enableCardHelpers = false,
|
enableCardHelpers = true,
|
||||||
playAreaConnectionColor = { a = 1, b = 0.4, g = 0.4, r = 0.4 },
|
playAreaConnectionColor = { a = 1, b = 0.4, g = 0.4, r = 0.4 },
|
||||||
playAreaConnections = true,
|
playAreaConnections = true,
|
||||||
playAreaSnapTags = true,
|
playAreaSnapTags = true,
|
||||||
|
@ -51,20 +51,21 @@ As a nice reminder the XML button takes on the Frost color and icon with the tex
|
|||||||
> require...
|
> require...
|
||||||
----------------------------------------------------------]]
|
----------------------------------------------------------]]
|
||||||
|
|
||||||
local isHelperEnabled = false
|
-- intentionally global
|
||||||
|
hasXML = true
|
||||||
|
isHelperEnabled = false
|
||||||
|
|
||||||
function updateSave()
|
function updateSave()
|
||||||
self.script_state = JSON.encode({ isHelperEnabled = isHelperEnabled })
|
self.script_state = JSON.encode({ isHelperEnabled = isHelperEnabled })
|
||||||
end
|
end
|
||||||
|
|
||||||
function onLoad(savedData)
|
function onLoad(savedData)
|
||||||
self.addTag("CardWithHelper")
|
|
||||||
if savedData and savedData ~= "" then
|
if savedData and savedData ~= "" then
|
||||||
local loadedData = JSON.decode(savedData)
|
local loadedData = JSON.decode(savedData)
|
||||||
isHelperEnabled = loadedData.isHelperEnabled
|
isHelperEnabled = loadedData.isHelperEnabled
|
||||||
end
|
end
|
||||||
createHelperXML()
|
createHelperXML()
|
||||||
checkOptionPanel()
|
syncDisplayWithOptionPanel()
|
||||||
end
|
end
|
||||||
|
|
||||||
function createHelperXML()
|
function createHelperXML()
|
||||||
@ -95,14 +96,6 @@ function createHelperXML()
|
|||||||
self.UI.setXmlTable(xmlTable)
|
self.UI.setXmlTable(xmlTable)
|
||||||
end
|
end
|
||||||
|
|
||||||
function shutOff()
|
|
||||||
self.UI.hide("Helper")
|
|
||||||
end
|
|
||||||
|
|
||||||
function initialize()
|
|
||||||
self.UI.show("Helper")
|
|
||||||
end
|
|
||||||
|
|
||||||
function triggerXMLTokenLabelCreation()
|
function triggerXMLTokenLabelCreation()
|
||||||
Global.call("activeRedrawEffect", {
|
Global.call("activeRedrawEffect", {
|
||||||
VALID_TOKENS = VALID_TOKENS,
|
VALID_TOKENS = VALID_TOKENS,
|
||||||
|
@ -1,7 +1,23 @@
|
|||||||
|
--[[ Library for cards that have helpers
|
||||||
|
This file is used to share code between cards with helpers.
|
||||||
|
It syncs the visibility of the helper with the option panel and
|
||||||
|
makes sure the card has the respective tag.
|
||||||
|
Additionally, it will call 'initiliaze()' and 'shutOff()'
|
||||||
|
in the parent file if they are present.
|
||||||
|
|
||||||
|
Instructions:
|
||||||
|
1) Define the global variables before requiring this file:
|
||||||
|
hasXML = true (whether the card has an XML display)
|
||||||
|
isHelperEnabled = false (default state of the helper, should be 'false')
|
||||||
|
|
||||||
|
2) In 'onLoad()'', call 'syncDisplayWithOptionPanel()'
|
||||||
|
----------------------------------------------------------]]
|
||||||
|
|
||||||
local optionPanelApi = require("core/OptionPanelApi")
|
local optionPanelApi = require("core/OptionPanelApi")
|
||||||
|
|
||||||
-- if the respective option is enabled in onLoad(), enable the helper
|
-- if the respective option is enabled in onLoad(), enable the helper
|
||||||
function checkOptionPanel()
|
function syncDisplayWithOptionPanel()
|
||||||
|
self.addTag("CardWithHelper")
|
||||||
local options = optionPanelApi.getOptions()
|
local options = optionPanelApi.getOptions()
|
||||||
if options.enableCardHelpers then
|
if options.enableCardHelpers then
|
||||||
setHelperState(true)
|
setHelperState(true)
|
||||||
@ -33,10 +49,12 @@ function actualDisplayUpdate()
|
|||||||
if isHelperEnabled then
|
if isHelperEnabled then
|
||||||
self.clearContextMenu()
|
self.clearContextMenu()
|
||||||
self.addContextMenuItem("Disable Helper", toggleHelper)
|
self.addContextMenuItem("Disable Helper", toggleHelper)
|
||||||
|
if hasXML then self.UI.show("Helper") end
|
||||||
if initialize then initialize() end
|
if initialize then initialize() end
|
||||||
else
|
else
|
||||||
self.clearContextMenu()
|
self.clearContextMenu()
|
||||||
self.addContextMenuItem("Enable Helper", toggleHelper)
|
self.addContextMenuItem("Enable Helper", toggleHelper)
|
||||||
|
if hasXML then self.UI.hide("Helper") end
|
||||||
if shutOff then shutOff() end
|
if shutOff then shutOff() end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
2
src/playercards/cards/Analysis.ttslua
Normal file
2
src/playercards/cards/Analysis.ttslua
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
require("playercards/CardsWithHelper")
|
||||||
|
require("playercards/CardsThatRedrawTokens")
|
@ -4,35 +4,37 @@ local chaosBagApi = require("chaosbag/ChaosBagApi")
|
|||||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||||
local playermatApi = require("playermat/PlayermatApi")
|
local playermatApi = require("playermat/PlayermatApi")
|
||||||
|
|
||||||
local isHelperEnabled = false
|
-- intentionally global
|
||||||
local updated
|
hasXML = true
|
||||||
|
isHelperEnabled = false
|
||||||
|
local updated, loopId
|
||||||
|
|
||||||
function updateSave()
|
function updateSave()
|
||||||
self.script_state = JSON.encode({ isHelperEnabled = isHelperEnabled })
|
self.script_state = JSON.encode({
|
||||||
|
isHelperEnabled = isHelperEnabled,
|
||||||
|
loopId = loopId
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
function onLoad(savedData)
|
function onLoad(savedData)
|
||||||
self.addTag("CardWithHelper")
|
|
||||||
if savedData and savedData ~= "" then
|
if savedData and savedData ~= "" then
|
||||||
local loadedData = JSON.decode(savedData)
|
local loadedData = JSON.decode(savedData)
|
||||||
isHelperEnabled = loadedData.isHelperEnabled
|
isHelperEnabled = loadedData.isHelperEnabled
|
||||||
|
loopId = loadedData.loopId
|
||||||
end
|
end
|
||||||
checkOptionPanel()
|
syncDisplayWithOptionPanel()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- hide buttons and stop monitoring
|
|
||||||
function shutOff()
|
function shutOff()
|
||||||
self.UI.hide("Helper")
|
if loopId then
|
||||||
Wait.stopAll()
|
Wait.stop(loopId)
|
||||||
updateSave()
|
loopId = nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- show buttons and begin monitoring chaos bag for curse and bless tokens
|
|
||||||
function initialize()
|
function initialize()
|
||||||
self.UI.show("Helper")
|
|
||||||
maybeUpdateButtonState()
|
maybeUpdateButtonState()
|
||||||
Wait.time(maybeUpdateButtonState, 1, -1)
|
loopId = Wait.time(maybeUpdateButtonState, 1, -1)
|
||||||
updateSave()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function resolveToken(player, _, tokenType)
|
function resolveToken(player, _, tokenType)
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
require("playercards/CardsWithHelper")
|
require("playercards/CardsWithHelper")
|
||||||
local playermatApi = require("playermat/PlayermatApi")
|
local playermatApi = require("playermat/PlayermatApi")
|
||||||
|
|
||||||
|
-- intentionally global
|
||||||
|
hasXML = false
|
||||||
|
isHelperEnabled = false
|
||||||
|
|
||||||
-- common button parameters
|
-- common button parameters
|
||||||
local buttonParameters = {}
|
local buttonParameters = {}
|
||||||
buttonParameters.function_owner = self
|
buttonParameters.function_owner = self
|
||||||
@ -28,7 +32,6 @@ local customizableList = {
|
|||||||
|
|
||||||
-- index of the currently selected button (0-indexed from the top)
|
-- index of the currently selected button (0-indexed from the top)
|
||||||
local activeButtonIndex = -1
|
local activeButtonIndex = -1
|
||||||
local isHelperEnabled = false
|
|
||||||
local hypothesisList = {}
|
local hypothesisList = {}
|
||||||
|
|
||||||
function updateSave()
|
function updateSave()
|
||||||
@ -39,17 +42,17 @@ function updateSave()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function onLoad(savedData)
|
function onLoad(savedData)
|
||||||
self.addTag("CardWithHelper")
|
|
||||||
if savedData and savedData ~= "" then
|
if savedData and savedData ~= "" then
|
||||||
local loadedData = JSON.decode(savedData)
|
local loadedData = JSON.decode(savedData)
|
||||||
isHelperEnabled = loadedData.isHelperEnabled
|
isHelperEnabled = loadedData.isHelperEnabled
|
||||||
activeButtonIndex = loadedData.activeButtonIndex
|
activeButtonIndex = loadedData.activeButtonIndex
|
||||||
end
|
end
|
||||||
checkOptionPanel()
|
|
||||||
|
|
||||||
if activeButtonIndex > 0 then
|
if activeButtonIndex > 0 then
|
||||||
selectButton(activeButtonIndex)
|
selectButton(activeButtonIndex)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
syncDisplayWithOptionPanel()
|
||||||
end
|
end
|
||||||
|
|
||||||
function initialize()
|
function initialize()
|
||||||
@ -74,7 +77,7 @@ function selectButton(index)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Create buttons based on the button parameters
|
-- create buttons based on the button parameters
|
||||||
function createButtons()
|
function createButtons()
|
||||||
self.clearButtons()
|
self.clearButtons()
|
||||||
|
|
||||||
@ -88,7 +91,6 @@ function createButtons()
|
|||||||
local upgradeSheet = findUpgradeSheet()
|
local upgradeSheet = findUpgradeSheet()
|
||||||
if upgradeSheet then
|
if upgradeSheet then
|
||||||
for i = 1, 4 do
|
for i = 1, 4 do
|
||||||
log(4)
|
|
||||||
if upgradeSheet.call("isUpgradeActive", i) then
|
if upgradeSheet.call("isUpgradeActive", i) then
|
||||||
table.insert(hypothesisList, customizableList[i])
|
table.insert(hypothesisList, customizableList[i])
|
||||||
end
|
end
|
||||||
|
@ -1,26 +1,24 @@
|
|||||||
|
require("playercards/CardsWithHelper")
|
||||||
local playermatApi = require("playermat/PlayermatApi")
|
local playermatApi = require("playermat/PlayermatApi")
|
||||||
local searchLib = require("util/SearchLib")
|
local searchLib = require("util/SearchLib")
|
||||||
local tokenManager = require("core/token/TokenManager")
|
local tokenManager = require("core/token/TokenManager")
|
||||||
|
|
||||||
|
-- intentionally global
|
||||||
|
hasXML = true
|
||||||
|
isHelperEnabled = false
|
||||||
local clickableResourceCounter = nil
|
local clickableResourceCounter = nil
|
||||||
local foundTokens = 0
|
local foundTokens = 0
|
||||||
|
|
||||||
function onLoad()
|
function updateSave()
|
||||||
self.addContextMenuItem("Add 4 resources",
|
self.script_state = JSON.encode({ isHelperEnabled = isHelperEnabled })
|
||||||
function(playerColor)
|
end
|
||||||
Player[playerColor].clearSelectedObjects()
|
|
||||||
add4(playerColor)
|
function onLoad(savedData)
|
||||||
end)
|
if savedData and savedData ~= "" then
|
||||||
self.addContextMenuItem("Take all resources",
|
local loadedData = JSON.decode(savedData)
|
||||||
function(playerColor)
|
isHelperEnabled = loadedData.isHelperEnabled
|
||||||
Player[playerColor].clearSelectedObjects()
|
end
|
||||||
takeAll(playerColor)
|
syncDisplayWithOptionPanel()
|
||||||
end)
|
|
||||||
self.addContextMenuItem("Discard all resources",
|
|
||||||
function(playerColor)
|
|
||||||
Player[playerColor].clearSelectedObjects()
|
|
||||||
loseAll(playerColor)
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function searchSelf()
|
function searchSelf()
|
||||||
@ -40,7 +38,7 @@ function searchSelf()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function add4(playerColor)
|
function add4()
|
||||||
searchSelf()
|
searchSelf()
|
||||||
|
|
||||||
local newCount = foundTokens + 4
|
local newCount = foundTokens + 4
|
||||||
@ -51,7 +49,7 @@ function add4(playerColor)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function takeAll(playerColor)
|
function takeAll(player)
|
||||||
searchSelf()
|
searchSelf()
|
||||||
local matColor = playermatApi.getMatColorByPosition(self.getPosition())
|
local matColor = playermatApi.getMatColorByPosition(self.getPosition())
|
||||||
playermatApi.updateCounter(matColor, "ResourceCounter", _, foundTokens)
|
playermatApi.updateCounter(matColor, "ResourceCounter", _, foundTokens)
|
||||||
@ -59,14 +57,13 @@ function takeAll(playerColor)
|
|||||||
if clickableResourceCounter then
|
if clickableResourceCounter then
|
||||||
clickableResourceCounter.call("updateVal", 0)
|
clickableResourceCounter.call("updateVal", 0)
|
||||||
end
|
end
|
||||||
printToColor("Moved " .. foundTokens .. " resource(s) to " .. matColor .. "'s resource pool.", playerColor)
|
printToColor("Moved " .. foundTokens .. " resource(s) to " .. matColor .. "'s resource pool.", player.color)
|
||||||
end
|
end
|
||||||
|
|
||||||
function loseAll(playerColor)
|
function loseAll(player)
|
||||||
searchSelf()
|
searchSelf()
|
||||||
|
|
||||||
if clickableResourceCounter then
|
if clickableResourceCounter then
|
||||||
clickableResourceCounter.call("updateVal", 0)
|
clickableResourceCounter.call("updateVal", 0)
|
||||||
end
|
end
|
||||||
printToColor("Discarded " .. foundTokens .. " resource(s).", playerColor)
|
printToColor("Discarded " .. foundTokens .. " resource(s).", player.color)
|
||||||
end
|
end
|
||||||
|
@ -5,8 +5,10 @@ local playermatApi = require("playermat/PlayermatApi")
|
|||||||
local searchLib = require("util/SearchLib")
|
local searchLib = require("util/SearchLib")
|
||||||
local tokenManager = require("core/token/TokenManager")
|
local tokenManager = require("core/token/TokenManager")
|
||||||
|
|
||||||
local isHelperEnabled = false
|
-- intentionally global
|
||||||
local updated
|
hasXML = true
|
||||||
|
isHelperEnabled = false
|
||||||
|
local updated, loopId
|
||||||
|
|
||||||
local xmlData = {
|
local xmlData = {
|
||||||
Action = { color = "#6D202CE6", onClick = "removeAndExtraAction" },
|
Action = { color = "#6D202CE6", onClick = "removeAndExtraAction" },
|
||||||
@ -16,31 +18,31 @@ local xmlData = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateSave()
|
function updateSave()
|
||||||
self.script_state = JSON.encode({ isHelperEnabled = isHelperEnabled })
|
self.script_state = JSON.encode({
|
||||||
|
isHelperEnabled = isHelperEnabled,
|
||||||
|
loopId = loopId
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
function onLoad(savedData)
|
function onLoad(savedData)
|
||||||
self.addTag("CardWithHelper")
|
|
||||||
if savedData and savedData ~= "" then
|
if savedData and savedData ~= "" then
|
||||||
local loadedData = JSON.decode(savedData)
|
local loadedData = JSON.decode(savedData)
|
||||||
isHelperEnabled = loadedData.isHelperEnabled
|
isHelperEnabled = loadedData.isHelperEnabled
|
||||||
|
loopId = loadedData.loopId
|
||||||
end
|
end
|
||||||
checkOptionPanel()
|
syncDisplayWithOptionPanel()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- hide buttons and stop monitoring
|
|
||||||
function shutOff()
|
|
||||||
self.UI.hide("Helper")
|
|
||||||
Wait.stopAll()
|
|
||||||
updateSave()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- show buttons and begin monitoring chaos bag for curse and bless tokens
|
|
||||||
function initialize()
|
function initialize()
|
||||||
self.UI.show("Helper")
|
|
||||||
maybeUpdateButtonState()
|
maybeUpdateButtonState()
|
||||||
Wait.time(maybeUpdateButtonState, 1, -1)
|
loopId = Wait.time(maybeUpdateButtonState, 1, -1)
|
||||||
updateSave()
|
end
|
||||||
|
|
||||||
|
function shutOff()
|
||||||
|
if loopId then
|
||||||
|
Wait.stop(loopId)
|
||||||
|
loopId = nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function addTokenToBag(_, _, tokenType)
|
function addTokenToBag(_, _, tokenType)
|
||||||
|
2
src/playercards/cards/Strong-Armed.ttslua
Normal file
2
src/playercards/cards/Strong-Armed.ttslua
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
require("playercards/CardsWithHelper")
|
||||||
|
require("playercards/CardsThatRedrawTokens")
|
2
src/playercards/cards/ThirdTimesaCharm.ttslua
Normal file
2
src/playercards/cards/ThirdTimesaCharm.ttslua
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
require("playercards/CardsWithHelper")
|
||||||
|
require("playercards/CardsThatRedrawTokens")
|
@ -1,6 +1,12 @@
|
|||||||
require("playercards/CardsWithHelper")
|
require("playercards/CardsWithHelper")
|
||||||
local playermatApi = require("playermat/PlayermatApi")
|
local playermatApi = require("playermat/PlayermatApi")
|
||||||
|
|
||||||
|
-- intentionally global
|
||||||
|
hasXML = false
|
||||||
|
isHelperEnabled = false
|
||||||
|
|
||||||
|
local modValue, loopId
|
||||||
|
|
||||||
local buttonParameters = {
|
local buttonParameters = {
|
||||||
click_function = "shutOff",
|
click_function = "shutOff",
|
||||||
function_owner = self,
|
function_owner = self,
|
||||||
@ -10,13 +16,20 @@ local buttonParameters = {
|
|||||||
height = 175
|
height = 175
|
||||||
}
|
}
|
||||||
|
|
||||||
local modValue
|
|
||||||
|
|
||||||
function updateSave()
|
function updateSave()
|
||||||
self.script_state = JSON.encode({ isHelperEnabled = isHelperEnabled })
|
self.script_state = JSON.encode({
|
||||||
|
isHelperEnabled = isHelperEnabled,
|
||||||
|
loopId = loopId
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
function onLoad(savedData)
|
function onLoad(savedData)
|
||||||
|
if savedData and savedData ~= "" then
|
||||||
|
local loadedData = JSON.decode(savedData)
|
||||||
|
isHelperEnabled = loadedData.isHelperEnabled
|
||||||
|
loopId = loadedData.loopId
|
||||||
|
end
|
||||||
|
|
||||||
-- use metadata to detect level and adjust modValue accordingly
|
-- use metadata to detect level and adjust modValue accordingly
|
||||||
if JSON.decode(self.getGMNotes()).level == 0 then
|
if JSON.decode(self.getGMNotes()).level == 0 then
|
||||||
modValue = 5
|
modValue = 5
|
||||||
@ -24,25 +37,22 @@ function onLoad(savedData)
|
|||||||
modValue = 4
|
modValue = 4
|
||||||
end
|
end
|
||||||
|
|
||||||
self.addTag("CardWithHelper")
|
syncDisplayWithOptionPanel()
|
||||||
if savedData and savedData ~= "" then
|
|
||||||
local loadedData = JSON.decode(savedData)
|
|
||||||
isHelperEnabled = loadedData.isHelperEnabled
|
|
||||||
end
|
|
||||||
checkOptionPanel()
|
|
||||||
updateDisplay()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function initialize()
|
function initialize()
|
||||||
self.clearButtons()
|
self.clearButtons()
|
||||||
self.createButton(buttonParameters)
|
self.createButton(buttonParameters)
|
||||||
updateButton()
|
updateButton()
|
||||||
Wait.time(updateButton, 2, -1)
|
loopId = Wait.time(updateButton, 2, -1)
|
||||||
end
|
end
|
||||||
|
|
||||||
function shutOff()
|
function shutOff()
|
||||||
self.clearButtons()
|
self.clearButtons()
|
||||||
Wait.stopAll()
|
if loopId then
|
||||||
|
Wait.stop(loopId)
|
||||||
|
loopId = nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function updateButton()
|
function updateButton()
|
||||||
|
@ -63,12 +63,12 @@ local buttonParameters = {
|
|||||||
|
|
||||||
-- table of texture URLs
|
-- table of texture URLs
|
||||||
local nameToTexture = {
|
local nameToTexture = {
|
||||||
Guardian = "http://cloud-3.steamusercontent.com/ugc/2501268517203536128/853B9CD08FC14A8B2A08C73D8ED77E0FE235CCCB/",
|
Guardian = "http://cloud-3.steamusercontent.com/ugc/2501268517241599869/179119CA88170D9F5C87CD00D267E6F9F397D2F7/",
|
||||||
Mystic = "http://cloud-3.steamusercontent.com/ugc/2501268517203536470/11C99488B9CA9236059A5F02E4A852A7C77B42A6/",
|
Mystic = "http://cloud-3.steamusercontent.com/ugc/2501268517241600113/F6473F92B3435C32A685BB4DC2A88C2504DDAC4F/",
|
||||||
Neutral = "http://cloud-3.steamusercontent.com/ugc/2462982115659543571/5D778EA4BC682DAE97E8F59A991BCF8CB3979B04/",
|
Neutral = "http://cloud-3.steamusercontent.com/ugc/2462982115659543571/5D778EA4BC682DAE97E8F59A991BCF8CB3979B04/",
|
||||||
Rogue = "http://cloud-3.steamusercontent.com/ugc/2501268517203536767/587791B327255DB8F953B27BB9E4DE602FA32B64/",
|
Rogue = "http://cloud-3.steamusercontent.com/ugc/2501268517241600395/00CFAFC13D7B6EACC147D22A40AF9FBBFFAF3136/",
|
||||||
Seeker = "http://cloud-3.steamusercontent.com/ugc/2501268517203537098/EFD9FC4CCDB105EFFDFF7A57C915CD984865760D/",
|
Seeker = "http://cloud-3.steamusercontent.com/ugc/2501268517241600579/92DEB412D8D3A9C26D1795CEA0335480409C3E4B/",
|
||||||
Survivor = "http://cloud-3.steamusercontent.com/ugc/2501268517203537426/14EF780606D9A449F31A007226CB48D05AA820FF/"
|
Survivor = "http://cloud-3.steamusercontent.com/ugc/2501268517241600848/CEB685E9C8A4A3C18A4B677A519B49423B54E886/"
|
||||||
}
|
}
|
||||||
|
|
||||||
-- translation table for slot names to characters for special font
|
-- translation table for slot names to characters for special font
|
||||||
|
37
xml/playercards/FamilyInheritance.xml
Normal file
37
xml/playercards/FamilyInheritance.xml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<Defaults>
|
||||||
|
<Button padding="30 30 30 30"
|
||||||
|
font="font_teutonic-arkham"
|
||||||
|
textColor="white"
|
||||||
|
fontSize="235"
|
||||||
|
shadow="#405041B3"
|
||||||
|
shadowDistance="-15 15"/>
|
||||||
|
<TableLayout position="130 0 -22"
|
||||||
|
rotation="0 0 270"
|
||||||
|
height="460"
|
||||||
|
width="2600"
|
||||||
|
scale="0.1 0.1 1"
|
||||||
|
cellSpacing="80"
|
||||||
|
cellBackgroundColor="rgba(1,1,1,0)"/>
|
||||||
|
</Defaults>
|
||||||
|
|
||||||
|
<TableLayout id="Helper"
|
||||||
|
active="false">
|
||||||
|
<Row>
|
||||||
|
<Cell>
|
||||||
|
<Button onClick="loseAll"
|
||||||
|
color="#6D202C"
|
||||||
|
fontSize="195"
|
||||||
|
text="Discard all"/>
|
||||||
|
</Cell>
|
||||||
|
<Cell>
|
||||||
|
<Button onClick="takeAll"
|
||||||
|
color="#173B0B"
|
||||||
|
text="Move all"/>
|
||||||
|
</Cell>
|
||||||
|
<Cell>
|
||||||
|
<Button onClick="add4"
|
||||||
|
color="#77674D"
|
||||||
|
text="Place 4"/>
|
||||||
|
</Cell>
|
||||||
|
</Row>
|
||||||
|
</TableLayout>
|
Loading…
Reference in New Issue
Block a user