From b6d74ac2057acc2f74484ecd65dfb25fd2fc2ed1 Mon Sep 17 00:00:00 2001 From: Entrox-Licher Date: Mon, 3 Jul 2023 10:53:07 -0400 Subject: [PATCH] Implemented new feature for releasing sealed tokens and clearing bless/curse --- src/accessories/CampaignImporterExporter.ttslua | 7 ++++++- src/accessories/CleanUpHelper.ttslua | 3 ++- src/chaosbag/ChaosBagApi.ttslua | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/accessories/CampaignImporterExporter.ttslua b/src/accessories/CampaignImporterExporter.ttslua index a2d3463b..0304376d 100644 --- a/src/accessories/CampaignImporterExporter.ttslua +++ b/src/accessories/CampaignImporterExporter.ttslua @@ -58,6 +58,7 @@ function onLoad(save_state) playAreaAPI = require("core/PlayAreaApi") deckImporterApi = require("arkhamdb/DeckImporterApi") optionPanelApi = require("core/OptionPanelApi") + blessCurseApi = require("chaosbag/BlessCurseManagerApi") campaignBoxGUID = "" self.createButton({ @@ -177,7 +178,11 @@ end -- Creates a campaign token with save data encoded into GM Notes based on the current state of the table -function createCampaignToken(_, _, _) +function createCampaignToken(_, playerColor, _) + -- clean up chaos tokens + blessCurseApi.removeAll(playerColor) + chaosBagApi.releaseAllSealedTokens(playerColor) + local campaignBoxGUID = "" -- find active campaign for _, obj in ipairs(getObjectsWithTag("CampaignBox")) do diff --git a/src/accessories/CleanUpHelper.ttslua b/src/accessories/CleanUpHelper.ttslua index d719d488..031c79f6 100644 --- a/src/accessories/CleanUpHelper.ttslua +++ b/src/accessories/CleanUpHelper.ttslua @@ -7,6 +7,7 @@ local tokenSpawnTrackerApi = require("core/token/TokenSpawnTrackerApi") local soundCubeApi = require("core/SoundCubeApi") local playmatApi = require("playermat/PlaymatApi") local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi") +local chaosBagApi = require("chaosbag/ChaosBagApi") -- these objects will be ignored local IGNORE_GUIDS = { @@ -173,7 +174,7 @@ function cleanUp(_, color) removeLines() discardHands() tokenSpawnTrackerApi.resetAll() - Global.call("releaseAllSealedTokens", color) + chaosBagApi.releaseAllSealedTokens(color) printToAll("Tidying main play area...", "White") startLuaCoroutine(self, "tidyPlayareaCoroutine") diff --git a/src/chaosbag/ChaosBagApi.ttslua b/src/chaosbag/ChaosBagApi.ttslua index 5e8ccc1f..e2d0a1ae 100644 --- a/src/chaosbag/ChaosBagApi.ttslua +++ b/src/chaosbag/ChaosBagApi.ttslua @@ -23,5 +23,10 @@ do return Global.call("findChaosBag") end + -- returns all sealed tokens on cards to the chaos bag + ChaosBagApi.releaseAllSealedTokens = function(playerColor) + return Global.call("releaseAllSealedTokens", playerColor) + end + return ChaosBagApi end \ No newline at end of file