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++")
|
||||
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,14 +336,12 @@ 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
|
||||
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
|
||||
|
||||
-- also remove related minicard
|
||||
slots[str .. "-m"] = nil
|
||||
@ -348,6 +349,8 @@ do
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Process the slot list and looks for any cards which are bonded to those in the deck. Adds those cards to the slot list.
|
||||
---@param slots table The slot list for cards in this deck. Table key is the cardId, value is the number of those cards which will be spawned
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user