about summary refs log tree commit diff stats
path: root/include/pokemon.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/pokemon.h')
-rw-r--r--include/pokemon.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/include/pokemon.h b/include/pokemon.h index d8a7265..bd311c4 100644 --- a/include/pokemon.h +++ b/include/pokemon.h
@@ -20,8 +20,23 @@ enum PokemonLanguage {
20 Spanish = 7 20 Spanish = 7
21}; 21};
22 22
23struct PokemonIntermediate { 23struct __attribute__((aligned(4))) PokemonIntermediate {
24 u32 otId; 24 // a hash that can be used to identify the Pokémon. because the games do not
25 // naturally generate unique identifiers for Pokémon, this hash is generated
26 // from parts of the Pokémon's data that are guaranteed never to change. the
27 // parts used are the trainer ID and secret ID of the Pokémon's original
28 // trainer, the personality value, and the IVs. almost all of this data is
29 // secret, and should not be derivable from the identifier, which is why the
30 // identifier is hashed. while this identifier is not guaranteed to be unique,
31 // probability of collision is astronomically small given that the
32 // personality value and IVs provide essentially 52 bits of randomness
33 // (technically less because the IVs of bred Pokémon are not uniformly
34 // random, but this variation is statistically insignificant). the OT ID,
35 // while not uniformly random (amongst Pokémon), is included as a sort of
36 // "namespace", in that any Pokémon with matching PVs and IVs must also have
37 // the same OT, thus preventing collaboratively finding PV and IV collisions.
38 u32 key[7];
39
25 u32 experience; 40 u32 experience;
26 41
27 // the stats are calculated from the base stats, IVs, EVs, and Nature, before 42 // the stats are calculated from the base stats, IVs, EVs, and Nature, before
@@ -36,6 +51,7 @@ struct PokemonIntermediate {
36 u16 species; 51 u16 species;
37 u16 heldItem; 52 u16 heldItem;
38 u16 moves[4]; 53 u16 moves[4];
54 u16 otId; // only the lower 2 bytes, because the upper 2 are secret
39 55
40 u8 ppBonuses; 56 u8 ppBonuses;
41 u8 otGender:1; 57 u8 otGender:1;