improved code

This commit is contained in:
Chr1Z93 2023-05-07 16:22:10 +02:00
parent f190d3ccea
commit 3aa3ebd0cb

View File

@ -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