diff --git a/src/arkhamdb/ArkhamDb.ttslua b/src/arkhamdb/ArkhamDb.ttslua index e4e47e23..ff48ae97 100644 --- a/src/arkhamdb/ArkhamDb.ttslua +++ b/src/arkhamdb/ArkhamDb.ttslua @@ -299,8 +299,11 @@ do local pos = string.find(description, "++SCED import instructions++") if not pos then return end - -- remove everything before instructions (including newline) - local tempStr = string.sub(description, pos + 30) + -- remove everything before instructions + local tempStr = string.sub(description, pos) + + -- remove instruction header (and potential copies) + tempStr = tempStr:gsub("++SCED import instructions++\n") -- parse each line in instructions for line in tempStr:gmatch("([^\n]+)") do @@ -333,17 +336,17 @@ do elseif instructor == "remove:" then if slots[str] == nil then internal.maybePrint("Tried to remove " .. str .. ", but didn't find card in deck.", playerColor) - break - end - slots[str] = math.max(slots[str] - 1, 0) + else + slots[str] = math.max(slots[str] - 1, 0) - -- fully remove cards that have a quantity of 0 - if slots[str] == 0 then - slots[str] = nil - end + -- fully remove cards that have a quantity of 0 + if slots[str] == 0 then + slots[str] = nil - -- also remove related minicard - slots[str .. "-m"] = nil + -- also remove related minicard + slots[str .. "-m"] = nil + end + end end end end diff --git a/src/arkhamdb/InstructionGenerator.ttslua b/src/arkhamdb/InstructionGenerator.ttslua index 3faf1e57..1593b171 100644 --- a/src/arkhamdb/InstructionGenerator.ttslua +++ b/src/arkhamdb/InstructionGenerator.ttslua @@ -46,10 +46,10 @@ function generate(_, playerColor) -- sort the idList table.sort(idList, sortById) - -- construct the string - local description = "++SCED import instructions++\n- add: " + -- construct the string (new line for each instruction) + local description = "++SCED import instructions++" for _, entry in ipairs(idList) do - description = description .. entry.id .. " (**" .. entry.name .. "**)" .. ", " + description = description .. "\n- add: " .. entry.id .. " (**" .. entry.name .. "**)" .. ", " end -- remove last delimiter (last two characters)