Pokémon data substructures (Generation III): Difference between revisions
m →Origins: replaced: {{OBP|Poké Ball|item}} → {{i|Poké Ball}} |
m Text replacement - "}}<br>↵{{Project Games notice" to "}} {{Project Games notice" |
||
(16 intermediate revisions by 7 users not shown) | |||
Line 2: | Line 2: | ||
==Format== | ==Format== | ||
A Pokémon's data is slightly more complex than the rest of the | A Pokémon's data is slightly more complex than the rest of the {{OBP|Pokémon data structure|Generation III}}. It is stored as four distinct substructures, each 12 bytes in length. (The Notes section below explains some of these fields in greater detail.) | ||
{| cellspacing="3" style="border: 1px solid #88a; padding: 0.5em" | {| cellspacing="3" style="border: 1px solid #88a; padding: 0.5em" | ||
Line 16: | Line 16: | ||
! || size<br>(bytes) || offset<br>(bytes) | ! || size<br>(bytes) || offset<br>(bytes) | ||
|- | |- | ||
| [[List of Pokémon by index number | | [[List of Pokémon by index number in Generation III|Species]] || 2 || 0 | ||
| [[List of moves|Move]] 1 || 2 || 0 | | [[List of moves|Move]] 1 || 2 || 0 | ||
| [[Stats#HP|HP]] EV || 1 || 0 | | [[Stats#HP|HP]] EV || 1 || 0 | ||
| [[Pokérus]] status || 1 || 0 | | [[Pokérus]] status || 1 || 0 | ||
|- | |- | ||
| [[List of items by index number | | [[List of items by index number in Generation III|Item held]] || 2 || 2 | ||
| Move 2 || 2 || 2 | | Move 2 || 2 || 2 | ||
| [[Stats#Attack|Attack]] EV || 1 || 1 | | [[Stats#Attack|Attack]] EV || 1 || 1 | ||
| [[List of locations by index number | | [[List of locations by index number in Generation III|Met location]] || 1 || 1 | ||
|- | |- | ||
| [[Experience]] || 4 || 4 | | [[Experience]] || 4 || 4 | ||
Line 31: | Line 31: | ||
| Origins info || 2 || 2 | | Origins info || 2 || 2 | ||
|- | |- | ||
| [[ | | [[PP Up|PP bonuses]] || 1 || 8 | ||
| Move 4 || 2 || 6 | | Move 4 || 2 || 6 | ||
| [[Stats#Speed|Speed]] EV || 1 || 3 | | [[Stats#Speed|Speed]] EV || 1 || 3 | ||
Line 37: | Line 37: | ||
|- | |- | ||
| [[Friendship]] || 1 || 9 | | [[Friendship]] || 1 || 9 | ||
| | | [[PP]] 1 || 1 || 8 | ||
| [[Stats#Special Attack|Special Attack]] EV || 1 || 4 | | [[Stats#Special Attack|Special Attack]] EV || 1 || 4 | ||
| [[Ribbons]] and [[Obedience]] || 4 || 8 | | [[Ribbons]] and [[Obedience]] || 4 || 8 | ||
|- | |- | ||
| '' | | ''Unused'' || 2 || 10 | ||
| PP 2 || 1 || 9 | | PP 2 || 1 || 9 | ||
| [[Stats#Special Defense|Special Defense]] EV || 1 || 5 | | [[Stats#Special Defense|Special Defense]] EV || 1 || 5 | ||
Line 98: | Line 98: | ||
===Encryption=== | ===Encryption=== | ||
The four data substructures are stored in an encrypted form. Decrypting the data involves two steps: actually decrypting the data, and validating the decrypted data. To obtain the 32-bit decryption key, the entire [[Original Trainer]] [[Trainer ID number|ID number]] must be {{wp|XOR}}ed with the personality value of the entry. This key can then be used to decrypt the data by XORing it, 32 bits (or 4 bytes) at a time. To validate the checksum given in the encapsulating | The four data substructures are stored in an encrypted form. Decrypting the data involves two steps: actually decrypting the data, and validating the decrypted data. To obtain the 32-bit decryption key, the entire [[Original Trainer]] [[Trainer ID number|ID number]] must be {{wp|XOR}}ed with the personality value of the entry. This key can then be used to decrypt the data by XORing it, 32 bits (or 4 bytes) at a time. To validate the checksum given in the encapsulating {{OBP|Pokémon data structure|Generation III}}, the entirety of the four unencrypted data substructures must be summed into a 16-bit value. | ||
==Notes== | ==Notes== | ||
===PP bonuses=== | ===PP bonuses=== | ||
The PP bonuses byte stores the number of times | The PP bonuses byte stores the number of times [[PP]] has been increased for each move in the attacks substructure. Each move has two bits, meaning the PP of each move can be increased 0 to 3 times. | ||
{| style="border: 1px solid #88a; background: #f8f8ff; padding: 0.5em; border-collapse: collapse; margin: 0 0 0.5em 0.5em" cellpadding=2 | {| style="border: 1px solid #88a; background: #f8f8ff; padding: 0.5em; border-collapse: collapse; margin: 0 0 0.5em 0.5em" cellpadding=2 | ||
! Bits || Move | ! Bits || Move | ||
Line 136: | Line 136: | ||
! Value || Gender || Value || Ball || Value || Game || Value || Interpretation | ! Value || Gender || Value || Ball || Value || Game || Value || Interpretation | ||
|- | |- | ||
| 0 || style="color:#{{blue color}}" | '''Male''' || 1 || {{bag2|Master Ball}} || | | 0 || style="color:#{{blue color}}" | '''Male''' || 1 || {{bag2|Master Ball}} || 1 || '''{{color2|{{sapphire color}}|Pokémon Ruby and Sapphire Versions|Sapphire}}''' || 0 || Hatched | ||
|- | |- | ||
| 1 || style="color:#{{red color}}" | '''Female''' || 2 || {{bag2|Ultra Ball}} || | | 1 || style="color:#{{red color}}" | '''Female''' || 2 || {{bag2|Ultra Ball}} || 2 || '''{{color2|{{ruby color}}|Pokémon Ruby and Sapphire Versions|Ruby}}''' || >0 || Caught or other | ||
|- | |- | ||
| rowspan=10 colspan=2 | || 3 || {{bag2|Great Ball}} || | | rowspan=10 colspan=2 | || 3 || {{bag2|Great Ball}} || 3 || '''{{color2|{{emerald color}}|Pokémon Emerald Version|Emerald}}''' | ||
|- | |- | ||
| 4 || {{bag|Poké Ball}} {{i|Poké Ball}} || | | 4 || {{bag|Poké Ball}} {{i|Poké Ball}} || 4 || '''{{color2|{{firered color}}|Pokémon FireRed and LeafGreen Versions|FireRed}}''' | ||
|- | |- | ||
| 5 || {{bag2|Safari Ball}} || | | 5 || {{bag2|Safari Ball}} || 5 || '''{{color2|{{leafgreen color}}|Pokémon FireRed and LeafGreen Versions|LeafGreen}}''' | ||
|- | |- | ||
| 6 || {{bag2|Net Ball}} || | | 6 || {{bag2|Net Ball}} || 15 || '''{{color2|{{colo color}}|Pokémon Colosseum|Colosseum}}''' or '''{{color2|{{xd color}}|Pokémon XD: Gale of Darkness|XD}}''' | ||
|- | |- | ||
| 7 || {{bag2|Dive Ball}} | | 7 || {{bag2|Dive Ball}} | ||
|- | |- | ||
| 8 || {{bag2|Nest Ball}} | | 8 || {{bag2|Nest Ball}} | ||
Line 189: | Line 189: | ||
For most of the [[Ribbon]]s, a value of 0 indicates that the Pokémon does not have the Ribbon while 1 indicates that it does. For the {{pkmn|Contest}} Ribbons, the values 1 to 4 indicate that the Pokémon has the Ribbon or Ribbons for (respectively) the Normal, Super, Hyper, and Master Ranks of that Contest. | For most of the [[Ribbon]]s, a value of 0 indicates that the Pokémon does not have the Ribbon while 1 indicates that it does. For the {{pkmn|Contest}} Ribbons, the values 1 to 4 indicate that the Pokémon has the Ribbon or Ribbons for (respectively) the Normal, Super, Hyper, and Master Ranks of that Contest. | ||
In-game, the descriptions of the last 7 ribbons (corresponding to bits 20-26) are blank by default. What text appears there is determined by the method those ribbons are attained. Also note that some of these ribbons are unobtainable and/or had different names prior to Gen 5. For a full list of possible descriptions see [[List of Ribbons in the games#Gift Ribbon descriptions|here]]. | |||
{| style="border: 1px solid #88a; background: #f8f8ff; padding: 0.5em; border-collapse: collapse; margin: 0 0 0.5em 0.5em" cellpadding=2 | {| style="border: 1px solid #88a; background: #f8f8ff; padding: 0.5em; border-collapse: collapse; margin: 0 0 0.5em 0.5em" cellpadding=2 | ||
Line 214: | Line 214: | ||
| 19 || {{DL|List of Ribbons in the games|Effort Ribbon|Effort}} | | 19 || {{DL|List of Ribbons in the games|Effort Ribbon|Effort}} | ||
|- | |- | ||
| 20 || | | 20 || {{DL|List of Ribbons in the games|Battle Champion Ribbon|{{tt|Battle Champion Ribbon|Marine Ribbon in gen 3/4}}}} | ||
|- | |- | ||
| 21 || | | 21 || {{DL|List of Ribbons in the games|Battle Regional Ribbon|{{tt|Regional Champion Ribbon|Land Ribbon in gen 3/4}}}} | ||
|- | |- | ||
| 22 || | | 22 || {{DL|List of Ribbons in the games|National Champion Ribbon|{{tt|National Champion Ribbon|Sky Ribbon in gen 3/4}}}} | ||
|- | |- | ||
| 23 || | | 23 || {{DL|List of Ribbons in the games|Country Ribbon|Country}} | ||
|- | |- | ||
| 24 || | | 24 || {{DL|List of Ribbons in the games|National Ribbon|National}} | ||
|- | |- | ||
| | | 25 || {{DL|List of Ribbons in the games|Earth Ribbon|Earth}} | ||
|- | |||
| 26 || {{DL|List of Ribbons in the games|World Ribbon|World}} | |||
|} | |} | ||
Line 230: | Line 232: | ||
==See also== | ==See also== | ||
* [[Pokémon data structure | * [[Pokémon data structure (Generation III)]] | ||
==Links== | ==Links== | ||
Line 238: | Line 240: | ||
<references/> | <references/> | ||
{{data structure}} | {{data structure}} | ||
{{Project Games notice|data structure}} | {{Project Games notice|data structure}} |
Revision as of 17:33, 16 September 2024
This is the list of Pokémon data substructures in the Generation III Game Boy Advance games, Pokémon Ruby, Sapphire, FireRed, LeafGreen, and Emerald.
Format
A Pokémon's data is slightly more complex than the rest of the Pokémon data structure. It is stored as four distinct substructures, each 12 bytes in length. (The Notes section below explains some of these fields in greater detail.)
Growth | Attacks | EVs & Condition | Miscellaneous | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
size (bytes) |
offset (bytes) |
size (bytes) |
offset (bytes) |
size (bytes) |
offset (bytes) |
size (bytes) |
offset (bytes) | ||||
Species | 2 | 0 | Move 1 | 2 | 0 | HP EV | 1 | 0 | Pokérus status | 1 | 0 |
Item held | 2 | 2 | Move 2 | 2 | 2 | Attack EV | 1 | 1 | Met location | 1 | 1 |
Experience | 4 | 4 | Move 3 | 2 | 4 | Defense EV | 1 | 2 | Origins info | 2 | 2 |
PP bonuses | 1 | 8 | Move 4 | 2 | 6 | Speed EV | 1 | 3 | IVs, Egg, and Ability | 4 | 4 |
Friendship | 1 | 9 | PP 1 | 1 | 8 | Special Attack EV | 1 | 4 | Ribbons and Obedience | 4 | 8 |
Unused | 2 | 10 | PP 2 | 1 | 9 | Special Defense EV | 1 | 5 | |||
PP 3 | 1 | 10 | Coolness | 1 | 6 | ||||||
PP 4 | 1 | 11 | Beauty | 1 | 7 | ||||||
Cuteness | 1 | 8 | |||||||||
Smartness | 1 | 9 | |||||||||
Toughness | 1 | 10 | |||||||||
Feel | 1 | 11 |
Substructure order
The order of the structures is determined by the personality value of the Pokémon modulo 24, as shown below, where G, A, E, and M stand for the substructures growth, attacks, EVs and condition, and miscellaneous, respectively.
00. GAEM | 06. AGEM | 12. EGAM | 18. MGAE |
01. GAME | 07. AGME | 13. EGMA | 19. MGEA |
02. GEAM | 08. AEGM | 14. EAGM | 20. MAGE |
03. GEMA | 09. AEMG | 15. EAMG | 21. MAEG |
04. GMAE | 10. AMGE | 16. EMGA | 22. MEGA |
05. GMEA | 11. AMEG | 17. EMAG | 23. MEAG |
Encryption
The four data substructures are stored in an encrypted form. Decrypting the data involves two steps: actually decrypting the data, and validating the decrypted data. To obtain the 32-bit decryption key, the entire Original Trainer ID number must be XORed with the personality value of the entry. This key can then be used to decrypt the data by XORing it, 32 bits (or 4 bytes) at a time. To validate the checksum given in the encapsulating Pokémon data structure, the entirety of the four unencrypted data substructures must be summed into a 16-bit value.
Notes
PP bonuses
The PP bonuses byte stores the number of times PP has been increased for each move in the attacks substructure. Each move has two bits, meaning the PP of each move can be increased 0 to 3 times.
Bits | Move |
---|---|
0-1 | Move 1 |
2-3 | Move 2 |
4-5 | Move 3 |
6-7 | Move 4 |
Pokérus status
Pokérus status is stored in a single byte, with the upper and lower halves representing distinct values.
Bits | Interpretation |
---|---|
0-3 | Days left until Pokérus is cured |
4-7 | Pokérus "strain" |
Any value from 0 to 15 is valid for the strain, with 0 indicating that the Pokémon does not have Pokérus at all. The number of days can be any value from 0 to 4, although for some "strains", some of those higher values are also invalid. If any bit is set in the "strain" and the number of days is at 0, the Pokémon has been "cured" of Pokérus, as indicated by a small black dot on the Pokémon's status screen.
Origins
Trainer gender tells the game how to color the name of the Pokémon's Original Trainer on the Pokémon's status screen. If Level met is 0, it is interpreted as the Pokémon having been hatched from an Egg; however, the games only differentiate a hatched Pokémon from other Pokémon if its current Trainer is the Pokémon's Original Trainer. If a hatched Pokémon is traded, its origin text on the status screen is displayed just like a caught Pokémon's and will not say "Hatched" or "Egg".
Trainer gender | Poké Ball caught in | Game of origin | Level met | ||||
---|---|---|---|---|---|---|---|
Bit 15 | Bits 11 - 14 | Bits 7 - 10 | Bits 0 - 6 | ||||
Value | Gender | Value | Ball | Value | Game | Value | Interpretation |
0 | Male | 1 | ![]() |
1 | Sapphire | 0 | Hatched |
1 | Female | 2 | ![]() |
2 | Ruby | >0 | Caught or other |
3 | ![]() |
3 | Emerald | ||||
4 | ![]() |
4 | FireRed | ||||
5 | ![]() |
5 | LeafGreen | ||||
6 | ![]() |
15 | Colosseum or XD | ||||
7 | ![]() | ||||||
8 | ![]() | ||||||
9 | ![]() | ||||||
10 | ![]() | ||||||
11 | ![]() | ||||||
12 | ![]() |
IVs, Egg, and Ability
IVs for each of the stats from HP to Special Defense take up the lowest 30 bits of this field, each IV taking 5 bits. Bit 30 is a 1 if the Pokémon is still an Egg or 0 otherwise. Bit 31 indicates the Ability the Pokémon has: 0 indicates its first Ability, while 1 indicates its second Ability (if it has one).
In the table below, bit 0 is the least significant bit of the 32-bit field and bit 31 is the most significant.
Bits | Stat |
---|---|
0-4 | HP |
5-9 | Attack |
10-14 | Defense |
15-19 | Speed |
20-24 | Special Attack |
25-29 | Special Defense |
30 | Egg? |
31 | Ability |
Ribbons and Obedience
For most of the Ribbons, a value of 0 indicates that the Pokémon does not have the Ribbon while 1 indicates that it does. For the Contest Ribbons, the values 1 to 4 indicate that the Pokémon has the Ribbon or Ribbons for (respectively) the Normal, Super, Hyper, and Master Ranks of that Contest.
In-game, the descriptions of the last 7 ribbons (corresponding to bits 20-26) are blank by default. What text appears there is determined by the method those ribbons are attained. Also note that some of these ribbons are unobtainable and/or had different names prior to Gen 5. For a full list of possible descriptions see here.
Bits | Ribbon |
---|---|
0-2 | Cool |
3-5 | Beauty |
6-8 | Cute |
9-11 | Smart |
12-14 | Tough |
15 | Champion |
16 | Winning |
17 | Victory |
18 | Artist |
19 | Effort |
20 | Battle Champion Ribbon |
21 | Regional Champion Ribbon |
22 | National Champion Ribbon |
23 | Country |
24 | National |
25 | Earth |
26 | World |
The highest bit of this field, bit 31, determines the obedience of Mew and Deoxys. If this bit is not set, Mew and Deoxys cannot be traded to or from Pokémon FireRed, LeafGreen, or Emerald, and will always disobey the player in battle in those games (except in link battles). If this bit is set on a Pokémon that is transferred to a later generation, the Pokémon will be treated as having had a fateful encounter.[1]
See also
Links
References
|
![]() |
This data structure article is part of Project Games, a Bulbapedia project that aims to write comprehensive articles on the Pokémon games. |