Merge pull request #785 from dscarpac/seal-fix
Bugfix: updated issues with tokens sealing
This commit is contained in:
commit
cd694e04ea
@ -104,7 +104,9 @@ local tokenColor = {
|
||||
[""] = "#77674DE6"
|
||||
}
|
||||
|
||||
function onSave() return JSON.encode(sealedTokens) end
|
||||
function updateSave()
|
||||
self.script_state = JSON.encode(sealedTokens)
|
||||
end
|
||||
|
||||
function onLoad(savedData)
|
||||
sealedTokens = JSON.decode(savedData) or {}
|
||||
@ -185,6 +187,7 @@ end
|
||||
|
||||
function resetSealedTokens()
|
||||
sealedTokens = {}
|
||||
updateSave()
|
||||
end
|
||||
|
||||
-- native event from TTS - used to update the context menu for cards like "Unrelenting"
|
||||
@ -228,6 +231,7 @@ function sealToken(name, playerColor)
|
||||
end
|
||||
end
|
||||
updateStackSize()
|
||||
updateSave()
|
||||
end
|
||||
})
|
||||
return
|
||||
@ -244,6 +248,7 @@ function releaseOneToken(playerColor)
|
||||
else
|
||||
printToColor("Releasing token", playerColor)
|
||||
putTokenAway(table.remove(sealedTokens))
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
@ -262,6 +267,7 @@ function releaseMultipleTokens(playerColor)
|
||||
for i = 1, numRemoved do
|
||||
putTokenAway(table.remove(sealedTokens))
|
||||
end
|
||||
updateSave()
|
||||
printToColor("Releasing " .. numRemoved .. " tokens", playerColor)
|
||||
end
|
||||
|
||||
@ -276,6 +282,7 @@ function releaseAllTokens(playerColor)
|
||||
putTokenAway(guid)
|
||||
end
|
||||
sealedTokens = {}
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
@ -285,6 +292,7 @@ function returnMultipleTokens(playerColor)
|
||||
for i = 1, SHOW_MULTI_RETURN do
|
||||
returnToken(table.remove(sealedTokens))
|
||||
end
|
||||
updateSave()
|
||||
printToColor("Returning " .. SHOW_MULTI_RETURN .. " tokens", playerColor)
|
||||
else
|
||||
printToColor("Not enough tokens sealed.", playerColor)
|
||||
@ -331,6 +339,7 @@ function resolveSealed()
|
||||
local resolvedToken = getObjectFromGUID(guidToBeResolved)
|
||||
resolvedToken.UI.setXml("")
|
||||
updateStackSize()
|
||||
updateSave()
|
||||
chaosBagApi.drawChaosToken(mat, true, _, guidToBeResolved)
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user