renamed function, limited it to sealed tokens

This commit is contained in:
Chr1Z93 2023-06-27 10:09:50 +02:00
parent f82d29b9e0
commit 57cdd5ef71
3 changed files with 9 additions and 10 deletions

View File

@ -173,7 +173,7 @@ function cleanUp(_, color)
removeLines()
discardHands()
tokenSpawnTrackerApi.resetAll()
Global.call("findAllChaosTokens")
Global.call("releaseAllSealedTokens", color)
printToAll("Tidying main play area...", "White")
startLuaCoroutine(self, "tidyPlayareaCoroutine")

View File

@ -646,16 +646,13 @@ function emptyChaosBag()
end
end
-- move all regular chaos tokens that are on the table to the chaos bag (e.g. sealed on cards)
function findAllChaosTokens()
-- returns all sealed tokens on cards to the chaos bag
function releaseAllSealedTokens(playerColor)
local chaosbag = findChaosBag()
for _, obj in ipairs(getObjects()) do
local name = obj.getName()
if tokenChecker.isChaosToken(obj) and
not obj.hasTag("tempToken") and
name ~= "Bless" and
name ~= "Curse" then
chaosbag.putObject(obj)
local sealedTokens = obj.getTable("sealedTokens")
if sealedTokens ~= nil and #sealedTokens > 0 then
obj.call("releaseAllTokens", playerColor)
end
end
end

View File

@ -70,10 +70,12 @@ Thus it should be implemented like this:
local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
local tokenArrangerApi = require("accessories/TokenArrangerApi")
local sealedTokens = {}
local ID_URL_MAP = {}
local tokensInBag = {}
-- this is intentionally global so that it can be accessed for clean up
sealedTokens = {}
function onSave() return JSON.encode(sealedTokens) end
function onLoad(savedData)