CLOSES #1396, CLOSES #1398, CLOSES #1400, CLOSES #1401, CLOSES #1406, CLOSES #1407, CLOSES #1411, CLOSES #1413, CLOSES #1415, CLOSES #1416, CLOSES #1417, CLOSES #1419, CLOSES #1421, CLOSES #1422, CLOSES #1423, CLOSES #1424, CLOSES #1425, CLOSES #1427, CLOSES #1428, CLOSES #1429, CLOSES #1431, CLOSES #1432, CLOSES #1433, CLOSES #1435, CLOSES #1437, CLOSES #1440, CLOSES #1441, CLOSES #1442, CLOSES #1443, CLOSES #1444, CLOSES #1447, CLOSES #1449, CLOSES #1456, CLOSES #1461, CLOSES #1464, CLOSES #1465, CLOSES #1466, CLOSES #1468, CLOSES #1469, CLOSES #1470

This commit is contained in:
bryanthaboi
2026-08-17 10:27:14 -04:00
parent 45519ad550
commit 8c9af95598
11 changed files with 186 additions and 10 deletions
+15 -3
View File
@@ -9,11 +9,23 @@ local function sortedKeys(t)
return keys
end
-- Gen 2's generated tables carry provenance scalars (generation, source)
-- beside the id-keyed records, so a wheel built from every key would offer
-- them as pickable entries. #1466
local function sortedRecordKeys(t)
local keys = {}
for k, v in pairs(t or {}) do
if type(v) == "table" then table.insert(keys, k) end
end
table.sort(keys)
return keys
end
function Catalog.build(data)
return {
species = sortedKeys(data.pokemon),
items = sortedKeys(data.items),
moves = sortedKeys(data.moves),
species = sortedRecordKeys(data.pokemon),
items = sortedRecordKeys(data.items),
moves = sortedRecordKeys(data.moves),
}
end
+1 -1
View File
@@ -43,7 +43,7 @@ end
function MonOps.setMove(data, mon, slot, moveId)
assert(slot >= 1 and slot <= 4)
local mdef = data.moves[moveId]
assert(mdef, "unknown move")
assert(type(mdef) == "table", "unknown move")
mon.moves = mon.moves or {}
mon.moves[slot] = {
id = moveId,
+1 -1
View File
@@ -441,7 +441,7 @@ function Ops.cycleMove(S, mon, slot)
end
for step = 1, #moves do
local nextId = moves[((idx + step - 1) % #moves) + 1]
if S.data and S.data.moves and S.data.moves[nextId] then
if S.data and S.data.moves and type(S.data.moves[nextId]) == "table" then
MonOps.setMove(S.data, mon, slot, nextId)
return Ops.mark(S, ("Move %d set to %s"):format(slot, nextId))
end