Merge pull request #378 from argonui/uses-spawning

Uses spawning: additional option
This commit is contained in:
BootleggerFinn 2023-09-25 15:52:31 -05:00 committed by GitHub
commit 90122b4d70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 160 additions and 26 deletions

View File

@ -6,5 +6,12 @@
"level": 0,
"traits": "Item. Occult. Tome.",
"intellectIcons": 1,
"uses": [
{
"count": 0,
"type": "Secret",
"token": "resource"
}
],
"cycle": "The Path to Carcosa"
}

View File

@ -6,5 +6,12 @@
"level": 0,
"traits": "Item. Tome. Occult.",
"wildIcons": 1,
"uses": [
{
"count": 0,
"type": "Leyline",
"token": "resource"
}
],
"cycle": "Edge of the Earth"
}

View File

@ -7,5 +7,12 @@
"traits": "Ritual.",
"willpowerIcons": 1,
"agilityIcons": 1,
"uses": [
{
"count": 0,
"type": "Click",
"token": "resource"
}
],
"cycle": "The Forgotten Age"
}

View File

@ -7,5 +7,12 @@
"traits": "Item. Tome. Blessed.",
"willpowerIcons": 1,
"intellectIcons": 1,
"uses": [
{
"count": 0,
"type": "Secret",
"token": "resource"
}
],
"cycle": "The Innsmouth Conspiracy"
}

View File

@ -7,5 +7,12 @@
"traits": "Item. Tome. Cursed.",
"intellectIcons": 1,
"agilityIcons": 1,
"uses": [
{
"count": 0,
"type": "Secret",
"token": "resource"
}
],
"cycle": "The Innsmouth Conspiracy"
}

View File

@ -8,5 +8,12 @@
"intellectIcons": 1,
"agilityIcons": 1,
"wildIcons": 1,
"uses": [
{
"count": 0,
"type": "Evidence",
"token": "resource"
}
],
"cycle": "The Scarlet Keys"
}

View File

@ -6,5 +6,12 @@
"level": 0,
"traits": "Item. Tool. Science.",
"agilityIcons": 1,
"uses": [
{
"count": 0,
"type": "Evidence",
"token": "resource"
}
],
"cycle": "The Scarlet Keys"
}

View File

@ -6,6 +6,13 @@
"level": 0,
"traits": "Talent. Science.",
"intellectIcons": 1,
"uses": [
{
"count": 0,
"type": "Evidence",
"token": "resource"
}
],
"customizations": [
{
"name": "Pessimistic Outlook",

View File

@ -5,5 +5,12 @@
"cost": 1,
"traits": "Item. Relic.",
"wildIcons": 2,
"uses": [
{
"count": 0,
"type": "Offering",
"token": "resource"
}
],
"cycle": "Promo"
}

View File

@ -6,5 +6,12 @@
"level": 0,
"traits": "Item. Tool.",
"willpowerIcons": 1,
"uses": [
{
"count": 0,
"type": "Evidence",
"token": "resource"
}
],
"cycle": "The Circle Undone"
}

View File

@ -8,5 +8,12 @@
"intellectIcons": 1,
"combatIcons": 1,
"wildIcons": 1,
"uses": [
{
"count": 0,
"type": "Evidence",
"token": "resource"
}
],
"cycle": "Edge of the Earth"
}

View File

@ -6,5 +6,13 @@
"level": 4,
"traits": "Ritual. Blessed. Cursed.",
"wildIcons": 1,
"uses": [
{
"count": 0,
"type": "Corruption",
"token": "resource"
}
],
"cycle": "The Innsmouth Conspiracy"
}

View File

@ -6,5 +6,12 @@
"level": 0,
"traits": "Item. Tome. Science.",
"intellectIcons": 1,
"uses": [
{
"count": 0,
"type": "Evidence",
"token": "resource"
}
],
"cycle": "The Scarlet Keys"
}

View File

@ -5,5 +5,12 @@
"level": 3,
"traits": "Ritual.",
"permanent": true,
"uses": [
{
"count": 0,
"type": "Offering",
"token": "resource"
}
],
"cycle": "The Scarlet Keys"
}

View File

@ -12,5 +12,12 @@
}
],
"combatIcons": 1,
"uses": [
{
"count": 0,
"type": "Offering",
"token": "resource"
}
],
"cycle": "The Dream-Eaters"
}

View File

@ -1 +1 @@
{"acknowledgedUpgradeVersions":[],"optionPanel":{"cardLanguage":"en","playAreaSnapTags":true,"showAttachmentHelper":false,"showCleanUpHelper":false,"showCustomPlaymatImages":false,"showCYOA":false,"showDisplacementTool":false,"showDrawButton":false,"showHandHelper":[],"showSearchAssistant":[],"showTitleSplash":true,"useClueClickers":false,"useSnapTags":true}}
{"acknowledgedUpgradeVersions":[],"optionPanel":{"cardLanguage":"en","playAreaSnapTags":true,"showAttachmentHelper":false,"showCleanUpHelper":false,"showCustomPlaymatImages":false,"showCYOA":false,"showDisplacementTool":false,"showDrawButton":false,"showHandHelper":[],"showSearchAssistant":[],"showTitleSplash":true,"useClueClickers":false,"useResourceCounters":"disabled","useSnapTags":true}}

View File

@ -1,3 +1,13 @@
local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
local mythosAreaApi = require("core/MythosAreaApi")
local navigationOverlayApi = require("core/NavigationOverlayApi")
local playAreaApi = require("core/PlayAreaApi")
local playmatApi = require("playermat/PlaymatApi")
local soundCubeApi = require("core/SoundCubeApi")
local tokenArrangerApi = require("accessories/TokenArrangerApi")
local tokenChecker = require("core/token/TokenChecker")
local tokenManager = require("core/token/TokenManager")
---------------------------------------------------------
-- general setup
---------------------------------------------------------
@ -5,9 +15,6 @@
ENCOUNTER_DECK_POS = {-3.93, 1, 5.76}
ENCOUNTER_DECK_DISCARD_POSITION = {-3.85, 1, 10.38}
-- optionPanel data
optionPanel = {}
-- GUID of data helper
DATA_HELPER_GUID = "708279"
@ -31,15 +38,6 @@ local IS_RESHUFFLING = false
local bagSearchers = {}
local MAT_COLORS = {"White", "Orange", "Green", "Red"}
local hideTitleSplashWaitFunctionId = nil
local playmatApi = require("playermat/PlaymatApi")
local tokenManager = require("core/token/TokenManager")
local playAreaAPI = require("core/PlayAreaApi")
local soundCubeApi = require("core/SoundCubeApi")
local mythosAreaApi = require("core/MythosAreaApi")
local tokenArrangerApi = require("accessories/TokenArrangerApi")
local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
local navigationOverlayApi = require("core/NavigationOverlayApi")
local tokenChecker = require("core/token/TokenChecker")
-- online functionality related variables
local MOD_VERSION = "3.2.0"
@ -47,6 +45,8 @@ local SOURCE_REPO = 'https://raw.githubusercontent.com/chr1z93/loadable-objects/
local library, requestObj, modMeta, notificationVisible
local acknowledgedUpgradeVersions = {}
-- optionPanel data
optionPanel = {}
local LANGUAGES = {
{ code = "zh_CN", name = "简体中文" },
{ code = "zh_TW", name = "繁體中文" },
@ -56,6 +56,11 @@ local LANGUAGES = {
{ code = "fr", name = "Français" },
{ code = "it", name = "Italiano" }
}
local RESOURCE_OPTIONS = {
"enabled",
"custom",
"disabled"
}
---------------------------------------------------------
-- data for tokens
@ -170,7 +175,7 @@ end
-- This requires the try method as cards won't exist any more after they enter a deck, so the lines
-- can't be cleared.
function tryObjectEnterContainer(container, object)
playAreaAPI.tryObjectEnterContainer(container, object)
playAreaApi.tryObjectEnterContainer(container, object)
return true
end
@ -900,12 +905,29 @@ function returnLanguageId(code)
end
end
-- called by the resource counter selection dropdown
function resourceCounterSelected(_, selectedIndex, id)
optionPanel[id] = RESOURCE_OPTIONS[tonumber(selectedIndex) + 1]
end
-- returns the ID for the provided option name
function returnResourceCounterId(name)
for index, optionName in ipairs(RESOURCE_OPTIONS) do
if optionName == name then
return index
end
end
end
-- sets the option panel to the correct state (corresponding to 'optionPanel')
function updateOptionPanelState()
for id, optionValue in pairs(optionPanel) do
if id == "cardLanguage" and type(optionValue) == "string" then
local dropdownId = returnLanguageId(optionValue) - 1
UI.setAttribute(id, "value", dropdownId)
elseif id == "useResourceCounters" and type(optionValue) == "string" then
local dropdownId = returnResourceCounterId(optionValue) - 1
UI.setAttribute(id, "value", dropdownId)
elseif (type(optionValue) == "boolean" and optionValue)
or (type(optionValue) == "string" and optionValue)
or (type(optionValue) == "table" and #optionValue ~= 0) then
@ -938,13 +960,9 @@ function applyOptionPanelChange(id, state)
-- update master clue counter
getObjectFromGUID("4a3aa4").setVar("useClickableCounters", state)
-- option: Clickable resource counters
elseif id == "useResourceCounters" then
optionPanel[id] = state
-- option: Play area snap tags
elseif id == "playAreaSnapTags" then
playAreaAPI.setLimitSnapsByType(state)
playAreaApi.setLimitSnapsByType(state)
optionPanel[id] = state
-- option: Show Title on placing scenarios
@ -1086,8 +1104,9 @@ function onClick_defaultSettings()
applyOptionPanelChange(id, state)
end
-- clean reset of variable
-- clean reset of variables
optionPanel = {
cardLanguage = "en",
playAreaSnapTags = true,
showAttachmentHelper = false,
showCleanUpHelper = false,
@ -1099,6 +1118,7 @@ function onClick_defaultSettings()
showSearchAssistant = {},
showTitleSplash = true,
useClueClickers = false,
useResourceCounters = "disabled",
useSnapTags = true
}

View File

@ -166,7 +166,9 @@ do
if tokenType == "damage" or tokenType == "horror" then
TokenManager.spawnCounterToken(card, tokenType, tokenCount, shiftDown)
elseif tokenType == "resource" and optionPanel["useResourceCounters"] then
elseif tokenType == "resource" and optionPanel["useResourceCounters"] == "enabled" then
TokenManager.spawnResourceCounterToken(card, tokenCount)
elseif tokenType == "resource" and optionPanel["useResourceCounters"] == "custom" and tokenCount == 0 then
TokenManager.spawnResourceCounterToken(card, tokenCount)
else
TokenManager.spawnMultipleTokens(card, tokenType, tokenCount, shiftDown, subType)

View File

@ -216,15 +216,21 @@
<!-- Option: use clickable resource counters -->
<Row class="option-text">
<Cell class="option-text">
<Cell class="option-dropdowntext">
<VerticalLayout class="text-column">
<Text class="option-header">Use clickable resource tokens</Text>
<Text class="description">This enables spawning of clickable resource tokens for player cards.</Text>
<Text class="description">This enables spawning of clickable resource tokens for player cards. (Chef's Selection = assets with 0 uses)</Text>
</VerticalLayout>
</Cell>
<Cell class="option-button">
<Toggle id="useResourceCounters"
onValueChanged="onClick_toggleOption(useResourceCounters)"/>
<Cell class="option-dropdown">
<Panel padding="0 17 13 13">
<Dropdown id="useResourceCounters"
onValueChanged="resourceCounterSelected(selectedIndex)">
<Option>Enabled</Option>
<Option>Chef's Selection</Option>
<Option>Disabled</Option>
</Dropdown>
</Panel>
</Cell>
</Row>