diff --git a/src/playercards/CardsThatSealTokens.ttslua b/src/playercards/CardsThatSealTokens.ttslua index 2c87487a..74cc7746 100644 --- a/src/playercards/CardsThatSealTokens.ttslua +++ b/src/playercards/CardsThatSealTokens.ttslua @@ -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 {} @@ -184,11 +186,11 @@ function readBag() end -- save state when going into bags / decks -function onDestroy() self.script_state = onSave() end +function onDestroy() updateSave() end function resetSealedTokens() sealedTokens = {} - self.script_state = onSave() + updateSave() end -- native event from TTS - used to update the context menu for cards like "Unrelenting" @@ -280,7 +282,7 @@ function releaseAllTokens(playerColor) putTokenAway(guid) end sealedTokens = {} - self.script_state = onSave() + updateSave() end end @@ -340,6 +342,7 @@ function resolveSealed() end function updateStackSize() + updateSave() if MAX_SEALED == 1 then return end if #sealedTokens == 0 then return end -- get topmost sealed token