Files
gen1recomp/tests/game3_summary_description_test.lua
T
thibautbus ed27cd2821 Translate Emerald ability names
Pokemon.abilityName() returns Strings(name), so the RSE summary and the battle ability placeholders show a translated name, as FireRed's summary already did. FireRed's summary no longer translates the getter's result a second time, and the battle adapter keys an ability outside its built-in table by Pokemon.romAbilityName(), so a translated name cannot become an unknown ability key.
2026-10-05 14:46:31 +02:00

54 lines
2.1 KiB
Lua

#!/usr/bin/env luajit
-- The summary's move and ability descriptions are keyed by the English name.
-- A translation mod renames moves and abilities in place, so the lookup has
-- to go through the ROM's own name for the number, not the name on screen.
package.path = "./?.lua;./?/init.lua;" .. package.path
require("tests.game3_cache").mountOrSkip("summary_description")
love = require("tests.love_stub")
local failed = 0
local function check(cond, msg)
if not cond then
failed = failed + 1
print("[FAIL] " .. msg)
end
end
local Strings = require("src.core.Strings")
local Pokemon = require("src.core.game3.pokemon")
local SummaryData = require("src.core.game3.summary_data")
-- An installed pack a mod has renamed entries of, as Gen3Compat leaves it.
Pokemon._cache = {}
Pokemon._moveNames = { [71] = "VOL-VIE" }
Pokemon._abilityNames = { [9] = "STATIK" }
Pokemon._romMoveNames = { [71] = "ABSORB" }
Pokemon._romAbilityNames = { [9] = "STATIC" }
check(SummaryData.moveDescription(71, "VOL-VIE"):find("absorbs half", 1, true) ~= nil,
"a renamed move still finds its description")
check(SummaryData.abilityDescription(9, "STATIK") == "Paralyzes on contact.",
"a renamed ability still finds its description")
check(Pokemon.abilityName(9) == "STATIK",
"an ability name falls back to the current displayed source")
Strings.load({ strings = { STATIK = "STATIQUE" } })
check(Pokemon.abilityName(9) == "STATIQUE",
"the shared ability-name getter translates the current displayed name")
check(Pokemon.romAbilityName(9) == "STATIC",
"the ROM ability name remains stable for ID-based lookups")
Strings.load({})
Strings.load({ strings = { ["Paralyzes on contact."] = "Paralyse au contact." } })
check(SummaryData.abilityDescription(9, "STATIK") == "Paralyse au contact.",
"the description goes through Strings()")
Strings.load({})
Pokemon._romMoveNames = nil
check(SummaryData.moveDescription(71, "ABSORB"):find("absorbs half", 1, true) ~= nil,
"without the ROM names, the name passed in is used")
print(("game3_summary_description_test: %s (%d failed)"):format(failed == 0 and "PASS" or "FAIL", failed))
if failed > 0 then os.exit(1) end