From e786bef6e53160bd21c531a264cf8d92e7b687fa Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Sat, 3 Aug 2024 18:27:19 +0200 Subject: [PATCH] Bugfix for getting investigator data --- src/core/token/TokenManager.ttslua | 12 +++++++++--- src/util/TokenSpawnTool.ttslua | 12 ++++++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/core/token/TokenManager.ttslua b/src/core/token/TokenManager.ttslua index c14c5490..6fe68f09 100644 --- a/src/core/token/TokenManager.ttslua +++ b/src/core/token/TokenManager.ttslua @@ -245,9 +245,15 @@ do if tokenType == "resource" and stateID ~= nil and stateID ~= 1 then callback = function(spawned) spawned.setState(stateID) end elseif tokenType == "universalActionAbility" then - local matColor = playermatApi.getMatColorByPosition(card.getPosition()) - local class = playermatApi.returnInvestigatorClass(matColor) - callback = function(spawned) spawned.call("updateClassAndSymbol", { class = class, symbol = subType or class }) end + callback = function(spawned) + local matColor = playermatApi.getMatColorByPosition(card.getPosition()) + local activeInvestigatorData = playermatApi.getActiveInvestigatorData(matColor) + + spawned.call("updateClassAndSymbol", { + class = activeInvestigatorData.class, + symbol = subType or activeInvestigatorData.class + }) + end end for i = 1, tokenCount do diff --git a/src/util/TokenSpawnTool.ttslua b/src/util/TokenSpawnTool.ttslua index cc91d966..07a2942d 100644 --- a/src/util/TokenSpawnTool.ttslua +++ b/src/util/TokenSpawnTool.ttslua @@ -66,12 +66,16 @@ function onScriptingButtonDown(index, playerColor) -- check for nearest investigator card and change action token state to its class elseif tokenType == "universalActionAbility" then - local matColor = playermatApi.getMatColorByPosition(position) - local matRotation = playermatApi.returnRotation(matColor) - local class = playermatApi.returnInvestigatorClass(matColor) callback = function(spawned) + local matColor = playermatApi.getMatColorByPosition(position) + local matRotation = playermatApi.returnRotation(matColor) + local activeInvestigatorData = playermatApi.getActiveInvestigatorData(matColor) + spawned.setRotation(matRotation) - spawned.call("updateClassAndSymbol", { class = class, symbol = class }) + spawned.call("updateClassAndSymbol", { + class = activeInvestigatorData.class, + symbol = activeInvestigatorData.class + }) end end