Battle Frontier data structures (Generation III)

From Bulbapedia, the community-driven Pokémon encyclopedia.
Revision as of 07:48, 1 September 2011 by KelvSYC (talk | contribs) (Created page with "There are a number of data structures in the Pokémon Emerald game ROM that govern the Battle Frontier (Hoenn) and the Battle Tents. These are outlined below. All ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

There are a number of data structures in the Pokémon Emerald game ROM that govern the Battle Frontier and the Battle Tents. These are outlined below.

All memory addresses refer to the addresses used in the US version of the game.

Opposing Trainers

The Battle Frontier contains a master list of 300 opposing Pokémon Trainers that may be chosen as an opponent in battle; these are generally sorted in increasing order of difficulty. Similarly, each of the Battle Tents has a smaller list of trainers: 70 for the Slateport Battle Tent and 30 for the Verdanturf and Fallarbor Battle Tents. Trainer data is stored as a 52-byte structure, outlined as follows:

Size Type Description
4 uint32_t Trainer class
8 char[8] Name
12 Easy Chat structure[6] Challenge Quote - the quote given before battling the opposing trainer. This is a phrase constructed using the easy chat system.
12 Easy Chat structure[6] Win Quote - the quote given when you lose against the opposing trainer.
12 Easy Chat structure[6] Lose Quote - the quote given when you win against the opposing trainer.
4 uint16_t* Pokemon Used - the pointer points to an 0xFFFF-terminated array of indices in the list of opposing Pokemon. Note that not all Pokemon in the list may be used in all Battle Frontier facilities.

The lists of Pokémon used appear immediately before the list of opposing trainers for each facility. Note that the range of trainers that will be used in any facility will be dependent on the current winning streak at that facility.

The list of trainers appear at memory addresses 0x085D5ACC for the Battle Frontier, 0x085DDA14 for the Slateport Battle Tent, 0x085DE610 for the Verdanturf Battle Tent, and 0x085DF084 for the Fallarbor Battle Tent.

Opposing Pokémon

The Battle Frontier contains a master list of 882 opposing Pokémon, again in general order of increasing difficulty. The list of opposing Pokémon is only 70 for the Slateport Battle Tent and 45 for the Verdanturf and Fallarbor Battle Tents. Pokémon data is stored as a 13-byte data structure (aligned on 4-byte boundaries, for a total of 16 bytes), outlined as follows:

Size Type Description
2 uint16_t Species ID - see List of Pokémon by index number (Generation III).
8 uint16_t[4] Moves - see List of moves.
1 uint8_t Held Item - these are not item indices, rather indices to a separate list of item indices
1 uint8_t EV spread - bitfield, see below
1 uint8_t Nature

Note that all other information needed to generate the Pokemon itself (such as IVs) will depend on the facility and current winning streak therein.

The list of Pokémon appear immediately after their corresponding list of trainers in memory: the Battle Frontier list is located at address 0x085D97BC, the Slateport Battle Tent list is located at 0x5DE02C, the Verdanturf Battle Tent list is located at 0x5DEC28, and the Fallarbor Battle Tent list is located at 0x5DF96C.

Held item

For the Battle Frontier facilities, a separate list of 63 values (indices to the master item list) is used to denote items. This list may be located at memory location 0x085CECB0. For convenience, it is reproduced here.

0 1 2 3 4 5 6 7 8 9 A B C D E F
0 Nothing King's Rock Sitrus Berry Oran Berry Chesto Berry Hard Stone Focus Band Persim Berry Miracle Seed (Berry Juice) Macho Brace SilverPowder Cheri Berry BlackGlasses Black Belt (Soul Dew)
1 Choice Band Magnet Silk Scarf White Herb DeepSeaScale (DeepSeaTooth) Mystic Water Sharp Beak Quick Claw Leftovers Rawst Berry Light Ball Poison Barb NeverMeltIce Aspear Berry Spell Tag
2 BrightPowder Leppa Berry Scope Lens TwistedSpoon Metal Coat Mental Herb Charcoal Pecha Berry Soft Sand Lum Berry Dragon Scale Dragon Fang Iapapa Berry Wiki Berry Sea Incense Shell Bell
3 Salac Berry (Lansat Berry) Apicot Berry (Starf Berry) Liechi Berry Stick Lax Incense Aguav Berry Figy Berry Thick Club Mago Berry Metal Powder Petaya Berry (Lucky Punch) Ganlon Berry

Item names in parentheses are not used on any Pokémon in the Pokémon lists.

EV spreads

EV spreads are stored in a six-bit bitfield:

--xxxxxx EV spread
-------1 HP
------1- Attack
-----1-- Defense
----1--- Speed
---1---- Special Attack
--1----- Special Defense

The 510 EVs will be divided evenly among all stats whose bit are set.

Mind Ratings

In the Battle Arena, each move is given a Mind rating. Over the course of the battle, each move used will contribute its Mind rating to the trainer's mind score; the player with the higher rating wins the 2 points in overall judgement. Mind ratings are stored as an array of 355 signed 8-bit integers at memory location 0x08611DC0; normally, these range from -1 to 1.

To access the Mind rating for any particular move, take the corresponding index in this array.