Pokémon species data structure (Generation III): Difference between revisions

This can be more like Pokémon data structure in Generation III (standardization is good). The parts that actually needed a description are already under Notes. Also: misc prettification.
(This can be more like Pokémon data structure in Generation III (standardization is good). The parts that actually needed a description are already under Notes. Also: misc prettification.)
Line 1: Line 1:
==Specs==
A '''base stats structure''' is a 28-byte structure that determines all information inherent to a Pokémon species, such as base [[stats]], [[type]]s, [[Egg Group]]s, and [[Effort values|EV yield]]. Every [[Pokémon species]] in the [[Generation III]] {{pkmn|games}} has a base stats structure stored in the game's ROM.


A '''base stats structure''' is a 28-byte piece of data.
==Notes==
 
{| style="border: 1px solid #88a; background: #f8f8ff; padding: 0.5em; border-collapse: collapse; float: right; margin: 0 0 0.5em 0.5em;" cellpadding="2"
Every [[Pokémon species]] in the [[Generation III]] {{pkmn|games}} has a 28-byte base stats structure stored in the game's ROM somewhere. It determines all information inherent to the species, such as base [[stats]], [[Type]]s, [[Egg Group]]s, and [[Effort values|EV yield]].
 
{| align="center" style="border: 1px solid #88a; background: #f8f8ff; padding: 0.5em;" cellspacing="3"
|-  
|-  
! style="text-align: center; background: #ccf;" | '''Base Stats''' || colspan="2" style="text-align: center; background: #ccf;" | Data whose names are marked with an asterisk (*) have more information below the table.
! colspan="3" style="text-align: center; background: #{{hoenn color}};" | Base Stats
|-
|-
| Name || Type || Description
! || type || offset
|-
|-
| Base HP || byte || The base HP used in calculating Pokémon of the species's [[stats|HP]].
| Base [[Stats|HP]] || byte || 0
|-
|-
| Base Attack || byte || The base Attack used in calculating a Pokémon of the species's [[stats|Attack]].
| Base [[Stats|Attack]] || byte || 1
|-
|-
| Base Defense || byte || The base Defense used in calculating a Pokémon of the species's [[stats|Defense]].
| Base [[Stats|Defense]] || byte || 2
|-  
|-  
| Base Speed || byte || The base Speed used in calculating a Pokémon of the species's [[stats|Speed]].
| Base [[Stats|Speed]] || byte || 3
|-
|-
| Base Sp. Attack || byte || The base Sp. Attack used in calculating a Pokémon of the species's [[stats|Sp. Attack]].
| Base [[Stats|Sp. Attack]] || byte || 4
|-
|-
| Base Sp. Defense || byte || The base Sp. Defense used in calculating a Pokémon of the species's [[stats|Sp. Defense]].
| Base [[Stats|Sp. Defense]] || byte || 5
|-
|-
| [[Type|Type 1]]* || byte || The first type of Pokémon of the species.
| [[Type|Type 1]] || byte || 6
|-
|-
| Type 2* || byte || The second type of Pokémon of the species.
| Type 2 || byte || 7
|-
|-
| [[Catch rate]] || byte || The catch rate used in calculating the probability that a wild Pokémon of the species will be caught.
| [[Catch rate]] || byte || 8
|-
|-
| [[Experience| Base Exp. yield]] || byte || The base Experience yield used in calculating how many Exp. points Pokémon who defeat another Pokémon of the species receives.
| [[Experience| Base Exp. yield]] || byte || 9
|-
|-
| [[Effort values|Effort yield]]* || word || How many EVs Pokémon who defeat another Pokémon of the species receives, and in what stats.
| [[Effort values|Effort yield]] || word || 10
|-
|-
| [[Item]] 1* || word || An item wild Pokémon of the species may hold.
| [[List of items by index number (Generation III)|Item]] 1 || word || 12
|-
|-
| Item 2* || word || Another item wild Pokémon of the species may hold.
| Item 2 || word || 14
|-
|-
| [[Personality value#Gender|Gender]] || byte || The value that is compared against the [[personality value]] of Pokémon of the species when determining what gender they will be, i.e. represents rate of females vs. males of the species.
| [[Personality value#Gender|Gender]] || byte || 16
|-
|-
| Steps to hatch || byte || The cumulative number of steps that must be taken before an [[Pokémon breeding|Egg]] of the species hatches, divided by 256.
| [[Egg cycles]] || byte || 17
|-
|-
| Base [[friendship]] || byte || The happiness/tameness at which Pokémon of the species have when first caught.
| Base [[friendship]] || byte || 18
|-
|-
| [[Experience|Level-up type]]* || byte || A number from 0 to 5 representing the pattern of experience which Pokémon of the species require to level up.
| [[Experience|Level-up type]] || byte || 19
|-
|-
| [[Egg Group]] 1* || byte || Indicates an Egg Group that the species belongs to.
| [[Egg Group]] 1 || byte || 20
|-
|-
| Egg Group 2* || byte || Indicates another Egg Group that the species belongs to.
| Egg Group 2 || byte || 21
|-
|-
| [[Ability]] 1 || byte || Indicates a special Ability that Pokémon of the species may have.
| [[Ability]] 1 || byte || 22
|-
|-
| Ability 2 || byte || Indicates another special Ability that Pokémon of the species may have.
| Ability 2 || byte || 23
|-
|-
| Safari Zone Rate || byte || Determines rate at which Pokémon of the species flee when encountered in the Safari Zone. Only Pokémon that appear in the Safari Zone have this set.
| Safari Zone rate || byte || 24
|-
|-
| [[List of Pokémon by color|Color]]* || byte || The Pokémon's color.
| [[List of Pokémon by color|Color]] and Flip || byte || 25
|-
|-
| 0000 || word || Padding.
| Padding{{tt|*|0's}} || word || 26.
|}
|}


==Notes==
===Types===
===Types===
The [[type]]s are associated with the following values:


Types are enumerated like this:
{| style="border: 1px solid #88a; background: #f8f8ff; padding: 0.5em; border-collapse: collapse; margin: 0 0 0.5em 0.5em" cellpadding=2
 
|
{|
{| style="text-align:center"
! Value || Type
|-
| 0 || style="{{roundy|20px}} background:#{{Normal color}}; border: 1px solid #{{Normal color dark}}" | {{tcolor|Normal|FFF}}
|-
| 1 || style="{{roundy|20px}} background:#{{Fighting color}}; border: 1px solid #{{Fighting color dark}}" | {{tcolor|Fighting|FFF}}
|-
| 2 || style="{{roundy|20px}} background:#{{Flying color}}; border: 1px solid #{{Flying color dark}}" | {{tcolor|Flying|FFF}}
|-
| 3 || style="{{roundy|20px}} background:#{{Poison color}}; border: 1px solid #{{Poison color dark}}" | {{tcolor|Poison|FFF}}
|-
| 4 || style="{{roundy|20px}} background:#{{Ground color}}; border: 1px solid #{{Ground color dark}}" | {{tcolor|Ground|FFF}}
|-
| 5 || style="{{roundy|20px}} background:#{{Rock color}}; border: 1px solid #{{Rock color dark}}" | {{tcolor|Rock|FFF}}
|}
|
{| style="text-align:center"
! Value || Type
|-
| 6 || style="{{roundy|20px}} background:#{{Bug color}}; border: 1px solid #{{Bug color dark}}" | {{tcolor|Bug|FFF}}
|-
| 7 || style="{{roundy|20px}} background:#{{Ghost color}}; border: 1px solid #{{Ghost color dark}}" | {{tcolor|Ghost|FFF}}
|-
| 8 || style="{{roundy|20px}} background:#{{Steel color}}; border: 1px solid #{{Steel color dark}}" | {{tcolor|Steel|FFF}}
|-
| 9 || style="{{roundy|20px}} background:#{{Unknown color}}; border: 1px solid #{{Unknown color dark}}" | {{tcolor|???|FFF}}
|-
| 10 || style="{{roundy|20px}} background:#{{Fire color}}; border: 1px solid #{{Fire color dark}}" | {{tcolor|Fire|FFF}}
|-
| 11 || style="{{roundy|20px}} background:#{{Water color}}; border: 1px solid #{{Water color dark}}" | {{tcolor|Water|FFF}}
|}
|
{| style="text-align:center"
! Value || Type
|-
| 12 || style="{{roundy|20px}} background:#{{Grass color}}; border: 1px solid #{{Grass color dark}}" | {{tcolor|Grass|FFF}}
|-
| 13 || style="{{roundy|20px}} background:#{{Electric color}}; border: 1px solid #{{Electric color dark}}" | {{tcolor|Electric|FFF}}
|-
| 14 || style="{{roundy|20px}} background:#{{Psychic color}}; border: 1px solid #{{Psychic color dark}}" | {{tcolor|Psychic|FFF}}
|-
|-
| 00. {{t|Normal}}
| 15 || style="{{roundy|20px}} background:#{{Ice color}}; border: 1px solid #{{Ice color dark}}" | {{tcolor|Ice|FFF}}
| 01. {{t|Fighting}}
| 02. {{t|Flying}}
| 03. {{t|Poison}}
| 04. {{t|Ground}}
| 05. {{t|Rock}}
|-
|-
| 06. {{t|Bug}}
| 16 || style="{{roundy|20px}} background:#{{Dragon color}}; border: 1px solid #{{Dragon color dark}}" | {{tcolor|Dragon|FFF}}
| 07. {{t|Ghost}}
| 08. {{t|Steel}}
| 09. {{t|???}}
| 10. {{t|Fire}}
| 11. {{t|Water}}
|-
|-
| 12. {{t|Grass}}
| 17 || style="{{roundy|20px}} background:#{{Dark color}}; border: 1px solid #{{Dark color dark}}" | {{tcolor|Dark|FFF}}
| 13. {{t|Electric}}
| 14. {{t|Psychic}}
| 15. {{t|Ice}}
| 16. {{t|Dragon}}
| 17. {{t|Dark}}
|}
|}
 
|}
Type 9 (???) can be an actual type for a species as well as a type for an attack. If the Pokémon only has one type, both '''Type'''s will be set to the same value.
If the Pokémon only has one type, both '''Type 1''' and '''Type 2''' will be set to the same value.


===Effort yield===
===Effort yield===
 
Each [[stats|stat]] is assigned two bits to determine how many [[Effort values|EVs]] the Pokémon will give in that stat. The last 4 bits in the byte are empty (0).
Certain bits count for particular stats:
{| style="border: 1px solid #88a; background: #f8f8ff; padding: 0.5em; border-collapse: collapse; margin: 0 0 0.5em 0.5em" cellpadding=2
<pre>
! Bits || Stat
(MSB)                    (LSB)
|-
0000  11 11  11  11  11  11
| 0-1 || HP
empty SDF SAK SPD DEF ATK  HP
|-
</pre>
| 2-3 || Attack
|-
| 4-5 || Defense
|-
| 6-7 || Speed
|-
| 8-9 || Special Attack
|-
| 10-11 || Special Defense
|}


===Items===
===Items===
Items in the first &quot;slot&quot; have a 50% probability of being on the Pokémon, while 5% in the second &quot;slot&quot;. If it's the same item in both then it's up to 100%.
If an [[List of items by index number (Generation III)|item]] is assigned to '''Item 1''', the Pokémon will have a 50% chance of [[held item|having that item]] when encountered in the wild. An item assigned to '''Item 2''' will have a 5% chance of being held. If both '''Item 1''' and '''Item 2''' are the same, then the Pokémon will always be holding that item when it is encountered.


===Gender===
===Gender===
Gender is zero for always-male Pokémon, 254 for always-female Pokémon and 255 for gender-neutral. Everything inbetween is a percentage value: Pikachu, 50% chance of being female, has 127.
{{main|Personality value#Gender|Personality value → Gender}}
This value determines the chance that a Pokémon will be male or female. If the Pokémon is not all male, all female, or genderless, then this value is compared to the lowest byte of the personality value to determine a given Pokémon's [[gender]].
{| style="border: 1px solid #88a; background: #f8f8ff; padding: 0.5em; border-collapse: collapse; margin: 0 0 0.5em 0.5em" cellpadding=2
! Value || Gender
|-
| 0 || Always male {{male}}
|-
| 1-253 || Mixed {{male}} / {{female}}
|-
| 254 || Always female {{female}}
|-
| 255 || Genderless
|}


===Level-up Type===
===Level-up Type===
The level-up types are enumerated like this:
The following values correspond to the different [[experience|growth rates]] a Pokémon can have:
{|style="border: 1px solid #88a; padding: 0.5em;" cellspacing="9"
{| style="border: 1px solid #88a; background: #f8f8ff; padding: 0.5em; border-collapse: collapse; margin: 0 0 0.5em 0.5em" cellpadding=2
|0.
! Value || Growth || Lv100 Exp
|Medium Fast (1,000,000)
|-
|-
|1.
| 0 || Medium Fast || style="text-align:right" | 1,000,000
|Erratic (600,000)
|-
|-
|2.
| 1 || Erratic || style="text-align:right" | 600,000
|Fluctuating (1,640,000)
|-
|-
|3.
| 2 || Fluctuating || style="text-align:right" | 1,640,000
|Medium Slow (1,059,860)
|-
|-
|4.
| 3 || Medium Slow || style="text-align:right" | 1,059,860
|Fast (800,000)
|-
|-
|5.
| 4 || Fast || style="text-align:right" | 800,000
|Slow (1,250,000)
|-
| 5 || Slow || style="text-align:right" | 1,250,000
|}
|}


===Egg Groups===
===Egg Groups===
This determines with which type of Pokémon the Pokémon can breed to get Eggs. See [[Egg Group]]. These are the direct values of the groups:
The following values correspond to the different [[Egg Groups]] a Pokémon can belong to:


{| style="border: 1px solid #88a; padding: 0.5em;" cellspacing="3"
{| style="border: 1px solid #88a; background: #f8f8ff; padding: 0.5em; border-collapse: collapse; margin: 0 0 0.5em 0.5em" cellpadding=2
|01. {{egg|Monster}}
|
|02. {{egg|Water 1}}
{| style="text-align:center"
|04. {{egg|Bug}}
! Value || Type
|05. {{egg|Flying}}
|06. {{egg|Field}}
|-
|-
|07. {{egg|Fairy}}
| 1 || {{egg|Monster}}
|08. {{egg|Grass}}
|09. {{egg|Human-Like}}
|10. {{egg|Water 3}}
|11. {{egg|Mineral}}
|-
|-
|12. {{egg|Amorphous}}
| 2 || {{egg|Water 1}}
|13. {{egg|Water 2}}
|-
|14. {{egg|Ditto}}
| 4 || {{egg|Bug}}
|15. {{egg|Dragon}}
|-
|16. {{egg|Undiscovered}}
| 5 || {{egg|Flying}}
|-
| 6 || {{egg|Field}}
|}
|
{| style="text-align:center"
! Value || Type
|-
| 7 || {{egg|Fairy}}
|-
| 8 || {{egg|Grass}}
|-
| 9 || {{egg|Human-Like}}
|-
| 10 || {{egg|Water 3}}
|-
| 11 || {{egg|Mineral}}
|}
|
{| style="text-align:center"
! Value || Type
|-
| 12 || {{egg|Amorphous}}
|-
| 13 || {{egg|Water 2}}
|-
| 14 || {{egg|Ditto}}
|-
| 15 || {{egg|Dragon}}
|-
| 16 || {{egg|Undiscovered}}
|}
|}
|}


===Colors===
===Safari Zone rate===
Colors don't really affect any part of the game mechanics, but they are used in [[Pokédex]] search function. If the most significant bit is set, the Pokémon is asymmetrical and is not flipped on the summary screen, e.g. {{p|Poliwag}}, {{p|Kingler}}, or {{p|Unown}}.
This value determines the rate at which the Pokémon will [[escape|flee]] when encountered in the [[Safari Zone]]. Only Pokémon that appear in the Safari Zone have this value set.


Here is the list of the values and their relating colors:
===Color and Flip===
{| style="border: 1px solid #88a; padding: 0.5em;" cellspacing="3"
Color is used in the [[Pokédex]]'s search function in {{3v2|Ruby|Sapphire|Emerald}}. The following values correspond to the different possible colors:
|00. Red
 
|01. Blue
{| style="border: 1px solid #88a; background: #f8f8ff; padding: 0.5em; border-collapse: collapse; margin: 0 0 0.5em 0.5em" cellpadding=2
|02. Yellow
|
|03. Green
{| style="text-align:center"
|04. Black
! Value || Type
|-
| 0 || Red
|-
| 1 || Blue
|-
|-
|05. Brown
| 2 || Yellow
|06. Purple
|-
|07. Gray
| 3 || Green
|08. White
|-
|09. Pink
| 4 || Black
|}
|}
|
{| style="text-align:center"
! Value || Type
|-
| 5 || Brown
|-
| 6 || Purple
|-
| 7 || Gray
|-
| 8 || White
|-
| 9 || Pink
|}
|}
"Flip" refers to whether the Pokémon's image is flipped when seen in the summary screen as opposed to when seen in the [[Pokédex]] or [[Pokémon Storage System|PC]]. This is determined by bit 7 (the most significant bit) of this field. For some Pokémon, such as {{p|Poliwag}}, {{p|Kingler}}, and {{p|Unown}}, this bit is set and the image is not flipped (i.e., the image is oriented the same in both places).


==Fingerprint==
==Storage==
{{incomplete|section|Are the Ruby and Sapphire addresses only for US games? For non-US games?}}
The following are the RAM offsets for the first base stats entry ({{p|Bulbasaur}}) in each GBA game. Since a game is loaded into RAM at 0x08000000, this means that the offset in a ROM dump will only use the last six digits.
{| style="border: 1px solid #88a; background: #f8f8ff; padding: 0.5em; border-collapse: collapse; margin: 0 0 0.5em 0.5em" cellpadding=2
! Game || Address
|-
| '''{{color2|{{ruby color}}|Pokémon Ruby and Sapphire Versions|Ruby}}''' || 0x081FEC34
|-
| '''{{color2|{{sapphire color}}|Pokémon Ruby and Sapphire Versions|Sapphire}}''' || 0x081FEBC4
|-
| '''{{color2|{{emerald color}}|Pokémon Emerald Version|Emerald}}''' || 0x082F0D70
|-
| '''{{color2|{{emerald color}}|Pokémon Emerald Version|Emerald}}'''<sup>EN-US</sup> || 0x083203E8
|-
| '''{{color2|{{firered color}}|Pokémon FireRed and LeafGreen Versions|FireRed}}''' || 0x082111A8
|-
| '''{{color2|{{firered color}}|Pokémon FireRed and LeafGreen Versions|FireRed}}'''<sup>EN-US</sup> || 0x082547A0
|-
| '''{{color2|{{leafgreen color}}|Pokémon FireRed and LeafGreen Versions|LeafGreen}}''' || 0x08211184
|-
| '''{{color2|{{leafgreen color}}|Pokémon FireRed and LeafGreen Versions|LeafGreen}}'''<sup>EN-US</sup> || 0x0825477C
|}


===Fingerprint===
Below is a sample of the data for the first few base stat data structures.
<pre>
<pre>
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ?????????? (used for unknown/glitch Pokémon)
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ?????????? (used for unknown/glitch Pokémon)
Line 184: Line 291:
...
...
</pre>
</pre>
==Storage==
The following are offsets for the first entry (Bulbasaur) in each GBA game (US version?).  Note that a game is loaded into RAM at 0x08000000, so the offset in a ROM dump will only be the last six digits.
* Ruby: 0x081FEC34
* Sapphire: 0x081FEBC4
* Emerald: 0x082F0D70
* Emerald (EN-US): 0x083203E8
* FireRed: 0x082111A8
* FireRed (EN-US): 0x082547A0
* LeafGreen: 0x08211184
* LeafGreen (EN-US): 0x0825477C


{{data structure}}<br>
{{data structure}}<br>
{{Project Games notice|data structure}}
{{Project Games notice|data structure}}