Merge branch 'main' into token-metadata
This commit is contained in:
commit
8b57be99b7
@ -34,8 +34,8 @@
|
|||||||
"IgnoreFoW": false,
|
"IgnoreFoW": false,
|
||||||
"LayoutGroupSortIndex": 0,
|
"LayoutGroupSortIndex": 0,
|
||||||
"Locked": false,
|
"Locked": false,
|
||||||
|
"LuaScript": "require(\"accessories/AttachmentHelper\")",
|
||||||
"LuaScriptState": "[[],true,true]",
|
"LuaScriptState": "[[],true,true]",
|
||||||
"LuaScript_path": "Fan-MadeAccessories.aa8b38/AttachmentHelper.7f4976/AttachmentHelper.d45664.ttslua",
|
|
||||||
"MaterialIndex": -1,
|
"MaterialIndex": -1,
|
||||||
"MeasureMovement": false,
|
"MeasureMovement": false,
|
||||||
"MeshIndex": -1,
|
"MeshIndex": -1,
|
||||||
@ -45,8 +45,7 @@
|
|||||||
"Snap": true,
|
"Snap": true,
|
||||||
"Sticky": true,
|
"Sticky": true,
|
||||||
"Tags": [
|
"Tags": [
|
||||||
"Asset",
|
"Asset"
|
||||||
"scesetup_memory_object"
|
|
||||||
],
|
],
|
||||||
"Tooltip": true,
|
"Tooltip": true,
|
||||||
"Transform": {
|
"Transform": {
|
||||||
|
@ -1,202 +0,0 @@
|
|||||||
local OPTION_TEXT = {
|
|
||||||
"Ancestral Knowledge",
|
|
||||||
"Astronomical Atlas",
|
|
||||||
"Crystallizer of Dreams",
|
|
||||||
"Diana Stanley",
|
|
||||||
"Gloria Goldberg",
|
|
||||||
"Sefina Rousseau",
|
|
||||||
"Wooden Sledge"
|
|
||||||
}
|
|
||||||
|
|
||||||
local IMAGE_LIST = {
|
|
||||||
-- Ancestral Knowledge
|
|
||||||
"http://cloud-3.steamusercontent.com/ugc/1915746489207287888/2F9F6F211ED0F98E66C9D35D93221E4C7FB6DD3C/",
|
|
||||||
-- Astronomical Atlas
|
|
||||||
"http://cloud-3.steamusercontent.com/ugc/1754695853007989004/9153BC204FC707AE564ECFAC063A11CB8C2B5D1E/",
|
|
||||||
-- Crystallizer of Dreams
|
|
||||||
"http://cloud-3.steamusercontent.com/ugc/1915746489207280958/100F16441939E5E23818651D1EB5C209BF3125B9/",
|
|
||||||
-- Diana Stanley
|
|
||||||
"http://cloud-3.steamusercontent.com/ugc/1754695635919071208/1AB7222850201630826BFFBA8F2BD0065E2D572F/",
|
|
||||||
-- Gloria Goldberg
|
|
||||||
"http://cloud-3.steamusercontent.com/ugc/1754695635919102502/453D4426118C8A6DE2EA281184716E26CA924C84/",
|
|
||||||
-- Sefina Rousseau
|
|
||||||
"http://cloud-3.steamusercontent.com/ugc/1754695635919099826/3C3CBFFAADB2ACA9957C736491F470AE906CC953/",
|
|
||||||
-- Wooden Sledge
|
|
||||||
"http://cloud-3.steamusercontent.com/ugc/1750192233783143973/D526236AAE16BDBB98D3F30E27BAFC1D3E21F4AC/"
|
|
||||||
}
|
|
||||||
|
|
||||||
-- save state and options to restore onLoad
|
|
||||||
function onSave() return JSON.encode({ cardsInBag, showCost, showIcons }) end
|
|
||||||
|
|
||||||
-- load variables and create context menu
|
|
||||||
function onLoad(savedData)
|
|
||||||
local loadedData = JSON.decode(savedData)
|
|
||||||
cardsInBag = loadedData[1] or {}
|
|
||||||
showCost = loadedData[2] or true
|
|
||||||
showIcons = loadedData[3] or true
|
|
||||||
|
|
||||||
recreateButtons()
|
|
||||||
|
|
||||||
self.addContextMenuItem("Select image", selectImage)
|
|
||||||
self.addContextMenuItem("Toggle cost", function(color)
|
|
||||||
showCost = not showCost
|
|
||||||
printToColor("Show cost of cards: " .. tostring(showCost), color, "White")
|
|
||||||
refresh()
|
|
||||||
end)
|
|
||||||
|
|
||||||
self.addContextMenuItem("Toggle skill icons", function(color)
|
|
||||||
showIcons = not showIcons
|
|
||||||
printToColor("Show skill icons of cards: " .. tostring(showIcons), color, "White")
|
|
||||||
refresh()
|
|
||||||
end)
|
|
||||||
|
|
||||||
self.addContextMenuItem("More Information", function()
|
|
||||||
printToAll("------------------------------", "White")
|
|
||||||
printToAll("Attachment Helper by Chr1Z", "Orange")
|
|
||||||
printToAll("original by bankey", "White")
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
function selectImage(color)
|
|
||||||
Player[color].showOptionsDialog("Select image:", OPTION_TEXT, 1, function(_, option_index)
|
|
||||||
local customInfo = self.getCustomObject()
|
|
||||||
customInfo.diffuse = IMAGE_LIST[option_index]
|
|
||||||
self.setCustomObject(customInfo)
|
|
||||||
self.reload()
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- called for every card that enters
|
|
||||||
function onObjectEnterContainer(container, object)
|
|
||||||
if container == self then
|
|
||||||
if object.tag ~= "Card" then
|
|
||||||
broadcastToAll("The 'Attachment Helper' is meant to be used for single cards.", "White")
|
|
||||||
else
|
|
||||||
findCard(object.getGUID(), object.getName(), object.getGMNotes())
|
|
||||||
end
|
|
||||||
-- TODO: implement splitting of decks that get thrown in here
|
|
||||||
recreateButtons()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- removes leaving cards from the "cardInBag" table
|
|
||||||
function onObjectLeaveContainer(container, object)
|
|
||||||
if container == self then
|
|
||||||
local guid = object.getGUID()
|
|
||||||
local found = false
|
|
||||||
for i, card in ipairs(cardsInBag) do
|
|
||||||
if card.id == guid then
|
|
||||||
table.remove(cardsInBag, i)
|
|
||||||
found = true
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if found ~= true then
|
|
||||||
local name = object.getName()
|
|
||||||
for i, card in ipairs(cardsInBag) do
|
|
||||||
if card.name == name then
|
|
||||||
table.remove(cardsInBag, i)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
recreateButtons()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- refreshes displayed buttons based on contained cards
|
|
||||||
function refresh()
|
|
||||||
cardsInBag = {}
|
|
||||||
for _, object in ipairs(self.getObjects()) do
|
|
||||||
findCard(object.guid, object.name, object.gm_notes)
|
|
||||||
end
|
|
||||||
recreateButtons()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- gets cost and icons for a card
|
|
||||||
function findCard(guid, name, GMNotes)
|
|
||||||
local cost = ""
|
|
||||||
local icons = {}
|
|
||||||
local metadata = {}
|
|
||||||
local displayName = name
|
|
||||||
|
|
||||||
if displayName == nil or displayName == "" then displayName = "unnamed" end
|
|
||||||
if showCost or showIcons then metadata = JSON.decode(GMNotes) end
|
|
||||||
|
|
||||||
if showCost then
|
|
||||||
if GMNotes ~= "" then cost = metadata.cost end
|
|
||||||
if cost == nil or cost == "" then cost = "–" end
|
|
||||||
displayName = "[" .. cost .. "] " .. displayName
|
|
||||||
end
|
|
||||||
|
|
||||||
if showIcons then
|
|
||||||
if GMNotes ~= "" then
|
|
||||||
icons[1] = metadata.wildIcons
|
|
||||||
icons[2] = metadata.willpowerIcons
|
|
||||||
icons[3] = metadata.intellectIcons
|
|
||||||
icons[4] = metadata.combatIcons
|
|
||||||
icons[5] = metadata.agilityIcons
|
|
||||||
end
|
|
||||||
|
|
||||||
local IconTypes = { "Wild", "Willpower", "Intellect", "Combat", "Agility" }
|
|
||||||
local found = false
|
|
||||||
for i = 1, 5 do
|
|
||||||
if icons[i] ~= nil and icons[i] ~= "" then
|
|
||||||
if found == false then
|
|
||||||
displayName = displayName .. "\n" .. IconTypes[i] .. ": " .. icons[i]
|
|
||||||
found = true
|
|
||||||
else
|
|
||||||
displayName = displayName .. " " .. IconTypes[i] .. ": " .. icons[i]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
table.insert(cardsInBag, { name = name, displayName = displayName, id = guid })
|
|
||||||
end
|
|
||||||
|
|
||||||
-- recreates buttons with up-to-date labels
|
|
||||||
function recreateButtons()
|
|
||||||
self.clearButtons()
|
|
||||||
local verticalPosition = 1.65
|
|
||||||
|
|
||||||
for _, card in ipairs(cardsInBag) do
|
|
||||||
local id = card.id
|
|
||||||
local funcName = "removeCard" .. id
|
|
||||||
self.setVar(funcName, function() removeCard(id) end)
|
|
||||||
self.createButton({
|
|
||||||
label = card.displayName,
|
|
||||||
click_function = funcName,
|
|
||||||
function_owner = self,
|
|
||||||
position = { 0, 0, verticalPosition },
|
|
||||||
height = 200,
|
|
||||||
width = 1200,
|
|
||||||
font_size = string.len(card.displayName) > 20 and 75 or 100
|
|
||||||
})
|
|
||||||
verticalPosition = verticalPosition - 0.5
|
|
||||||
end
|
|
||||||
|
|
||||||
local countLabel = "Attachment\nHelper"
|
|
||||||
if #cardsInBag ~= 0 then countLabel = #cardsInBag end
|
|
||||||
|
|
||||||
self.createButton({
|
|
||||||
label = countLabel,
|
|
||||||
click_function = "none",
|
|
||||||
function_owner = self,
|
|
||||||
position = { 0, 0, -1.35 },
|
|
||||||
height = 0,
|
|
||||||
width = 0,
|
|
||||||
font_size = 225,
|
|
||||||
font_color = { 1, 1, 1 }
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- click-function for buttons to take a card out of the bag
|
|
||||||
function removeCard(cardGUID)
|
|
||||||
self.takeObject({
|
|
||||||
guid = cardGUID,
|
|
||||||
rotation = self.getRotation(),
|
|
||||||
position = self.getPosition() + Vector(0, 0.25, 0),
|
|
||||||
callback_function = function(obj) obj.resting = true end
|
|
||||||
})
|
|
||||||
end
|
|
@ -22,7 +22,7 @@
|
|||||||
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1704036721123215146/E44A3B99EACF310E49E94977151A03C9A3DC7F17/",
|
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1704036721123215146/E44A3B99EACF310E49E94977151A03C9A3DC7F17/",
|
||||||
"WidthScale": 0
|
"WidthScale": 0
|
||||||
},
|
},
|
||||||
"Description": "- Displays the hand size (total or by title for \"Dream Enhancing Serum\"), hover over it to briefly toggle counting method\n\n- Adds a context menu to \"Short Supply\" for the 1st turn\n\n- Allows you to randomly discard a card from your hand\n\nSee context menu for additional information.",
|
"Description": "Displays the hand size (total or by title for \"Dream Enhancing Serum\"), hover over it to briefly toggle counting method.\n\nAllows you to randomly discard a card from your hand.",
|
||||||
"DragSelectable": true,
|
"DragSelectable": true,
|
||||||
"GMNotes": "",
|
"GMNotes": "",
|
||||||
"GUID": "450688",
|
"GUID": "450688",
|
||||||
@ -34,7 +34,7 @@
|
|||||||
"LayoutGroupSortIndex": 0,
|
"LayoutGroupSortIndex": 0,
|
||||||
"Locked": false,
|
"Locked": false,
|
||||||
"LuaScript": "require(\"accessories/HandHelper\")",
|
"LuaScript": "require(\"accessories/HandHelper\")",
|
||||||
"LuaScriptState": "[\"Green\",false]",
|
"LuaScriptState": "",
|
||||||
"MeasureMovement": false,
|
"MeasureMovement": false,
|
||||||
"Name": "Custom_Tile",
|
"Name": "Custom_Tile",
|
||||||
"Nickname": "Hand Helper",
|
"Nickname": "Hand Helper",
|
||||||
|
@ -1,28 +1,45 @@
|
|||||||
local OPTION_TEXT = {
|
local fontColor
|
||||||
"Ancestral Knowledge",
|
local BACKGROUNDS = {
|
||||||
"Astronomical Atlas",
|
{
|
||||||
"Crystallizer of Dreams",
|
title = "Ancestral Knowledge",
|
||||||
"Diana Stanley",
|
url = "http://cloud-3.steamusercontent.com/ugc/1915746489207287888/2F9F6F211ED0F98E66C9D35D93221E4C7FB6DD3C/",
|
||||||
"Gloria Goldberg",
|
fontcolor = { 1, 1, 1 }
|
||||||
"Sefina Rousseau",
|
},
|
||||||
"Wooden Sledge"
|
{
|
||||||
}
|
title = "Astronomical Atlas",
|
||||||
|
url = "http://cloud-3.steamusercontent.com/ugc/1754695853007989004/9153BC204FC707AE564ECFAC063A11CB8C2B5D1E/",
|
||||||
local IMAGE_LIST = {
|
fontcolor = { 1, 1, 1 }
|
||||||
-- Ancestral Knowledge
|
},
|
||||||
"http://cloud-3.steamusercontent.com/ugc/1915746489207287888/2F9F6F211ED0F98E66C9D35D93221E4C7FB6DD3C/",
|
{
|
||||||
-- Astronomical Atlas
|
title = "Backpack",
|
||||||
"http://cloud-3.steamusercontent.com/ugc/1754695853007989004/9153BC204FC707AE564ECFAC063A11CB8C2B5D1E/",
|
url = "http://cloud-3.steamusercontent.com/ugc/2018212896278691928/F55BEFFC2540109C6333179532F583B367FF2EBC/",
|
||||||
-- Crystallizer of Dreams
|
fontcolor = { 0, 0, 0 }
|
||||||
"http://cloud-3.steamusercontent.com/ugc/1915746489207280958/100F16441939E5E23818651D1EB5C209BF3125B9/",
|
},
|
||||||
-- Diana Stanley
|
{
|
||||||
"http://cloud-3.steamusercontent.com/ugc/1754695635919071208/1AB7222850201630826BFFBA8F2BD0065E2D572F/",
|
title = "Crystallizer of Dreams",
|
||||||
-- Gloria Goldberg
|
url = "http://cloud-3.steamusercontent.com/ugc/1915746489207280958/100F16441939E5E23818651D1EB5C209BF3125B9/",
|
||||||
"http://cloud-3.steamusercontent.com/ugc/1754695635919102502/453D4426118C8A6DE2EA281184716E26CA924C84/",
|
fontcolor = { 1, 1, 1 }
|
||||||
-- Sefina Rousseau
|
},
|
||||||
"http://cloud-3.steamusercontent.com/ugc/1754695635919099826/3C3CBFFAADB2ACA9957C736491F470AE906CC953/",
|
{
|
||||||
-- Wooden Sledge
|
title = "Diana Stanley",
|
||||||
"http://cloud-3.steamusercontent.com/ugc/1750192233783143973/D526236AAE16BDBB98D3F30E27BAFC1D3E21F4AC/"
|
url = "http://cloud-3.steamusercontent.com/ugc/1754695635919071208/1AB7222850201630826BFFBA8F2BD0065E2D572F/",
|
||||||
|
fontcolor = { 1, 1, 1 }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title = "Gloria Goldberg",
|
||||||
|
url = "http://cloud-3.steamusercontent.com/ugc/1754695635919102502/453D4426118C8A6DE2EA281184716E26CA924C84/",
|
||||||
|
fontcolor = { 1, 1, 1 }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title = "Sefina Rousseau",
|
||||||
|
url = "http://cloud-3.steamusercontent.com/ugc/1754695635919099826/3C3CBFFAADB2ACA9957C736491F470AE906CC953/",
|
||||||
|
fontcolor = { 0, 0, 0 }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title = "Wooden Sledge",
|
||||||
|
url = "http://cloud-3.steamusercontent.com/ugc/1750192233783143973/D526236AAE16BDBB98D3F30E27BAFC1D3E21F4AC/",
|
||||||
|
fontcolor = { 0, 0, 0 }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- save state and options to restore onLoad
|
-- save state and options to restore onLoad
|
||||||
@ -34,7 +51,7 @@ function onLoad(savedData)
|
|||||||
cardsInBag = loadedData[1] or {}
|
cardsInBag = loadedData[1] or {}
|
||||||
showCost = loadedData[2] or true
|
showCost = loadedData[2] or true
|
||||||
showIcons = loadedData[3] or true
|
showIcons = loadedData[3] or true
|
||||||
|
fontColor = getFontColor()
|
||||||
recreateButtons()
|
recreateButtons()
|
||||||
|
|
||||||
self.addContextMenuItem("Select image", selectImage)
|
self.addContextMenuItem("Select image", selectImage)
|
||||||
@ -49,36 +66,57 @@ function onLoad(savedData)
|
|||||||
printToColor("Show skill icons of cards: " .. tostring(showIcons), color, "White")
|
printToColor("Show skill icons of cards: " .. tostring(showIcons), color, "White")
|
||||||
refresh()
|
refresh()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
self.addContextMenuItem("More Information", function()
|
|
||||||
printToAll("------------------------------", "White")
|
|
||||||
printToAll("Attachment Helper by Chr1Z", "Orange")
|
|
||||||
printToAll("original by bankey", "White")
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- gets the font color based on background url
|
||||||
|
function getFontColor()
|
||||||
|
local customInfo = self.getCustomObject()
|
||||||
|
for i = 1, #BACKGROUNDS do
|
||||||
|
if BACKGROUNDS[i].url == customInfo.diffuse then
|
||||||
|
return BACKGROUNDS[i].fontcolor
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return { 1, 1, 1 }
|
||||||
|
end
|
||||||
|
|
||||||
|
-- called by context menu to change background image
|
||||||
function selectImage(color)
|
function selectImage(color)
|
||||||
Player[color].showOptionsDialog("Select image:", OPTION_TEXT, 1, function(_, option_index)
|
-- generate list of options
|
||||||
|
local options = {}
|
||||||
|
for i = 1, #BACKGROUNDS do
|
||||||
|
options[i] = BACKGROUNDS[i].title
|
||||||
|
end
|
||||||
|
|
||||||
|
-- prompt user to select option
|
||||||
|
Player[color].showOptionsDialog("Select image:", options, 1, function(_, optionIndex)
|
||||||
local customInfo = self.getCustomObject()
|
local customInfo = self.getCustomObject()
|
||||||
customInfo.diffuse = IMAGE_LIST[option_index]
|
customInfo.diffuse = BACKGROUNDS[optionIndex].url
|
||||||
self.setCustomObject(customInfo)
|
self.setCustomObject(customInfo)
|
||||||
self.reload()
|
self.reload()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- called for every card that enters
|
-- only allow cards to enter, split decks and reject other objects
|
||||||
function onObjectEnterContainer(container, object)
|
function onObjectEnterContainer(container, object)
|
||||||
if container == self then
|
if container ~= self then return end
|
||||||
if object.tag ~= "Card" then
|
if object.tag == "Deck" then
|
||||||
broadcastToAll("The 'Attachment Helper' is meant to be used for single cards.", "White")
|
takeDeckOut(object.getGUID(), self.getPosition() + Vector(0, 0.1, 0))
|
||||||
else
|
elseif object.tag ~= "Card" then
|
||||||
findCard(object.getGUID(), object.getName(), object.getGMNotes())
|
broadcastToAll("The 'Attachment Helper' is meant to be used for cards.", "White")
|
||||||
end
|
else
|
||||||
-- TODO: implement splitting of decks that get thrown in here
|
findCard(object.getGUID(), object.getName(), object.getGMNotes())
|
||||||
recreateButtons()
|
recreateButtons()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- takes the deck out and splits in into single cards
|
||||||
|
function takeDeckOut(guid, pos)
|
||||||
|
local deck = self.takeObject({ guid = guid, position = pos, smooth = false })
|
||||||
|
for i = 1, #deck.getObjects() do
|
||||||
|
self.putObject(deck.takeObject({ position = pos + Vector(0, 0.1 * i, 0), smooth = false }))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- removes leaving cards from the "cardInBag" table
|
-- removes leaving cards from the "cardInBag" table
|
||||||
function onObjectLeaveContainer(container, object)
|
function onObjectLeaveContainer(container, object)
|
||||||
if container == self then
|
if container == self then
|
||||||
@ -168,7 +206,7 @@ function recreateButtons()
|
|||||||
label = card.displayName,
|
label = card.displayName,
|
||||||
click_function = funcName,
|
click_function = funcName,
|
||||||
function_owner = self,
|
function_owner = self,
|
||||||
position = { 0, 0, verticalPosition },
|
position = { 0, -0.1, verticalPosition },
|
||||||
height = 200,
|
height = 200,
|
||||||
width = 1200,
|
width = 1200,
|
||||||
font_size = string.len(card.displayName) > 20 and 75 or 100
|
font_size = string.len(card.displayName) > 20 and 75 or 100
|
||||||
@ -176,18 +214,22 @@ function recreateButtons()
|
|||||||
verticalPosition = verticalPosition - 0.5
|
verticalPosition = verticalPosition - 0.5
|
||||||
end
|
end
|
||||||
|
|
||||||
local countLabel = "Attachment\nHelper"
|
local countLabel = #cardsInBag
|
||||||
if #cardsInBag ~= 0 then countLabel = #cardsInBag end
|
local fontSize = 250
|
||||||
|
if #cardsInBag == 0 then
|
||||||
|
countLabel = "Attachment Helper"
|
||||||
|
fontSize = 150
|
||||||
|
end
|
||||||
|
|
||||||
self.createButton({
|
self.createButton({
|
||||||
label = countLabel,
|
label = countLabel,
|
||||||
click_function = "none",
|
click_function = "none",
|
||||||
function_owner = self,
|
function_owner = self,
|
||||||
position = { 0, 0, -1.35 },
|
position = { 0, -0.1, -1.7 },
|
||||||
height = 0,
|
height = 0,
|
||||||
width = 0,
|
width = 0,
|
||||||
font_size = 225,
|
font_size = fontSize,
|
||||||
font_color = { 1, 1, 1 }
|
font_color = fontColor
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,194 +1,114 @@
|
|||||||
local playmatAPI = require("playermat/PlaymatApi")
|
local playmatAPI = require("playermat/PlaymatApi")
|
||||||
|
local matColor, handColor, loopId, hovering
|
||||||
|
|
||||||
local buttonParamaters = {}
|
function onLoad()
|
||||||
buttonParamaters.function_owner = self
|
local buttonParamaters = {}
|
||||||
|
buttonParamaters.function_owner = self
|
||||||
|
|
||||||
-- saving "playerColor" and "des"
|
-- index 0: button as hand size label
|
||||||
function onSave() return JSON.encode({ playerColor, des}) end
|
buttonParamaters.hover_color = "White"
|
||||||
|
buttonParamaters.click_function = "none"
|
||||||
|
buttonParamaters.position = { 0, 0.11, -0.4 }
|
||||||
|
buttonParamaters.height = 0
|
||||||
|
buttonParamaters.width = 0
|
||||||
|
buttonParamaters.font_size = 500
|
||||||
|
buttonParamaters.font_color = "White"
|
||||||
|
self.createButton(buttonParamaters)
|
||||||
|
|
||||||
function onLoad(saved_data)
|
-- index 1: button to toggle "des"
|
||||||
-- loading saved data
|
buttonParamaters.label = "DES: ✗"
|
||||||
local loaded_data = JSON.decode(saved_data)
|
buttonParamaters.click_function = "none"
|
||||||
playerColor = loaded_data[1] or Player.getAvailableColors()[1]
|
buttonParamaters.position = { 0, 0.11, 0.25 }
|
||||||
des = loaded_data[2] or false
|
buttonParamaters.height = 0
|
||||||
|
buttonParamaters.width = 0
|
||||||
|
buttonParamaters.font_size = 120
|
||||||
|
self.createButton(buttonParamaters)
|
||||||
|
|
||||||
-- index 0: button as hand size label
|
-- index 2: button to discard a card
|
||||||
buttonParamaters.hover_color = "White"
|
buttonParamaters.label = "discard random card"
|
||||||
buttonParamaters.click_function = "none"
|
buttonParamaters.click_function = "discardRandom"
|
||||||
buttonParamaters.position = { 0, 0.11, -0.4 }
|
buttonParamaters.position = { 0, 0.11, 0.7 }
|
||||||
buttonParamaters.height = 0
|
buttonParamaters.height = 175
|
||||||
buttonParamaters.width = 0
|
buttonParamaters.width = 900
|
||||||
buttonParamaters.font_size = 500
|
buttonParamaters.font_size = 90
|
||||||
buttonParamaters.font_color = "White"
|
buttonParamaters.font_color = "Black"
|
||||||
self.createButton(buttonParamaters)
|
self.createButton(buttonParamaters)
|
||||||
|
|
||||||
-- index 1: button to toggle "des"
|
updateColors()
|
||||||
buttonParamaters.label = "DES: " .. (des and "✓" or "✗")
|
|
||||||
buttonParamaters.click_function = "toggleDES"
|
|
||||||
buttonParamaters.position = { 0.475, 0.11, 0.25 }
|
|
||||||
buttonParamaters.height = 175
|
|
||||||
buttonParamaters.width = 440
|
|
||||||
buttonParamaters.font_size = 90
|
|
||||||
buttonParamaters.font_color = "Black"
|
|
||||||
self.createButton(buttonParamaters)
|
|
||||||
|
|
||||||
-- index 2: button to discard a card
|
-- start loop to update card count
|
||||||
buttonParamaters.label = "discard random card"
|
loopId = Wait.time(updateValue, 1, -1)
|
||||||
buttonParamaters.click_function = "discardRandom"
|
|
||||||
buttonParamaters.position = { 0, 0.11, 0.7 }
|
|
||||||
buttonParamaters.width = 900
|
|
||||||
self.createButton(buttonParamaters)
|
|
||||||
|
|
||||||
-- index 3: button to select color
|
|
||||||
buttonParamaters.label = playerColor
|
|
||||||
buttonParamaters.color = playerColor
|
|
||||||
buttonParamaters.hover_color = playerColor
|
|
||||||
buttonParamaters.click_function = "changeColor"
|
|
||||||
buttonParamaters.tooltip = "change color"
|
|
||||||
buttonParamaters.position = { -0.475, 0.11, 0.25 }
|
|
||||||
buttonParamaters.width = 440
|
|
||||||
self.createButton(buttonParamaters)
|
|
||||||
|
|
||||||
-- start loop to update card count
|
|
||||||
loopId = Wait.time(||updateValue(), 1, -1)
|
|
||||||
|
|
||||||
-- context menu to quickly bind color
|
|
||||||
self.addContextMenuItem("Bind to my color", function(color)
|
|
||||||
changeColor(_, _, _, color)
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- context menu to display additional information
|
|
||||||
self.addContextMenuItem("More Information", function()
|
|
||||||
printToAll("------------------------------", "White")
|
|
||||||
printToAll("Hand Helper by Chr1Z", "Orange")
|
|
||||||
printToAll("original by Tikatoy", "White")
|
|
||||||
printToAll("Note: 'Hidden' cards can't be randomly discarded.", "Yellow")
|
|
||||||
printToAll("Set them aside beforehand!", "Yellow")
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- initialize the pseudo random number generator
|
|
||||||
math.randomseed(os.time())
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- updates colors when object is dropped somewhere
|
||||||
|
function onDrop() updateColors() end
|
||||||
|
|
||||||
|
-- toggles counting method briefly
|
||||||
function onObjectHover(hover_color, obj)
|
function onObjectHover(hover_color, obj)
|
||||||
-- only continue if correct player hovers over "self"
|
-- only continue if correct player hovers over "self"
|
||||||
if obj ~= self or hover_color ~= playerColor then return end
|
if obj ~= self or hover_color ~= handColor or hovering then return end
|
||||||
|
|
||||||
-- stop loop, toggle "des" and displayed value briefly, then start new loop
|
-- toggle this flag so this doesn't get executed multiple times during the delay
|
||||||
Wait.stop(loopId)
|
hovering = true
|
||||||
des = not des
|
|
||||||
updateValue()
|
-- stop loop, toggle "des" and displayed value briefly, then start new loop after 2s
|
||||||
des = not des
|
Wait.stop(loopId)
|
||||||
loopId = Wait.time(||updateValue(), 1, -1)
|
updateValue(true)
|
||||||
|
Wait.time(function()
|
||||||
|
loopId = Wait.time(updateValue, 1, -1)
|
||||||
|
hovering = false
|
||||||
|
end, 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- toggle "des" and update button label
|
-- updates the matcolor and handcolor variable
|
||||||
function toggleDES()
|
function updateColors()
|
||||||
des = not des
|
matColor = playmatAPI.getMatColorByPosition(self.getPosition())
|
||||||
self.editButton({index = 1, label = "DES: " .. (des and "✓" or "✗")})
|
handColor = playmatAPI.getHandColor(matColor)
|
||||||
updateValue()
|
self.setName(handColor .. " Hand Helper")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- count cards in hand (by name for DES)
|
-- count cards in hand (by name for DES)
|
||||||
function updateValue()
|
function updateValue(toggle)
|
||||||
if not playerExists(playerColor) then return end
|
-- update colors if handColor doesn't own a handzone
|
||||||
|
if Player[handColor].getHandCount() == 0 then
|
||||||
|
updateColors()
|
||||||
|
end
|
||||||
|
|
||||||
local hand = Player[playerColor].getHandObjects()
|
-- if there is still no handzone, then end here
|
||||||
local size = 0
|
if Player[handColor].getHandCount() == 0 then return end
|
||||||
|
|
||||||
if des then
|
-- get state of "Dream-Enhancing Serum" from playermat and update button label
|
||||||
local cardHash = {}
|
local des = playmatAPI.isDES(matColor)
|
||||||
for _, obj in pairs(hand) do
|
if toggle then des = not des end
|
||||||
if obj.tag == "Card" then
|
self.editButton({ index = 1, label = "DES: " .. (des and "✓" or "✗") })
|
||||||
local name = obj.getName()
|
|
||||||
local title = string.match(name, '(.+)(%s%(%d+%))') or name
|
-- count cards in hand
|
||||||
cardHash[title] = obj
|
local hand = Player[handColor].getHandObjects()
|
||||||
end
|
local size = 0
|
||||||
end
|
|
||||||
for _, obj in pairs(cardHash) do
|
if des then
|
||||||
size = size + 1
|
local cardHash = {}
|
||||||
end
|
for _, obj in pairs(hand) do
|
||||||
else
|
if obj.tag == "Card" then
|
||||||
for _, obj in pairs(hand) do
|
local name = obj.getName()
|
||||||
if obj.tag == "Card" then size = size + 1 end
|
local title = string.match(name, '(.+)(%s%(%d+%))') or name
|
||||||
end
|
cardHash[title] = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
-- change button label and color
|
for _, title in pairs(cardHash) do
|
||||||
self.editButton({index = 0, font_color = des and "Green" or "White", label = size})
|
size = size + 1
|
||||||
end
|
|
||||||
|
|
||||||
-- allows change of color via external call
|
|
||||||
function externalColorChange(newColor)
|
|
||||||
changeColor(_, _, _, newColor)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- get index of current color and move up one step (or down for right-click)
|
|
||||||
function changeColor(_, _, isRightClick, color)
|
|
||||||
if color then
|
|
||||||
playerColor = color
|
|
||||||
else
|
|
||||||
local COLORS = Player.getAvailableColors()
|
|
||||||
local pos = indexOf(COLORS, playerColor)
|
|
||||||
|
|
||||||
if isRightClick then
|
|
||||||
if pos == nil or pos == 1 then pos = #COLORS
|
|
||||||
else pos = pos - 1 end
|
|
||||||
else
|
|
||||||
if pos == nil or pos == #COLORS then pos = 1
|
|
||||||
else pos = pos + 1 end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- update playerColor
|
|
||||||
playerColor = COLORS[pos]
|
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
for _, obj in pairs(hand) do
|
||||||
|
if obj.tag == "Card" then size = size + 1 end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- update "change color" button (note: remove and create instantly updates hover_color)
|
-- update button label and color
|
||||||
buttonParamaters.label = playerColor
|
self.editButton({ index = 0, font_color = des and "Green" or "White", label = size })
|
||||||
buttonParamaters.color = playerColor
|
|
||||||
buttonParamaters.hover_color = playerColor
|
|
||||||
self.removeButton(3)
|
|
||||||
self.createButton(buttonParamaters)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------
|
-- discards a random non-hidden card from hand
|
||||||
-- discards a random card from hand
|
|
||||||
---------------------------------------------------------
|
|
||||||
|
|
||||||
function discardRandom()
|
function discardRandom()
|
||||||
if not playerExists(playerColor) then return end
|
playmatAPI.doDiscardOne(matColor)
|
||||||
|
|
||||||
-- error handling: hand is empty
|
|
||||||
local hand = Player[playerColor].getHandObjects()
|
|
||||||
if #hand == 0 then
|
|
||||||
broadcastToAll("Cannot discard from empty hand!", "Red")
|
|
||||||
else
|
|
||||||
local searchPos = Player[playerColor].getHandTransform().position
|
|
||||||
|
|
||||||
local discardPos = playmatAPI.getDiscardPosition(playmatAPI.getMatColorByPosition(searchPos))
|
|
||||||
if discardPos == nil then
|
|
||||||
broadcastToAll("Couldn't retrieve discard position from playermat!", "Red")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local num = math.random(1, #hand)
|
|
||||||
hand[num].setPosition(discardPos)
|
|
||||||
broadcastToAll(playerColor .. " randomly discarded card " .. num .. "/" .. #hand .. ".", "White")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
---------------------------------------------------------
|
|
||||||
-- helper functions
|
|
||||||
---------------------------------------------------------
|
|
||||||
|
|
||||||
-- helper to search array
|
|
||||||
function indexOf(array, value)
|
|
||||||
for i, v in ipairs(array) do
|
|
||||||
if v == value then return i end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- helper to check if player exists
|
|
||||||
function playerExists(color)
|
|
||||||
local COLORS = Player.getAvailableColors()
|
|
||||||
return indexOf(COLORS, color) and true or false
|
|
||||||
end
|
end
|
||||||
|
@ -267,9 +267,7 @@ function handleUnderworldMarket(cardList, playerColor)
|
|||||||
-- Underworld Market found
|
-- Underworld Market found
|
||||||
hasMarket = true
|
hasMarket = true
|
||||||
card.zone = "SetAside3"
|
card.zone = "SetAside3"
|
||||||
elseif (card.metadata.traits ~= nil and string.find(card.metadata.traits, "Illicit", 1, true)
|
elseif card.metadata.traits ~= nil and string.find(card.metadata.traits, "Illicit", 1, true) and card.zone == "Deck" then
|
||||||
and card.metadata.bonded_to == nil
|
|
||||||
and not card.metadata.weakness) then
|
|
||||||
table.insert(illicitList, i)
|
table.insert(illicitList, i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -853,10 +853,10 @@ function applyOptionPanelChange(id, state)
|
|||||||
|
|
||||||
-- option: Show hand helper for each player
|
-- option: Show hand helper for each player
|
||||||
elseif id == "showHandHelper" then
|
elseif id == "showHandHelper" then
|
||||||
optionPanel[id][1] = spawnOrRemoveHelper(state, "Hand Helper", {-50.85, 1.6, 7.32}, {0, 270, 0}, "White")
|
optionPanel[id][1] = spawnOrRemoveHelper(state, "Hand Helper", {-50.85, 1.6, 7.32}, {0, 270, 0})
|
||||||
optionPanel[id][2] = spawnOrRemoveHelper(state, "Hand Helper", {-50.85, 1.6, -24.88}, {0, 270, 0}, "Orange")
|
optionPanel[id][2] = spawnOrRemoveHelper(state, "Hand Helper", {-50.85, 1.6, -24.88}, {0, 270, 0})
|
||||||
optionPanel[id][3] = spawnOrRemoveHelper(state, "Hand Helper", {-39.13, 1.6, 22.45}, {0, 000, 0}, "Green")
|
optionPanel[id][3] = spawnOrRemoveHelper(state, "Hand Helper", {-39.13, 1.6, 22.45}, {0, 000, 0})
|
||||||
optionPanel[id][4] = spawnOrRemoveHelper(state, "Hand Helper", {-21.57, 1.6, -22.45}, {0, 180, 0}, "Red")
|
optionPanel[id][4] = spawnOrRemoveHelper(state, "Hand Helper", {-21.57, 1.6, -22.45}, {0, 180, 0})
|
||||||
|
|
||||||
-- option: Show search assistant for each player
|
-- option: Show search assistant for each player
|
||||||
elseif id == "showSearchAssistant" then
|
elseif id == "showSearchAssistant" then
|
||||||
@ -896,12 +896,11 @@ end
|
|||||||
---@param name String Name of the helper object
|
---@param name String Name of the helper object
|
||||||
---@param position Vector Position of the object (where it will spawn)
|
---@param position Vector Position of the object (where it will spawn)
|
||||||
---@param rotation Vector Rotation of the object for spawning (default: {0, 270, 0})
|
---@param rotation Vector Rotation of the object for spawning (default: {0, 270, 0})
|
||||||
---@param color String This is only needed for correctly setting the color of the "Hand Helper"
|
|
||||||
---@return. GUID of the spawnedObj (or nil if object was removed)
|
---@return. GUID of the spawnedObj (or nil if object was removed)
|
||||||
function spawnOrRemoveHelper(state, name, position, rotation, color)
|
function spawnOrRemoveHelper(state, name, position, rotation)
|
||||||
if state then
|
if state then
|
||||||
Player.getPlayers()[1].pingTable(position)
|
Player.getPlayers()[1].pingTable(position)
|
||||||
return spawnHelperObject(name, position, rotation, color).getGUID()
|
return spawnHelperObject(name, position, rotation).getGUID()
|
||||||
else
|
else
|
||||||
return removeHelperObject(name)
|
return removeHelperObject(name)
|
||||||
end
|
end
|
||||||
@ -910,7 +909,7 @@ end
|
|||||||
-- copies the specified tool (by name) from the barrel
|
-- copies the specified tool (by name) from the barrel
|
||||||
---@param name String Name of the object that should be copied
|
---@param name String Name of the object that should be copied
|
||||||
---@param position Table Desired position of the object
|
---@param position Table Desired position of the object
|
||||||
function spawnHelperObject(name, position, rotation, color)
|
function spawnHelperObject(name, position, rotation)
|
||||||
local barrel = getObjectFromGUID(BARREL_GUID)
|
local barrel = getObjectFromGUID(BARREL_GUID)
|
||||||
|
|
||||||
-- error handling for missing barrel
|
-- error handling for missing barrel
|
||||||
|
@ -499,6 +499,7 @@ function shiftContents(playerColor, direction)
|
|||||||
object.translate(SHIFT_OFFSETS[direction])
|
object.translate(SHIFT_OFFSETS[direction])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Wait.time(drawBaseConnections, 0.1)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Returns the current value of the investigator counter from the playmat
|
-- Returns the current value of the investigator counter from the playmat
|
||||||
|
@ -5,7 +5,7 @@ local tokenChecker = require("core/token/TokenChecker")
|
|||||||
local DEBUG = false
|
local DEBUG = false
|
||||||
|
|
||||||
-- we use this to turn off collision handling until onLoad() is complete
|
-- we use this to turn off collision handling until onLoad() is complete
|
||||||
local COLLISION_ENABLED = false
|
local collisionEnabled = false
|
||||||
|
|
||||||
-- position offsets relative to mat [x, y, z]
|
-- position offsets relative to mat [x, y, z]
|
||||||
local DRAWN_ENCOUNTER_CARD_OFFSET = {1.365, 0.5, -0.635}
|
local DRAWN_ENCOUNTER_CARD_OFFSET = {1.365, 0.5, -0.635}
|
||||||
@ -62,6 +62,9 @@ local RESOURCE_COUNTER
|
|||||||
activeInvestigatorId = "00000"
|
activeInvestigatorId = "00000"
|
||||||
local isDrawButtonVisible = false
|
local isDrawButtonVisible = false
|
||||||
|
|
||||||
|
-- global variable to report "Dream-Enhancing Serum" status
|
||||||
|
isDES = false
|
||||||
|
|
||||||
function onSave()
|
function onSave()
|
||||||
return JSON.encode({
|
return JSON.encode({
|
||||||
zoneID = zoneID,
|
zoneID = zoneID,
|
||||||
@ -122,7 +125,9 @@ function onLoad(save_state)
|
|||||||
showDrawButton(isDrawButtonVisible)
|
showDrawButton(isDrawButtonVisible)
|
||||||
|
|
||||||
if getObjectFromGUID(zoneID) == nil then spawnDeckZone() end
|
if getObjectFromGUID(zoneID) == nil then spawnDeckZone() end
|
||||||
COLLISION_ENABLED = true
|
collisionEnabled = true
|
||||||
|
|
||||||
|
math.randomseed(os.time())
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
@ -409,6 +414,51 @@ function shuffleDiscardIntoDeck()
|
|||||||
discardPile = nil
|
discardPile = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- discard a random non-hidden card from hand
|
||||||
|
function doDiscardOne()
|
||||||
|
local handColor = getHandColor()
|
||||||
|
local hand = Player[handColor].getHandObjects()
|
||||||
|
if #hand == 0 then
|
||||||
|
broadcastToAll("Cannot discard from empty hand!", "Red")
|
||||||
|
else
|
||||||
|
local choices = {}
|
||||||
|
for i = 1, #hand do
|
||||||
|
local notes = JSON.decode(hand[i].getGMNotes())
|
||||||
|
if notes ~= nil then
|
||||||
|
if notes.hidden ~= true then
|
||||||
|
table.insert(choices, i)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
table.insert(choices, i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if #choices == 0 then
|
||||||
|
broadcastToAll("Hidden cards can't be randomly discarded.", "Orange")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- get a random non-hidden card (from the "choices" table)
|
||||||
|
local num = math.random(1, #choices)
|
||||||
|
hand[choices[num]].setPosition(returnGlobalDiscardPosition())
|
||||||
|
broadcastToAll(handColor .. " randomly discarded card " .. choices[num] .. "/" .. #hand .. ".", "White")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- gets the hand color of the closest seated player (by roughly cutting the table into quarters)
|
||||||
|
function getHandColor()
|
||||||
|
for _, handColor in ipairs(Player.getAvailableColors()) do
|
||||||
|
local handPosition = Player[handColor].getHandTransform().position
|
||||||
|
|
||||||
|
if (PLAYER_COLOR == "White" and handPosition.x < -42 and handPosition.z > 0)
|
||||||
|
or (PLAYER_COLOR == "Orange" and handPosition.x < -42 and handPosition.z < 0)
|
||||||
|
or (PLAYER_COLOR == "Green" and handPosition.x > -42 and handPosition.z > 0)
|
||||||
|
or (PLAYER_COLOR == "Red" and handPosition.x > -42 and handPosition.z < 0) then
|
||||||
|
return handColor
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
-- playmat token spawning
|
-- playmat token spawning
|
||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
@ -493,9 +543,14 @@ function spawnTokensFor(object)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function onCollisionEnter(collision_info)
|
function onCollisionEnter(collision_info)
|
||||||
if not COLLISION_ENABLED then return end
|
|
||||||
local object = collision_info.collision_object
|
local object = collision_info.collision_object
|
||||||
|
|
||||||
|
-- detect if "Dream-Enhancing Serum" is placed
|
||||||
|
if object.getName() == "Dream-Enhancing Serum" then isDES = true end
|
||||||
|
|
||||||
|
-- only continue if loading is completed
|
||||||
|
if not collisionEnabled then return end
|
||||||
|
|
||||||
-- only continue for cards
|
-- only continue for cards
|
||||||
if object.name ~= "Card" and object.name ~= "CardCustom" then return end
|
if object.name ~= "Card" and object.name ~= "CardCustom" then return end
|
||||||
|
|
||||||
@ -509,6 +564,11 @@ function onCollisionEnter(collision_info)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- detect if "Dream-Enhancing Serum" is removed
|
||||||
|
function onCollisionExit(collision_info)
|
||||||
|
if collision_info.collision_object.getName() == "Dream-Enhancing Serum" then isDES = false end
|
||||||
|
end
|
||||||
|
|
||||||
function shouldSpawnTokens(card)
|
function shouldSpawnTokens(card)
|
||||||
if card.is_face_down then
|
if card.is_face_down then
|
||||||
return false
|
return false
|
||||||
|
@ -41,6 +41,20 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Returns the color of the player's hand that is seated next to the playermat
|
||||||
|
---@param matColor String Color of the playermat
|
||||||
|
PlaymatApi.getHandColor = function(matColor)
|
||||||
|
local mat = getObjectFromGUID(MAT_IDS[matColor])
|
||||||
|
return mat.call("getHandColor")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Returns if there is the card"Dream-Enhancing Serum" on the requested playermat
|
||||||
|
---@param matColor String Color of the playermat
|
||||||
|
PlaymatApi.isDES = function(matColor)
|
||||||
|
local mat = getObjectFromGUID(MAT_IDS[matColor])
|
||||||
|
return mat.getVar("isDES")
|
||||||
|
end
|
||||||
|
|
||||||
-- Returns the draw deck of the requested playmat
|
-- Returns the draw deck of the requested playmat
|
||||||
---@param matColor String Color of the playermat
|
---@param matColor String Color of the playermat
|
||||||
PlaymatApi.getDrawDeck = function(matColor)
|
PlaymatApi.getDrawDeck = function(matColor)
|
||||||
@ -116,6 +130,13 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Discard a non-hidden card from the corresponding player's hand
|
||||||
|
PlaymatApi.doDiscardOne = function(matColor)
|
||||||
|
for _, mat in ipairs(internal.getMatForColor(matColor)) do
|
||||||
|
mat.call("doDiscardOne")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Convenience function to look up a mat's object by color, or get all mats.
|
-- Convenience function to look up a mat's object by color, or get all mats.
|
||||||
---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also
|
---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also
|
||||||
-- accepts "All" as a special value which will return all four mats.
|
-- accepts "All" as a special value which will return all four mats.
|
||||||
|
Loading…
Reference in New Issue
Block a user