fixed multiseal and save/load
This commit is contained in:
parent
286f873ded
commit
f190d3ccea
@ -85,7 +85,7 @@ function initializeState()
|
||||
-- find tokens in the play area
|
||||
for _, obj in ipairs(getObjects()) do
|
||||
local pos = obj.getPosition()
|
||||
if pos.x > -50 and pos.x < 50 and pos.z > 8 and pos.z < 50 then
|
||||
if pos.x > -65 and pos.x < 10 and pos.z > -35 and pos.z < 35 then
|
||||
if obj.getName() == "Bless" then
|
||||
table.insert(tokensTaken.Bless, obj.getGUID())
|
||||
numInPlay.Bless = numInPlay.Bless + 1
|
||||
|
@ -14,7 +14,7 @@ SHOW_SINGLE_RELEASE --@type: boolean
|
||||
|
||||
SHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)
|
||||
- enables an entry in the context menu
|
||||
- this enty allows releasing of multiple tokens at once
|
||||
- this entry allows releasing of multiple tokens at once
|
||||
- example usage: "Nephthys" (to release 3 bless tokens at once)
|
||||
|
||||
SHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)
|
||||
@ -44,25 +44,23 @@ Example 1: Crystalline Elder Sign
|
||||
This card can only seal the "+1" or "Elder Sign" token,
|
||||
it does not need specific options for multi-sealing or releasing.
|
||||
Thus it should be implemented like this:
|
||||
|
||||
> VALID_TOKENS = {
|
||||
> ["+1"] = true,
|
||||
> ["Elder Sign"] = true
|
||||
> }
|
||||
> require ("playercards/CardsThatSealTokens") -- includes a space after "require" to not executing bundling
|
||||
> VALID_TOKENS = {
|
||||
> ["+1"] = true,
|
||||
> ["Elder Sign"] = true
|
||||
> }
|
||||
> require ("playercards/CardsThatSealTokens") -- includes a space after "require" to not executing bundling
|
||||
----------------------------------------------------------
|
||||
Example 2: Holy Spear
|
||||
This card features the following abilities (just listing the relevant parts):
|
||||
- releasing a single bless token
|
||||
- sealing two bless tokens
|
||||
Thus it should be implemented like this:
|
||||
|
||||
> VALID_TOKENS = {
|
||||
> ["Bless"] = true
|
||||
> }
|
||||
> SHOW_SINGLE_RELEASE = true
|
||||
> SHOW_MULTI_SEAL = 2
|
||||
> require ("playercards/CardsThatSealTokens") -- includes a space after "require" to not executing bundling
|
||||
> VALID_TOKENS = {
|
||||
> ["Bless"] = true
|
||||
> }
|
||||
> SHOW_SINGLE_RELEASE = true
|
||||
> SHOW_MULTI_SEAL = 2
|
||||
> require ("playercards/CardsThatSealTokens") -- includes a space after "require" to not executing bundling
|
||||
----------------------------------------------------------]]
|
||||
|
||||
local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
|
||||
@ -169,24 +167,29 @@ function sealToken(name, playerColor)
|
||||
end
|
||||
|
||||
-- release the last sealed token
|
||||
function releaseOneToken(playerColor)
|
||||
function releaseOneToken(playerColor, doPrint)
|
||||
if not Global.call("canTouchChaosTokens") then return end
|
||||
if #sealedTokens == 0 then
|
||||
printToColor("No sealed token(s) found", playerColor)
|
||||
if doPrint or doPrint == nil then
|
||||
printToColor("No sealed token(s) found", playerColor)
|
||||
end
|
||||
else
|
||||
printToColor("Releasing token", playerColor)
|
||||
if doPrint or doPrint == nil then
|
||||
printToColor("Releasing token", playerColor)
|
||||
end
|
||||
putTokenAway(table.remove(sealedTokens))
|
||||
end
|
||||
end
|
||||
|
||||
-- release multiple tokens at once
|
||||
function releaseMultipleTokens(playerColor)
|
||||
if SHOW_MULTI_RELEASE >= #sealedTokens then
|
||||
if SHOW_MULTI_RELEASE <= #sealedTokens then
|
||||
for i = 1, SHOW_MULTI_RELEASE do
|
||||
releaseOneToken(playerColor)
|
||||
releaseOneToken(playerColor, false)
|
||||
end
|
||||
printToColor("Releasing tokens", playerColor)
|
||||
else
|
||||
printToColor("Not enough " .. name .. " tokens sealed.", playerColor)
|
||||
printToColor("Not enough tokens sealed.", playerColor)
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user