Merge pull request #286 from argonui/alt-art

DeckImporter: cleaned up code for alt art import
This commit is contained in:
Tikatoy 2023-05-23 15:42:26 -07:00 committed by GitHub
commit 90cfc37a25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)