From d1ae804266b76666ce5366a32fd1b45c7b7ad816 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Thu, 25 Apr 2024 22:25:37 +0200 Subject: [PATCH] bugfix for spawning a single damage / horror --- src/core/token/TokenManager.ttslua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/core/token/TokenManager.ttslua b/src/core/token/TokenManager.ttslua index 91765172..93b92683 100644 --- a/src/core/token/TokenManager.ttslua +++ b/src/core/token/TokenManager.ttslua @@ -172,8 +172,7 @@ do end end - -- Spawns a single counter token and sets the value to tokenValue. Used for damage and horror - -- tokens. + -- Spawns a single counter token and sets the value to tokenValue. Used for damage and horror tokens. ---@param card tts__Object Card to spawn tokens on ---@param tokenType string type of token to spawn, valid values are "damage" and "horror". Other -- types should use spawnMultipleTokens() @@ -183,7 +182,12 @@ do local pos = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[1][1] + Vector(0, 0, shiftDown)) local rot = card.getRotation() - TokenManager.spawnToken(pos, tokenType, rot, function(spawned) spawned.setState(tokenValue) end) + TokenManager.spawnToken(pos, tokenType, rot, function(spawned) + -- token starts in state 1, so don't attempt to change it to avoid error + if tokenValue ~= 1 then + spawned.setState(tokenValue) + end + end) end TokenManager.spawnResourceCounterToken = function(card, tokenCount)