This commit is contained in:
bryanthaboi
2026-07-29 11:46:36 -04:00
5 changed files with 90 additions and 14 deletions
+7 -7
View File
@@ -7,19 +7,19 @@
-- CheckFightingMapTrainers/TalkToTrainer via the existing trainer
-- system, and the item pickups carry no talk text of their own here.
--
-- TEXT_SSANNE2FROOMS_GENTLEMAN3 also opens the POKéDEX entry for
-- SNORLAX after the text box (DisplayPokedex in the original), which
-- has no equivalent talk-script hook in this port (DexEntryMenu has
-- no done-callback the way other pushed UI states do) -- only the
-- flavor line is ported here.
-- TEXT_SSANNE2FROOMS_GENTLEMAN3 opens SNORLAX's POKéDEX entry after its
-- text box, like DisplayPokedex in the original. The preview marks it seen
-- but does not mark it owned.
return {
SS_ANNE_2F_ROOMS = {
talk = {
-- SSAnne2FRoomsGentleman3Text: PrintText(_SSAnne2FRoomsGentleman3Text)
-- (then DisplayPokedex SNORLAX -- not ported, see note above)
-- SSAnne2FRoomsGentleman3Text: PrintText(_SSAnne2FRoomsGentleman3Text),
-- then DisplayPokedex SNORLAX.
TEXT_SSANNE2FROOMS_GENTLEMAN3 = {
{ "face_player" },
{ "show_text", "_SSAnne2FRoomsGentleman3Text" },
{ "mark_seen", "SNORLAX" },
{ "push_screen", "DexEntryMenu", "SNORLAX" },
},
-- SSAnne2FRoomsGentleman4Text: PrintText(_SSAnne2FRoomsGentleman4Text)
+9 -7
View File
@@ -37,16 +37,15 @@ local function countOwned(save)
return n
end
local function oaksAide(threshold, itemId)
local function oaksAide(threshold, itemId, repeatText)
return function(game, ow, npc, done)
local t = text(game)
local flags = game.save.flags
local itemName = game.data.items[itemId].name
local flag = "EVENT_GOT_" .. itemId
if flags[flag] then
push(game, fill(t._OaksAideComeBackText or
"I already gave\nyou the {RAM:}!",
{ num = threshold, ram = itemName }), done)
push(game, t[repeatText] or
fill("I already gave\nyou the {RAM:}!", { ram = itemName }), done)
return
end
ask(game, fill(t._OaksAideHiText or
@@ -83,13 +82,16 @@ local function oaksAide(threshold, itemId)
end
M.ROUTE_2_GATE = {
talk = { TEXT_ROUTE2GATE_OAKS_AIDE = oaksAide(10, "HM_FLASH") },
talk = { TEXT_ROUTE2GATE_OAKS_AIDE = oaksAide(10, "HM_FLASH",
"_Route2GateOaksAideFlashExplanationText") },
}
M.ROUTE_11_GATE_2F = {
talk = { TEXT_ROUTE11GATE2F_OAKS_AIDE = oaksAide(30, "ITEMFINDER") },
talk = { TEXT_ROUTE11GATE2F_OAKS_AIDE = oaksAide(30, "ITEMFINDER",
"_Route11Gate2FOaksAideItemfinderDescriptionText") },
}
M.ROUTE_15_GATE_2F = {
talk = { TEXT_ROUTE15GATE2F_OAKS_AIDE = oaksAide(50, "EXP_ALL") },
talk = { TEXT_ROUTE15GATE2F_OAKS_AIDE = oaksAide(50, "EXP_ALL",
"_Route15Gate2FOaksAideExpAllText") },
}
-- -------------------------------------------------------------------
+11
View File
@@ -518,6 +518,17 @@ function Commands.play_cry(ctx, species, waitForButton)
ctx.pendingCryWait = waitForButton or nil
end
-- mark_seen <species>: DisplayPokedex (pokedex.asm) records the species as
-- seen before opening its entry. Map scripts use this for NPC-driven
-- Pokédex previews that do not begin a battle or give the player a Pokémon.
function Commands.mark_seen(ctx, species)
local dex = ctx.save and ctx.save.pokedex
if dex then
dex.seen = dex.seen or {}
dex.seen[species] = true
end
end
-- check_battle_result <r1> [r2 ...]: lastCheck = the last scripted
-- battle ended with any of the given results
-- ("win"|"lose"|"run"|"caught"), for branches like
+39
View File
@@ -0,0 +1,39 @@
-- Parity: after a reward, each Oak's Aide repeats its item explanation
-- instead of the pre-reward "come back" text (engine/events/oaks_aide.asm).
package.path = "./?.lua;./?/init.lua;" .. package.path
if not _G.love then _G.love = require("tests.love_stub") end
local S = require("tests.harness").suite("parity Oak's Aide repeat text")
local eq = S.eq
local Data = require("src.core.Data")
if not Data.maps then Data:load() end
local Font = require("src.render.Font")
Font.load(Data)
local scripts = require("data.scripts.init")
local CASES = {
{ map = "ROUTE_2_GATE", text = "TEXT_ROUTE2GATE_OAKS_AIDE",
item = "HM_FLASH", label = "_Route2GateOaksAideFlashExplanationText",
value = "FLASH" },
{ map = "ROUTE_11_GATE_2F", text = "TEXT_ROUTE11GATE2F_OAKS_AIDE",
item = "ITEMFINDER", label = "_Route11Gate2FOaksAideItemfinderDescriptionText",
value = "FINDER" },
{ map = "ROUTE_15_GATE_2F", text = "TEXT_ROUTE15GATE2F_OAKS_AIDE",
item = "EXP_ALL", label = "_Route15Gate2FOaksAideExpAllText",
value = "EXP" },
}
for _, case in ipairs(CASES) do
local pushed = {}
local game = {
data = { items = { [case.item] = { name = case.item } },
text = { [case.label] = case.value } },
save = { flags = { ["EVENT_GOT_" .. case.item] = true },
player = { name = "RED" }, pokedex = { owned = {} } },
stack = { push = function(_, state) pushed[#pushed + 1] = state end },
}
scripts.talkScript(case.map, case.text)(game, {}, nil, function() end)
eq(pushed[1] and pushed[1].pages[1][1], case.value,
case.item .. " aide repeats its item explanation")
end
S.finish()
+24
View File
@@ -0,0 +1,24 @@
-- Parity: the S.S. Anne passenger's Snorlax description opens the Pokédex
-- entry and records Snorlax as seen (pokered/scripts/SSAnne2FRooms.asm).
package.path = "./?.lua;./?/init.lua;" .. package.path
local S = require("tests.harness").suite("parity ss anne Snorlax dex")
local check, eq = S.check, S.eq
local scripts = require("data.scripts.init")
local script = scripts.talkScript("SS_ANNE_2F_ROOMS",
"TEXT_SSANNE2FROOMS_GENTLEMAN3")
check(script ~= nil, "the S.S. Anne passenger has a talk script")
eq(script[2][1], "show_text", "the passenger's line appears first")
eq(script[3][1], "mark_seen", "the Pokédex preview marks Snorlax seen")
eq(script[3][2], "SNORLAX", "the preview marks Snorlax seen")
eq(script[4][1], "push_screen", "the Pokédex entry opens after the line")
eq(script[4][2], "DexEntryMenu", "the Pokédex entry uses DexEntryMenu")
eq(script[4][3], "SNORLAX", "the Pokédex entry is for Snorlax")
local save = { pokedex = { seen = {}, owned = {} } }
require("src.script.Commands").mark_seen({ save = save }, "SNORLAX")
check(save.pokedex.seen.SNORLAX, "the preview records Snorlax as seen")
check(not save.pokedex.owned.SNORLAX, "the preview does not mark Snorlax owned")
S.finish()