Battle Frontier data structures (Generation III): Difference between revisions

From Bulbapedia, the community-driven Pokémon encyclopedia.
Jump to navigationJump to search
(add battle style)
m (Text replacement - "}}<br>↵{{Project Games notice" to "}} {{Project Games notice")
 
(16 intermediate revisions by 13 users not shown)
Line 1: Line 1:
There are a number of data structures in the [[Pokémon Emerald]] game ROM that govern the [[Battle Frontier (Hoenn)|Battle Frontier]] and the [[Battle Tent]]s. These are outlined below.
There are a number of data structures in the {{game|Emerald}} game ROM that govern the {{gdis|Battle Frontier|III}} and the [[Battle Tent]]s. These are outlined below.


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


== Opposing Trainers ==
==Opposing Trainers==
The Battle Frontier contains a master list of 300 opposing [[Pokémon Trainer]]s 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:
The {{gdis|Battle Frontier|III}} contains a master list of 300 opposing [[Pokémon Trainer]]s 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:


{| class="wikitable"
{| class="wikitable"
Line 13: Line 13:
| 8 || char[8] || Name
| 8 || char[8] || Name
|-
|-
| 12 || [[Easy chat system data structures in Generation III|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 system data structures in Generation III|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] || 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.
| 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.
| 4 || uint16_t* || Pokémon Used - the pointer points to an 0xFFFF-terminated array of indices in the list of opposing Pokémon. Note that not all Pokémon 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 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.
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 ==
==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:
The {{gdis|Battle Frontier|III}} 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:


{| class="wikitable"
{| class="wikitable"
! Size !! Type !! Description
! Size !! Type !! Description
|-
|-
| 2 || uint16_t || Species ID - see [[List of Pokémon by index number (Generation III)]].
| 2 || uint16_t || Species ID - see [[List of Pokémon by index number in Generation III]] for the list of values and their associated Pokémon.
|-
|-
| 8 || uint16_t[4] || Moves - see [[List of moves]].
| 8 || uint16_t[4] || Moves - see [[List of moves]] for the list of values and their associated move.
|-
|-
| 1 || uint8_t || Held Item - these are '''not''' item indices, rather indices to a separate list of item indices
| 1 || uint8_t || Held Item - these are '''not''' item indices, rather indices to a separate list of item indices, see below
|-
|-
| 1 || uint8_t || EV spread - bitfield, see below
| 1 || uint8_t || EV spread - bitfield, see below
Line 43: Line 43:
|}
|}


Note that all other information needed to generate the Pokemon itself (such as IVs) will depend on the facility and current winning streak therein.
Note that all other information needed to generate the Pokémon 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 0x085DE02C, the Verdanturf Battle Tent list is located at 0x085DEC28, and the Fallarbor Battle Tent list is located at 0x085DF96C.
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 0x085DE02C, the Verdanturf Battle Tent list is located at 0x085DEC28, and the Fallarbor Battle Tent list is located at 0x085DF96C.


=== Held item ===
===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.
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.


{| class="wikitable"
{| class="wikitable"
Line 68: Line 68:
Item names in parentheses are not used on any Pokémon in the Pokémon lists.
Item names in parentheses are not used on any Pokémon in the Pokémon lists.


=== EV spreads ===
===EV spreads===
EV spreads are stored in a six-bit bitfield:
EV spreads are stored in a six-bit bitfield:


Line 79: Line 79:
  --1----- Special Defense
  --1----- Special Defense


The 510 EVs will be divided evenly among all stats whose bit are set.
The 510 EVs will be divided evenly among all stats whose bit are set. (Since 510 is not divisible by 4, a Pokémon whose EVs are spread across 4 stats will only have 508 EVs.)


== Mind Ratings ==
==Wild Pokémon in the Battle Pyramid==
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.
Wild Pokémon in the [[Battle Pyramid]] are stored in a 12-byte structure, as follows:
{| class="wikitable"
! Size !! Type !! Description
|-
| 2 || uint16_t || Species ID - see [[List of Pokémon by index number in Generation III]] for the list of values and their associated Pokémon.
|-
| 1 || uint8_t || Base level - increased or decreased randomly by up to 5 on each wild Pokémon encountered
|-
| 1 || uint8_t || Unknown - seems to always be 2
|-
| 8 || uint16_t[4] || Moves - see [[List of moves]] for the list of values and their associated move.
|}
 
==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 judgment. Mind ratings are stored as an array of 355 (the number of move IDs in the game) 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.
To access the Mind rating for any particular move, take the corresponding index in this array.


== Battle Style Moves ==
==Battle style moves==
In determining a trainer's battle style, seven lists of moves are kept by the game, and from these, one of nine battle styles is determined. The trainer's Pokémon's moves are matched up against these seven lists, and a list is considered "satisfied" if the trainer has enough moves from that list (this is three moves for the first four lists and two moves for the last three). The game then determines the battle style based on how many of the lists are satisfied (either none, 1-2, or at least 3; the middle one of which will also state the last list that was satisfied, for a total of 9 styles).
In determining a Trainer's battle style in the {{gdis|Battle Factory|III}} and [[Battle Dome]], seven lists of moves are kept by the game, and from these, one of nine battle styles is determined. The Trainer's Pokémon's moves are matched up against these seven lists, and a list is considered "satisfied" if the Trainer has enough moves from that list. The number of moves that are needed for a list to be satisfied is stored in memory location 0x08611FC0 as a list of 7 unsigned 8-bit integers; by default this is three moves for the first three lasts and two for the last four. The game then determines the battle style based on how many of the lists are satisfied (either none, 1-2, or at least 3; the middle one of which will also state the last list that was satisfied, for a total of 9 styles).


The master list of moves used in determining battle style is stored as an array of 7 pointers to lists of 16-bit unsigned integers, referring to the corresponding indices in the master move list (see [[List of moves]]). All seven lists have no fixed length, and are terminated with 0x0000.
The master list of moves used in determining battle style is stored as an array of 7 pointers to lists of 16-bit unsigned integers, referring to the corresponding indices in the master move list (see [[List of moves]]). All seven lists have no fixed length, and are terminated with 0x0000.


{| class="wikitable"
{| class="wikitable"
Line 109: Line 123:
|}
|}


The lists of moves appear immediately before the seven pointers themselves in the game ROM.
The lists of moves appear immediately before the seven pointers themselves in the game ROM. The number of moves needed to satisfy each list appears immediately before the lists of moves.
 
{{data structure}}
{{Project Games notice|data structure}}


[[Category:Structures]]
[[Category:Structures]]

Latest revision as of 17:33, 16 September 2024

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* Pokémon Used - the pointer points to an 0xFFFF-terminated array of indices in the list of opposing Pokémon. Note that not all Pokémon 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 in Generation III for the list of values and their associated Pokémon.
8 uint16_t[4] Moves - see List of moves for the list of values and their associated move.
1 uint8_t Held Item - these are not item indices, rather indices to a separate list of item indices, see below
1 uint8_t EV spread - bitfield, see below
1 uint8_t Nature

Note that all other information needed to generate the Pokémon 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 0x085DE02C, the Verdanturf Battle Tent list is located at 0x085DEC28, and the Fallarbor Battle Tent list is located at 0x085DF96C.

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. (Since 510 is not divisible by 4, a Pokémon whose EVs are spread across 4 stats will only have 508 EVs.)

Wild Pokémon in the Battle Pyramid

Wild Pokémon in the Battle Pyramid are stored in a 12-byte structure, as follows:

Size Type Description
2 uint16_t Species ID - see List of Pokémon by index number in Generation III for the list of values and their associated Pokémon.
1 uint8_t Base level - increased or decreased randomly by up to 5 on each wild Pokémon encountered
1 uint8_t Unknown - seems to always be 2
8 uint16_t[4] Moves - see List of moves for the list of values and their associated move.

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 judgment. Mind ratings are stored as an array of 355 (the number of move IDs in the game) 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.

Battle style moves

In determining a Trainer's battle style in the Battle Factory and Battle Dome, seven lists of moves are kept by the game, and from these, one of nine battle styles is determined. The Trainer's Pokémon's moves are matched up against these seven lists, and a list is considered "satisfied" if the Trainer has enough moves from that list. The number of moves that are needed for a list to be satisfied is stored in memory location 0x08611FC0 as a list of 7 unsigned 8-bit integers; by default this is three moves for the first three lasts and two for the last four. The game then determines the battle style based on how many of the lists are satisfied (either none, 1-2, or at least 3; the middle one of which will also state the last list that was satisfied, for a total of 9 styles).

The master list of moves used in determining battle style is stored as an array of 7 pointers to lists of 16-bit unsigned integers, referring to the corresponding indices in the master move list (see List of moves). All seven lists have no fixed length, and are terminated with 0x0000.

Address Battle Style
0x08611FC8 "... one based on total preparation"
0x08611FCC "... slow and steady"
0x08611FD0 "... one of endurance"
0x08611FD4 "... high risk, high return"
0x08611FD8 "... weakening the foe to start"
0x08611FDC "... impossible to predict"
0x08611FE0 "... depend on the battle's flow"

The lists of moves appear immediately before the seven pointers themselves in the game ROM. The number of moves needed to satisfy each list appears immediately before the lists of moves.


Data structure in the Pokémon games
General Character encoding
Generation I Pokémon speciesPokémonPoké MartCharacter encodingSave
Generation II Pokémon speciesPokémonTrainerCharacter encoding (Korean) • Save
Generation III Pokémon species (EvolutionPokédexType chart)
Pokémon (substructures) • MoveContestContest moveItem
Trainer TowerBattle FrontierCharacter encoding (GameCube) • Save
Generation IV Pokémon species (EvolutionLearnsets)
PokémonSaveCharacter encoding (Wii)
Generation V–present Character encoding
Generation VIII Save
TCG GB and GB2 Character encoding
Project Games logo.png This data structure article is part of Project Games, a Bulbapedia project that aims to write comprehensive articles on the Pokémon games.