Merge pull request #279 from argonui/multiseal-bugfix

Bless/Curse: fixed multiseal and save/load
This commit is contained in:
Chr1Z 2023-05-12 00:37:30 +02:00 committed by GitHub
commit b8a2657c24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 18 deletions

View File

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

View File

@ -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
> require...
----------------------------------------------------------
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
> require...
----------------------------------------------------------]]
local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
@ -181,12 +179,13 @@ 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)
putTokenAway(table.remove(sealedTokens))
end
printToColor("Releasing " .. SHOW_MULTI_RELEASE .. " tokens", playerColor)
else
printToColor("Not enough " .. name .. " tokens sealed.", playerColor)
printToColor("Not enough tokens sealed.", playerColor)
end
end