Merge branch 'main' into damage-horror

This commit is contained in:
Chr1Z93 2024-09-01 16:00:44 +02:00
commit 34538cfca1
5 changed files with 40 additions and 12 deletions

View File

@ -22,6 +22,13 @@
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/949592555964782208/CC876694A6684B3C2680CE2FE3259F574AE0AD97/",
"WidthScale": 0
},
"CustomUIAssets": [
{
"Name": "font_teutonic-arkham",
"Type": 1,
"URL": "https://steamusercontent-a.akamaihd.net/ugc/2027213118467703445/89328E273B4C5180BF491516CE998DE3C604E162/"
}
],
"Description": "",
"DragSelectable": true,
"GMNotes": "",

View File

@ -422,7 +422,7 @@ end
-- get value with respect to override value
function getOptionValue()
-- don't clean up playermats if playing a prelude from the list
if preludeList[scenarioName] then
if scenarioName and preludeList[scenarioName] then
return false
else
return options["tidyPlayermats"]

View File

@ -10,6 +10,7 @@ local options = {
}
val = 0
self.max_typed_number = 99
-- save current value and options
function onSave() return JSON.encode({ val, options }) end
@ -22,7 +23,7 @@ function onLoad(savedData)
-- restore state for option panel
for key, bool in pairs(options) do
self.UI.setAttribute("option" .. key, "isOn", not bool)
if bool == false then changeLabel(key) end
end
end
@ -65,6 +66,10 @@ function updateVal(number)
end
end
function onNumberTyped(_, number)
updateVal(number)
end
-- called by updateVal and addVal to broadcast total doom in play, including doom threshold
function broadcastDoom(val)
local doomInPlayCounter = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DoomInPlayCounter")
@ -122,6 +127,7 @@ end
-- XML UI functions
function optionClick(_, optionName)
options[optionName] = not options[optionName]
changeLabel(optionName)
printToAll("Doom removal of " .. optionName .. (options[optionName] and " enabled" or " disabled"))
end
@ -134,3 +140,12 @@ function toggleOptions()
self.UI.hide("Options")
end
end
function changeLabel(optionName)
local label = self.UI.getAttribute("option" .. optionName, "text")
if options[optionName] == true then
self.UI.setAttribute("option" .. optionName, "text", string.gsub(label, "☐", "☑"))
else
self.UI.setAttribute("option" .. optionName, "text", string.gsub(label, "☑", "☐"))
end
end

View File

@ -250,6 +250,7 @@ function releaseOneToken(playerColor)
putTokenAway(table.remove(sealedTokens))
updateSave()
end
Player[playerColor].clearSelectedObjects()
end
-- release up to multiple tokens at once with no minimum
@ -269,6 +270,7 @@ function releaseMultipleTokens(playerColor)
end
updateSave()
printToColor("Releasing " .. numRemoved .. " tokens", playerColor)
Player[playerColor].clearSelectedObjects()
end
-- releases all sealed tokens
@ -284,6 +286,7 @@ function releaseAllTokens(playerColor)
sealedTokens = {}
updateSave()
end
Player[playerColor].clearSelectedObjects()
end
-- returns multiple tokens at once to the token pool
@ -297,6 +300,7 @@ function returnMultipleTokens(playerColor)
else
printToColor("Not enough tokens sealed.", playerColor)
end
Player[playerColor].clearSelectedObjects()
end
-- returns the token (referenced by GUID) to the chaos bag
@ -328,7 +332,7 @@ function returnToken(guid)
end
-- resolves sealed token as if it came from the chaos bag
function resolveSealed()
function resolveSealed(playerColor)
if #sealedTokens == 0 then
broadcastToAll("No tokens sealed.", "Red")
return
@ -341,6 +345,7 @@ function resolveSealed()
updateStackSize()
updateSave()
chaosBagApi.drawChaosToken(mat, true, _, guidToBeResolved)
Player[playerColor].clearSelectedObjects()
end
function updateStackSize()

View File

@ -1,25 +1,26 @@
<Defaults>
<Panel rotation="0 0 180"></Panel>
<ToggleButton class="optionButton" colors="#50e610|#f2d82e|#f2d82e" fontSize="45" isOn="0" textAlignment="MiddleLeft" padding="30 30 0 0"></ToggleButton>
<Button class="optionButton" fontSize="64" isOn="0" textAlignment="MiddleLeft" padding="20 20 0 0"></Button>
<Button font="font_teutonic-arkham" colors="#88e3cf|#4f8478|#303836"></Button>
</Defaults>
<Panel id="Buttons" offsetXY="0 285">
<TableLayout height="150" width="500" cellSpacing="10">
<TableLayout height="150" width="545" cellSpacing="10">
<Row>
<Cell columnSpan="3">
<Button onClick="startReset" fontSize="80">Reset</Button>
<Button onClick="startReset" fontSize="125">Reset</Button>
</Cell>
<Cell>
<ToggleButton onClick="toggleOptions" fontSize="55"></ToggleButton>
<Button onClick="toggleOptions" fontSize="65"></Button>
</Cell>
</Row>
</TableLayout>
</Panel>
<Panel id="Options" offsetXY="0 535" active="false" showAnimation="Grow" hideAnimation="Shrink">
<VerticalLayout height="300" width="500" spacing="10" childAlignment="MiddleCenter">
<ToggleButton class="optionButton" id="optionAgenda" onClick="optionClick(Agenda)">Doom on Agenda</ToggleButton>
<ToggleButton class="optionButton" id="optionPlayarea" onClick="optionClick(Playarea)">Doom in Playarea</ToggleButton>
<ToggleButton class="optionButton" id="optionPlayermats" onClick="optionClick(Playermats)">Doom on Playermats</ToggleButton>
<Panel id="Options" offsetXY="0 545" active="false" showAnimation="Grow" hideAnimation="Shrink">
<VerticalLayout height="300" width="545" spacing="10" childAlignment="MiddleCenter">
<Button class="optionButton" id="optionAgenda" text="☑ Doom on Agenda" onClick="optionClick(Agenda)"></Button>
<Button class="optionButton" id="optionPlayarea" text="☑ Doom in Play Area" onClick="optionClick(Playarea)"></Button>
<Button class="optionButton" id="optionPlayermats" text="☑ Doom on Playermats" onClick="optionClick(Playermats)"></Button>
</VerticalLayout>
</Panel>