From 3aa3ebd0cbda6b49143fd238ba871fbb611846c9 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Sun, 7 May 2023 16:22:10 +0200 Subject: [PATCH] improved code --- src/playercards/CardsThatSealTokens.ttslua | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/playercards/CardsThatSealTokens.ttslua b/src/playercards/CardsThatSealTokens.ttslua index 3c4e9145..876cfff7 100644 --- a/src/playercards/CardsThatSealTokens.ttslua +++ b/src/playercards/CardsThatSealTokens.ttslua @@ -48,7 +48,7 @@ Thus it should be implemented like this: > ["+1"] = true, > ["Elder Sign"] = true > } - > require ("playercards/CardsThatSealTokens") -- includes a space after "require" to not executing bundling + > require... ---------------------------------------------------------- Example 2: Holy Spear This card features the following abilities (just listing the relevant parts): @@ -60,7 +60,8 @@ Thus it should be implemented like this: > } > SHOW_SINGLE_RELEASE = true > SHOW_MULTI_SEAL = 2 - > require ("playercards/CardsThatSealTokens") -- includes a space after "require" to not executing bundling + > require... +----------------------------------------------------------]] ----------------------------------------------------------]] local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi") @@ -167,16 +168,12 @@ function sealToken(name, playerColor) end -- release the last sealed token -function releaseOneToken(playerColor, doPrint) +function releaseOneToken(playerColor) if not Global.call("canTouchChaosTokens") then return end if #sealedTokens == 0 then - if doPrint or doPrint == nil then - printToColor("No sealed token(s) found", playerColor) - end + printToColor("No sealed token(s) found", playerColor) else - if doPrint or doPrint == nil then - printToColor("Releasing token", playerColor) - end + printToColor("Releasing token", playerColor) putTokenAway(table.remove(sealedTokens)) end end @@ -185,9 +182,9 @@ end function releaseMultipleTokens(playerColor) if SHOW_MULTI_RELEASE <= #sealedTokens then for i = 1, SHOW_MULTI_RELEASE do - releaseOneToken(playerColor, false) + putTokenAway(table.remove(sealedTokens)) end - printToColor("Releasing tokens", playerColor) + printToColor("Releasing " .. SHOW_MULTI_RELEASE .. " tokens", playerColor) else printToColor("Not enough tokens sealed.", playerColor) end