some bugfixes and QoL

This commit is contained in:
Chr1Z93 2024-02-16 10:12:58 +01:00
parent 237ea15949
commit 2c7bba922f
2 changed files with 17 additions and 14 deletions

View File

@ -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

View File

@ -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)