mirror of
https://github.com/bryanthaboi/gen1recomp
synced 2026-10-07 01:18:32 -04:00
72f2294d8d
CLOSES #2649, CLOSES #2650, CLOSES #2652, CLOSES #2653, CLOSES #2654, CLOSES #2657, CLOSES #2658, CLOSES #2659, CLOSES #2660, CLOSES #2662, CLOSES #2664, CLOSES #2665, CLOSES #2666, CLOSES #2669, CLOSES #2671, CLOSES #2672, CLOSES #2674, CLOSES #2676, CLOSES #2682, CLOSES #2683, CLOSES #2684, CLOSES #2685, CLOSES #2686, CLOSES #2687, CLOSES #2688, CLOSES #2689
59 lines
2.2 KiB
Lua
59 lines
2.2 KiB
Lua
-- scripts/ChampionsRoom.asm:65
|
|
package.path = "./?.lua;./?/init.lua;" .. package.path
|
|
if not _G.love then _G.love = require("tests.love_stub") end
|
|
local Data = require("src.core.Data")
|
|
if not (Data.maps and Data.maps.PALLET_TOWN) then Data:load() end
|
|
local S = require("tests.harness").suite("parity rival end text")
|
|
local check = S.check
|
|
|
|
local init = require("data.scripts.init")
|
|
local champ = init.get("CHAMPIONS_ROOM")
|
|
local rows = champ and champ.talk and champ.talk.TEXT_CHAMPIONSROOM_RIVAL or {}
|
|
|
|
local found, armed = false, false
|
|
for i, r in ipairs(rows) do
|
|
if r[1] == "rival_battle" and r[2] == "OPP_RIVAL3" then
|
|
found = true
|
|
local p = rows[i - 1]
|
|
armed = p ~= nil and p[1] == "save_end_battle_text" and p[2] == "_RivalDefeatedText"
|
|
end
|
|
end
|
|
check(found, "champion script has rival_battle OPP_RIVAL3")
|
|
check(armed, "champion arms _RivalDefeatedText right before rival_battle OPP_RIVAL3")
|
|
|
|
local text = Data.text and Data.text._RivalDefeatedText
|
|
if text then
|
|
check(text:find("NO!", 1, true) ~= nil, "_RivalDefeatedText is the cart's champion loss line")
|
|
end
|
|
|
|
local SKIP = { play_music = true, set_option = true }
|
|
local seen, offenders, total = {}, {}, 0
|
|
local function walk(t, path)
|
|
if type(t) ~= "table" or seen[t] then return end
|
|
seen[t] = true
|
|
for i, r in ipairs(t) do
|
|
if type(r) == "table" and r[1] == "rival_battle" then
|
|
total = total + 1
|
|
local j = i - 1
|
|
while t[j] and type(t[j]) == "table" and SKIP[t[j][1]] do j = j - 1 end
|
|
local p = t[j]
|
|
if not (type(p) == "table" and p[1] == "save_end_battle_text") then
|
|
offenders[#offenders + 1] = path .. "[" .. i .. "] " .. tostring(r[2])
|
|
end
|
|
end
|
|
end
|
|
for k, v in pairs(t) do walk(v, path .. "." .. tostring(k)) end
|
|
end
|
|
|
|
for _, mod in ipairs({ "story", "story2", "story3", "story4", "story5",
|
|
"story6", "story7", "flavor_all", "gyms",
|
|
"oaks_lab", "oaks_lab_yellow" }) do
|
|
local ok, m = pcall(require, "data.scripts." .. mod)
|
|
if ok then walk(m, mod) end
|
|
end
|
|
check(total > 0, "sweep found scripted rival battles")
|
|
check(#offenders == 0, "every scripted rival_battle arms its loss line: "
|
|
.. table.concat(offenders, ", "))
|
|
|
|
S.finish()
|