cleaned up code

This commit is contained in:
Chr1Z93 2023-05-11 15:12:50 +02:00
parent 9113dc4aa4
commit 991f95519f

View File

@ -428,45 +428,17 @@ end
---@param card Object Card which needs to be set the state for
---@param loadAltInvestigator String Contains the name of alternative art for the investigator ("normal", "revised" or "promo")
function loadAltArt(card, loadAltInvestigator)
if loadAltInvestigator == "normal" then return end
-- lookup correct stateId for investigator and alt art state
local baseId = string.gsub(JSON.decode(card.getGMNotes()).id, "-m", "")
local stateIdTable = {}
-- Roland Banks
stateIdTable["01001"] = {}
stateIdTable["01001"]["revised"] = 2
stateIdTable["01001"]["promo"] = 3
-- Daisy Walker
stateIdTable["01002"] = {}
stateIdTable["01002"]["revised"] = 2
-- "Skids" O'Toole
stateIdTable["01003"] = {}
stateIdTable["01003"]["revised"] = 2
-- Agnes Baker
stateIdTable["01004"] = {}
stateIdTable["01004"]["revised"] = 2
-- Wendy Adams
stateIdTable["01005"] = {}
stateIdTable["01005"]["revised"] = 2
-- Jenny Barnes
stateIdTable["02003"] = {}
stateIdTable["02003"]["promo"] = 2
-- Carolyn Fern
stateIdTable["05001"] = {}
stateIdTable["05001"]["promo"] = 2
-- Dexter Drake
stateIdTable["07004"] = {}
stateIdTable["07004"]["promo"] = 2
-- Silas Marsh
stateIdTable["07005"] = {}
stateIdTable["07005"]["promo"] = 2
-- Norman Withers
stateIdTable["08004"] = {}
stateIdTable["08004"]["promo"] = 2
card.setState(stateIdTable[baseId][loadAltInvestigator])
-- states are set up this way:
-- 1 - normal, 2 - revised/promo, 3 - promo (if 2 is revised)
-- This means we can always load the 2nd state for revised and just get the last state for promo
if loadAltInvestigator == "normal" then
return
elseif loadAltInvestigator == "revised" then
card.setState(2)
elseif loadAltInvestigator == "promo" then
local states = card.getStates()
card.setState(#states)
end
end
function log(message)