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, > ["+1"] = true,
> ["Elder Sign"] = true > ["Elder Sign"] = true
> } > }
> require ("playercards/CardsThatSealTokens") -- includes a space after "require" to not executing bundling > require...
---------------------------------------------------------- ----------------------------------------------------------
Example 2: Holy Spear Example 2: Holy Spear
This card features the following abilities (just listing the relevant parts): 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_SINGLE_RELEASE = true
> SHOW_MULTI_SEAL = 2 > SHOW_MULTI_SEAL = 2
> require ("playercards/CardsThatSealTokens") -- includes a space after "require" to not executing bundling > require...
----------------------------------------------------------]]
----------------------------------------------------------]] ----------------------------------------------------------]]
local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi") local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
@ -167,16 +168,12 @@ function sealToken(name, playerColor)
end end
-- release the last sealed token -- release the last sealed token
function releaseOneToken(playerColor, doPrint) function releaseOneToken(playerColor)
if not Global.call("canTouchChaosTokens") then return end if not Global.call("canTouchChaosTokens") then return end
if #sealedTokens == 0 then if #sealedTokens == 0 then
if doPrint or doPrint == nil then printToColor("No sealed token(s) found", playerColor)
printToColor("No sealed token(s) found", playerColor)
end
else else
if doPrint or doPrint == nil then printToColor("Releasing token", playerColor)
printToColor("Releasing token", playerColor)
end
putTokenAway(table.remove(sealedTokens)) putTokenAway(table.remove(sealedTokens))
end end
end end
@ -185,9 +182,9 @@ end
function releaseMultipleTokens(playerColor) function releaseMultipleTokens(playerColor)
if SHOW_MULTI_RELEASE <= #sealedTokens then if SHOW_MULTI_RELEASE <= #sealedTokens then
for i = 1, SHOW_MULTI_RELEASE do for i = 1, SHOW_MULTI_RELEASE do
releaseOneToken(playerColor, false) putTokenAway(table.remove(sealedTokens))
end end
printToColor("Releasing tokens", playerColor) printToColor("Releasing " .. SHOW_MULTI_RELEASE .. " tokens", playerColor)
else else
printToColor("Not enough tokens sealed.", playerColor) printToColor("Not enough tokens sealed.", playerColor)
end end