Personality value

From Bulbapedia, the community-driven Pokémon encyclopedia.
Revision as of 01:55, 4 May 2008 by Reuvens (talk | contribs) (→‎Shininess: Changed the <= to just plain <.)
Jump to navigationJump to search

A Pokémon's personality value is an unsigned 32-bit integer that is created when the Pokémon is first encountered; it is set as soon as the Pokémon appears in the wild, the Pokémon's egg is received from the daycare man or another NPC, or the Pokémon itself is received from an NPC. As an unsigned 32-bit integer, its value can be anywhere between 0 and 4294967295 inclusive, represented as a string of 32 0's and 32 1's in binary, respectively. This value was introduced with the Pokémon data structure overhaul that occurred at the start of Generation III.

For each operation, the portion of the 32-bit value used will be indicated at the beginning of the section by highlighting, unless the full value is used. The integer's full value will be known as p, other values will be declared as px, py, and so on. Much of this article will be discussing values in binary.

Gender

00000000 00000000 00000000 00000000

A Pokémon's gender is determined by the lowest eight digits (a byte) of p in binary form; essentially, p%256. This value will, from here on out, be known as pgender.

In a Pokémon species's base stat structure, there is a byte that may be set to any value between 00000000 and 11111111. For genderless Pokémon such as Magnemite, the value of this byte always is 11111111. Pokémon with gender, however, occupy the rest of the gamut. For these Pokémon, if the value of pgender is greater than that of the base stat value, the Pokémon is male. Likewise, if pgender is equal to or less than the base stat value, the Pokémon is female.

Ability

If p is even, that Pokémon has the first ability for its species. If it's odd, it has the second. If a species has only one ability while p is odd, it gets the only ability it can. Pokémon transferred from Generation III to Generation IV that can get one of the new abilities will retain the ability they had in Generation III, however, if they are evolved and their personality value is odd, they will get the new ability upon evolution.

Nature

A Pokémon's nature is (p%25).

The number acquired as the remainder corresponds to the personality as follows:

p%25 Nature
0 Hardy
1 Lonely
2 Brave
3 Adamant
4 Naughty
5 Bold
6 Docile
7 Relaxed
8 Impish
9 Lax
10 Timid
11 Hasty
12 Serious
13 Jolly
14 Naïve
15 Modest
16 Mild
17 Quiet
18 Bashful
19 Rash
20 Calm
21 Gentle
22 Sassy
23 Careful
24 Quirky

Shininess

00000000 00000000 00000000 00000000

The red value will be represented as p1, while the blue value will be represented as p2.

Whether a Pokémon is shiny or not depends on the values of the Trainer ID number, secret ID number, and personality value.

Variables E and F are declared to hold the values that result.

A bitwise exclusive or (xor) operation (such as a xor b = c) is equivalent to saying "If each byte of ab, c is true." In other words, 11010101 xor 01101010 = 10111101. Each xor in the operation is a bitwise xor.

E = IDTrainer xor IDSecret

F = p1 xor p2

E xor F < 8 , then Shiny

Example

As an example, let's take a trainer whose Trainer ID is 24294 and whose Secret ID is 38834.

IDTrainer = 24294 = 0101111011100110 in binary.

IDSecret = 38834 = 1001011110110010 in binary.

This trainer encounters a Pokémon whose personality value is 2814471828.

p = 2814471828 = 1010011111000001 0110111010010100 in binary.

p1 = 1010011111000001

p2 = 0110111010010100


The E value is 0101111011100110 xor 1001011110110010

E = 1100100101010100

The F value is 1010011111000001 xor 0110111010010100

F = 1100100101010101


E xor F = 0000000000000001, which is less than eight. Therefore, this Pokémon is shiny.

Spinda's spots

00000000 00000000 00000000 00000000

Spinda has four spots: two on its face, and one on each of its ears. Each of the four bytes represents the coordinates of the spot on Spinda's face or ears. The first four digits of each byte represents the x-coordinate of the center of the spot when translated into decimal notation, while the last four represent the y-coordinate of the center of the spot when translated into decimal.

Unown's letter

00000000 00000000 00000000 00000000

pletter = 00000000

Unown's letter is taken from the modulus of the combination of the least significant 2 bits of each byte in p. With A representing 0, and each letter thereafter representing the following number value (? as 26 and ! as 27), the letter can be determined by:

up = pletter%28

Wurmple's evolution

00000000 00000000 00000000 00000000

The value in red will be known as pw; it is essentially p%32768.

Wurmple's evolution does not depend on time of day, despite what many guides say. In fact, the evolution is determined by taking pw%10, then determining if the remainder is less than or greater than or equal to 5. If it is less than that, Wurmple will become a Silcoon, otherwise, it will become a Cascoon.