From 2a1033c5c4676c1128de8fcc955f0420e18272fe Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Sat, 8 Apr 2023 20:04:30 +0200 Subject: [PATCH] resolving review comments --- src/chaosbag/BlessCurseManager.ttslua | 10 +++++----- src/playercards/CardsThatSealTokens.ttslua | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/chaosbag/BlessCurseManager.ttslua b/src/chaosbag/BlessCurseManager.ttslua index 7add1972..a11910a6 100644 --- a/src/chaosbag/BlessCurseManager.ttslua +++ b/src/chaosbag/BlessCurseManager.ttslua @@ -134,8 +134,8 @@ function doRemove(color) broadcastToColor("Removed " .. count.Bless .. " Bless and " .. count.Curse .. " Curse tokens from the chaos bag.", color, "White") - broadcastToColor("Removed " .. removeType("Bless") .. " Bless and " .. - removeType("Curse") .. " Curse tokens from play.", color, "White") + broadcastToColor("Removed " .. removeTakenTokens("Bless") .. " Bless and " .. + removeTakenTokens("Curse") .. " Curse tokens from play.", color, "White") doReset(color) end @@ -150,7 +150,7 @@ function doReset(color) end -- removing tokens that were 'taken' -function removeType(type) +function removeTakenTokens(type) local count = 0 for _, guid in ipairs(tokensTaken[type]) do local token = getObjectFromGUID(guid) @@ -268,10 +268,10 @@ function releasedToken(param) end if not updating then updating = true - Wait.time(function() + Wait.frames(function() broadcastCount(param.type) updating = false - end, 0.1) + end, 1) end end diff --git a/src/playercards/CardsThatSealTokens.ttslua b/src/playercards/CardsThatSealTokens.ttslua index 9d3b7586..aab8aebb 100644 --- a/src/playercards/CardsThatSealTokens.ttslua +++ b/src/playercards/CardsThatSealTokens.ttslua @@ -69,7 +69,7 @@ local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi") local tokenArrangerApi = require("accessories/TokenArrangerApi") local sealedTokens = {} local ID_URL_MAP = {} -tokensInBag = {} +local tokensInBag = {} function onSave() return JSON.encode(sealedTokens) end @@ -189,6 +189,7 @@ function releaseMultipleTokens(playerColor) printToColor("Not enough " .. name .. " tokens sealed.", playerColor) end end + -- releases all sealed tokens function releaseAllTokens(playerColor) if not Global.call("canTouchChaosTokens") then return end