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() removeLines()
discardHands() discardHands()
tokenSpawnTrackerApi.resetAll() tokenSpawnTrackerApi.resetAll()
Global.call("findAllChaosTokens") Global.call("releaseAllSealedTokens", color)
printToAll("Tidying main play area...", "White") printToAll("Tidying main play area...", "White")
startLuaCoroutine(self, "tidyPlayareaCoroutine") startLuaCoroutine(self, "tidyPlayareaCoroutine")

View File

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

View File

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