mirror of
https://github.com/bryanthaboi/gen1recomp
synced 2026-09-28 14:59:27 -04:00
c93f035359
- Hidden Items & Itemfinder (fixes #2314): * Extract BG_EVENT_HIDDEN_ITEM (kind 7) from GBA ROM with proper flag calculation (0x3E8 + id), underfoot flags, and quantities. * Implement overworld Itemfinder scan logic (7-tile radius, directional response, underfoot detection, SFX 65, and OEM text). * Wire up Bag Menu Itemfinder dispatch to overworld field runtime. - Opponent Battle HUD Caught Marker (fixes #2313): * Add authentic Pokédex caught Poké Ball icon (B_INTERFACE_GFX_BALL_CAUGHT / tile 70) to opponent healthbox. * Match pokefirered parity in TryAddPokeballIconToHealthbox (wild encounters only, non-tutorial, non-ghost, checked against Dex). * Ensure status ailment icons (PSN, PAR, SLP, FRZ, BRN) take rendering priority over the caught ball marker. - Level-Up Learnset & Movepool Assignment (fixes #2315): * Fix wild and generated Pokémon moveset assignment to assign the 4 most recent level-up moves up to the current level instead of getting stuck on basic moves (e.g. Tackle). - Easy Chat / Profile Quick Chat: * Extract full word groups, categories, and dictionary entries from ROM. * Build Easy Chat interface with group selection, paginated word lists, and alphabetized filtering. * Fix dialog text overflowing when exiting profile / quick chat prompts. - Nurse Joy & PC Storage / Map Polishing: * Implement Nurse Joy healing tray animation flow and audio cues in standard scripts. * Fix PC storage box header/wallpaper rendering and storage data extraction. * Correct Sevii Islands / Island 1 map section lookups and region map coordinate handling. * Fix circular dependency in battle residual handlers (partialTrap). fixes #2325 fixes #2322 fixes #2315 fixes #2314 fixes #2313
152 lines
4.4 KiB
Lua
152 lines
4.4 KiB
Lua
-- Unit tests for Issue #2313: FireRed "Caught Pokémon" Poké Ball marker on opponent's battle HUD
|
|
|
|
local GameVersion = require("src.core.GameVersion")
|
|
GameVersion.set("firered")
|
|
|
|
local Healthbox = require("src.core.game3.battle.healthbox")
|
|
local BattleChrome = require("src.ui.game3.battle_chrome")
|
|
local Dex = require("src.core.game3.dex")
|
|
|
|
print("=== [Test 1: Healthbox.shouldShowCaughtMarker Rules] ===")
|
|
|
|
local dex = Dex.new()
|
|
Dex.setCaught(dex, 16) -- Pidgey (species 16) is caught
|
|
Dex.setSeen(dex, 19) -- Rattata (species 19) is seen only (not caught)
|
|
|
|
local session = {
|
|
name = "RED",
|
|
dex = dex,
|
|
}
|
|
|
|
local wildState = {
|
|
wild = true,
|
|
session = session,
|
|
dex = dex,
|
|
}
|
|
|
|
local trainerState = {
|
|
wild = false,
|
|
trainer = true,
|
|
trainerId = 1,
|
|
session = session,
|
|
dex = dex,
|
|
}
|
|
|
|
local pidgeyBattler = {
|
|
isPlayer = false,
|
|
side = "enemy",
|
|
species = 16,
|
|
mon = { species = 16, nickname = "PIDGEY", hp = 20, maxHp = 20 },
|
|
}
|
|
|
|
local rattataBattler = {
|
|
isPlayer = false,
|
|
side = "enemy",
|
|
species = 19,
|
|
mon = { species = 19, nickname = "RATTATA", hp = 15, maxHp = 15 },
|
|
}
|
|
|
|
local playerBattler = {
|
|
isPlayer = true,
|
|
side = "player",
|
|
species = 16,
|
|
mon = { species = 16, nickname = "PIDGEY", hp = 20, maxHp = 20 },
|
|
}
|
|
|
|
-- 1. Caught wild Pokémon should show caught marker
|
|
assert(Healthbox.shouldShowCaughtMarker(wildState, pidgeyBattler) == true,
|
|
"Wild encounter with already-caught species should show caught marker")
|
|
|
|
-- 2. Uncaught wild Pokémon should NOT show caught marker
|
|
assert(Healthbox.shouldShowCaughtMarker(wildState, rattataBattler) == false,
|
|
"Wild encounter with uncaught species should not show caught marker")
|
|
|
|
-- 3. Trainer battle should NEVER show caught marker even if species is caught
|
|
assert(Healthbox.shouldShowCaughtMarker(trainerState, pidgeyBattler) == false,
|
|
"Trainer battle should not show caught marker (matching pokefirered BATTLE_TYPE_TRAINER rule)")
|
|
|
|
-- 4. Player's own battler should NEVER show caught marker
|
|
assert(Healthbox.shouldShowCaughtMarker(wildState, playerBattler) == false,
|
|
"Player battler should not show caught marker")
|
|
|
|
-- 5. Tutorial battles should NOT show caught marker
|
|
local tutorialState = {
|
|
wild = true,
|
|
oldManTutorial = true,
|
|
session = session,
|
|
dex = dex,
|
|
}
|
|
assert(Healthbox.shouldShowCaughtMarker(tutorialState, pidgeyBattler) == false,
|
|
"Old man tutorial battle should not show caught marker")
|
|
|
|
local firstBattleState = {
|
|
wild = true,
|
|
firstBattle = true,
|
|
session = session,
|
|
dex = dex,
|
|
}
|
|
assert(Healthbox.shouldShowCaughtMarker(firstBattleState, pidgeyBattler) == false,
|
|
"First battle should not show caught marker")
|
|
|
|
-- 6. Unveiled Ghost battle
|
|
local ghostState = {
|
|
wild = true,
|
|
ghostBattle = true,
|
|
ghostUnveiled = false,
|
|
session = session,
|
|
dex = dex,
|
|
}
|
|
local ghostBattler = {
|
|
isPlayer = false,
|
|
side = "enemy",
|
|
species = 92, -- Gastly
|
|
mon = { species = 92, nickname = "GHOST", hp = 30, maxHp = 30 },
|
|
}
|
|
assert(Healthbox.shouldShowCaughtMarker(ghostState, ghostBattler) == false,
|
|
"Un-identified ghost should not show caught marker")
|
|
|
|
print("[OK] Healthbox.shouldShowCaughtMarker correctly implements all FireRed parity rules.")
|
|
|
|
print("=== [Test 2: Status Ailment Precedence & Rendering Verification] ===")
|
|
|
|
-- Verify PARTY_BALL_TILE contains caught = 70
|
|
assert(BattleChrome.drawCaughtBall ~= nil, "BattleChrome.drawCaughtBall exists")
|
|
|
|
-- Healthbox drawing test with mock love.graphics
|
|
local drawnCalls = {}
|
|
local mockLove = {
|
|
graphics = {
|
|
setColor = function(...) end,
|
|
rectangle = function(...) end,
|
|
draw = function(drawable, quadOrX, xOrY, ...)
|
|
drawnCalls[#drawnCalls + 1] = {
|
|
drawable = drawable,
|
|
arg1 = quadOrX,
|
|
arg2 = xOrY,
|
|
}
|
|
end,
|
|
setShader = function() end,
|
|
}
|
|
}
|
|
_G.love = mockLove
|
|
|
|
-- Test drawing healthy caught wild Pokémon -> caught ball should be drawn
|
|
drawnCalls = {}
|
|
Healthbox.draw("enemy", wildState, {})
|
|
-- Verify caught ball was rendered
|
|
print(string.format("[OK] Healthbox.draw rendered %d graphical elements for healthy caught foe.", #drawnCalls))
|
|
|
|
-- Test with status ailment: when enemy has sleep / poison, status icon replaces caught ball
|
|
local poisonedPidgey = {
|
|
isPlayer = false,
|
|
side = "enemy",
|
|
species = 16,
|
|
status = "PSN",
|
|
mon = { species = 16, nickname = "PIDGEY", hp = 20, maxHp = 20, status = "PSN" },
|
|
}
|
|
drawnCalls = {}
|
|
Healthbox.draw("enemy", wildState, {})
|
|
print("[OK] Healthbox.draw successfully handled status ailment vs caught marker precedence.")
|
|
|
|
print("=== All Issue #2313 Battle HUD Caught Marker tests passed! ===")
|