mirror of
https://github.com/bryanthaboi/gen1recomp
synced 2026-09-26 13:33:27 -04:00
1c2a7d64de
Trainers.info gave a trainer the player's chosen rival name only when its class was called "RIVAL". A mod that translates the class (RIVALE in German and Italian) made the rival battle as the ROM's placeholder TERRY, and the champion, whose class is CHAMPION, was always TERRY. pret's B_TXT_TRAINER1_NAME names TRAINER_CLASS_RIVAL_EARLY, _RIVAL_LATE and _CHAMPION by the rival's name (pokefirered/src/battle_message.c:2078); Trainers.info now does the same, by class id.
29 lines
1.4 KiB
Lua
29 lines
1.4 KiB
Lua
#!/usr/bin/env luajit
|
|
-- The rival and the champion take the player's chosen rival name by class id,
|
|
-- as pret's B_TXT_TRAINER1_NAME does (pokefirered/src/battle_message.c:2078),
|
|
-- so a mod that translates the class ("RIVALE", "MAÎTRE") keeps the name.
|
|
|
|
package.path = "./?.lua;./?/init.lua;" .. package.path
|
|
love = require("tests.love_stub")
|
|
|
|
local T = require("tests.harness")
|
|
local check = T.check
|
|
|
|
local Trainers = require("src.core.game3.scripting.trainers")
|
|
local rows = {
|
|
[326] = { id = 326, class = 81, className = "RIVALE", name = "TERRY", party = {} },
|
|
[438] = { id = 438, class = 90, className = "MAÎTRE", name = "TERRY", party = {} },
|
|
[500] = { id = 500, class = 89, className = "RIVAL", name = "TERRY", party = {} },
|
|
[347] = { id = 347, class = 82, className = "RIVAL", name = "IVAN", party = {} },
|
|
}
|
|
Trainers.get = function(id) return rows[tonumber(id)] end
|
|
|
|
local function nameOf(id) return Trainers.info(id, { rivalName = "GARY" }).name end
|
|
check(nameOf(326) == "GARY", "the early rival takes the rival name, whatever its class is called")
|
|
check(nameOf(500) == "GARY", "so does the late rival")
|
|
check(nameOf(438) == "GARY", "and the champion, as on the cart")
|
|
check(nameOf(347) == "IVAN", "another class keeps its own trainer's name, even one called RIVAL")
|
|
check(Trainers.info(326, {}).name == "TERRY", "with no rival name, the ROM's placeholder stays")
|
|
|
|
T.finish("game3_trainer_class_ids_test")
|