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

talk about neglected
(talk about neglected)
Line 1: Line 1:
=Format=
==Format==
A Pokémon's data is slightly more complex than the rest of the structure. It is stored as four substructures, each 12 bytes in length:
A Pokémon's data is slightly more complex than the rest of the structure. It is stored as four substructures, each 12 bytes in length:


Line 88: Line 88:
|}
|}


==Order==
===Order===
The order of the structures is determined by the [[personality value]] of the Pokémon. The order is determined by the value modulo 24:
The order of the structures is determined by the [[personality value]] of the Pokémon. The order is determined by the value modulo 24:


Line 126: Line 126:
Where G, A, E, and M stand for the substructures: growth, attacks, effort, and Misc. respectively.
Where G, A, E, and M stand for the substructures: growth, attacks, effort, and Misc. respectively.


==Encryption==
===Encryption===


The entire data structure is encrypted by XORing the entire Trainer ID with the personality value, after that you will get a 4 bytes value, then XORing the resulting value with the data (one long value at a time, p/s: one long value here refer to 4 bytes). The same process is used to decrypt the encrypted data, for detail check on use of [http://en.wikipedia.org/wiki/Xor XOR]. The correct checksum is found by summing the original values, not the encrypted values.
The entire data structure is encrypted by XORing the entire Trainer ID with the personality value, after that you will get a 4 bytes value, then XORing the resulting value with the data (one long value at a time, p/s: one long value here refer to 4 bytes). The same process is used to decrypt the encrypted data, for detail check on use of [http://en.wikipedia.org/wiki/Xor XOR]. The correct checksum is found by summing the original values, not the encrypted values.


=Notes=
==Notes==
==PP bonuses==
===PP bonuses===


The PP bonuses byte stores the number of [[Item#PP Up|PP Up]]s used for each attack. Two bits per attack, starting with the first attack from the least significant bits upward to the last attack.
The PP bonuses byte stores the number of [[Item#PP Up|PP Up]]s used for each attack. Two bits per attack, starting with the first attack from the least significant bits upward to the last attack.


==Pokérus status==
===Pokérus status===


[[Pokérus]] status is stored in a single byte. The lower 4 bits represents the number of units of time left until the virus wears away. If any bit in the upper 4 bits is set, the Pokémon is immune to Pokérus, indicated a small black dot appears on the Pokémon's status screen. Both values are completely random when caught, leading to the fact that not all Pokémon contract the virus for the same amount of time and some are able to catch it again.
[[Pokérus]] status is stored in a single byte. The lower 4 bits represents the number of units of time left until the virus wears away. If any bit in the upper 4 bits is set, the Pokémon is immune to Pokérus, indicated a small black dot appears on the Pokémon's status screen. Both values are completely random when caught, leading to the fact that not all Pokémon contract the virus for the same amount of time and some are able to catch it again.


==Level caught==
===Level caught===


Level caught is a 7-bit value, not an 8-bit value like the one found in the [[Pok%C3%A9mon_data_structure_in_the_GBA|main Pokémon structure]]. Therefore, it can be treated as a signed value, but when it is reported only the magnitude is included, limiting it to the range of 1-127. This range does not include zero because setting this value to zero causes the game to produce the "Level 5 (egg)" message instead of the regular "Level # (met)" message.
Level caught is a 7-bit value, not an 8-bit value like the one found in the [[Pok%C3%A9mon_data_structure_in_the_GBA|main Pokémon structure]]. Therefore, it can be treated as a signed value, but when it is reported only the magnitude is included, limiting it to the range of 1-127. This range does not include zero because setting this value to zero causes the game to produce the "Level 5 (egg)" message instead of the regular "Level # (met)" message.


==Poké Ball / Trainer gender==
===Poké Ball / Trainer gender===


The gender of the Trainer that caught a Pokémon is stored in the data section, and is determined by the most significant bit of this byte. Bits 3-6 store the [[Poké Ball]] type that the Pokémon was caught in.
The gender of the Trainer that caught a Pokémon is stored in the data section, and is determined by the most significant bit of this byte. Bits 3-6 store the [[Poké Ball]] type that the Pokémon was caught in.


==DVs==
===DVs===


DVs are stored pretty logically. Starting from the least significant bit, each stat from HP to Special Defense takes up 5 bits, leaving the uppermost 2 bits zeroed.
DVs are stored pretty logically. Starting from the least significant bit, each stat from HP to Special Defense takes up 5 bits, leaving the uppermost 2 bits zeroed.