some bugfixes and QoL
This commit is contained in:
parent
237ea15949
commit
2c7bba922f
@ -299,8 +299,11 @@ do
|
|||||||
local pos = string.find(description, "++SCED import instructions++")
|
local pos = string.find(description, "++SCED import instructions++")
|
||||||
if not pos then return end
|
if not pos then return end
|
||||||
|
|
||||||
-- remove everything before instructions (including newline)
|
-- remove everything before instructions
|
||||||
local tempStr = string.sub(description, pos + 30)
|
local tempStr = string.sub(description, pos)
|
||||||
|
|
||||||
|
-- remove instruction header (and potential copies)
|
||||||
|
tempStr = tempStr:gsub("++SCED import instructions++\n")
|
||||||
|
|
||||||
-- parse each line in instructions
|
-- parse each line in instructions
|
||||||
for line in tempStr:gmatch("([^\n]+)") do
|
for line in tempStr:gmatch("([^\n]+)") do
|
||||||
@ -333,17 +336,17 @@ do
|
|||||||
elseif instructor == "remove:" then
|
elseif instructor == "remove:" then
|
||||||
if slots[str] == nil then
|
if slots[str] == nil then
|
||||||
internal.maybePrint("Tried to remove " .. str .. ", but didn't find card in deck.", playerColor)
|
internal.maybePrint("Tried to remove " .. str .. ", but didn't find card in deck.", playerColor)
|
||||||
break
|
else
|
||||||
end
|
slots[str] = math.max(slots[str] - 1, 0)
|
||||||
slots[str] = math.max(slots[str] - 1, 0)
|
|
||||||
|
|
||||||
-- fully remove cards that have a quantity of 0
|
-- fully remove cards that have a quantity of 0
|
||||||
if slots[str] == 0 then
|
if slots[str] == 0 then
|
||||||
slots[str] = nil
|
slots[str] = nil
|
||||||
end
|
|
||||||
|
|
||||||
-- also remove related minicard
|
-- also remove related minicard
|
||||||
slots[str .. "-m"] = nil
|
slots[str .. "-m"] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -46,10 +46,10 @@ function generate(_, playerColor)
|
|||||||
-- sort the idList
|
-- sort the idList
|
||||||
table.sort(idList, sortById)
|
table.sort(idList, sortById)
|
||||||
|
|
||||||
-- construct the string
|
-- construct the string (new line for each instruction)
|
||||||
local description = "++SCED import instructions++\n- add: "
|
local description = "++SCED import instructions++"
|
||||||
for _, entry in ipairs(idList) do
|
for _, entry in ipairs(idList) do
|
||||||
description = description .. entry.id .. " (**" .. entry.name .. "**)" .. ", "
|
description = description .. "\n- add: " .. entry.id .. " (**" .. entry.name .. "**)" .. ", "
|
||||||
end
|
end
|
||||||
|
|
||||||
-- remove last delimiter (last two characters)
|
-- remove last delimiter (last two characters)
|
||||||
|
Loading…
Reference in New Issue
Block a user