Difference between revisions of "Hidden Power (move)/Calculation"
(→Trivia) 
Blueapple128 (Talk  contribs) (From Smogon; also matches the fact a Shiny Pokemon's Hidden Power base power must be 50 or 70.) 

Line 81:  Line 81:  
* The variables v through y (the "damage bits") represent the {{wpmost significant bit}} of each IV. If a variable is less than eight, this bit is 0; otherwise, it is 1. 
* The variables v through y (the "damage bits") represent the {{wpmost significant bit}} of each IV. If a variable is less than eight, this bit is 0; otherwise, it is 1. 

−  :* v and w depend on the Attack and Defense stats respectively. 
+  :* v depends on the Special IV. 
−  :* x depends on the Speed stat. 
+  :* w depends on the Speed IV. 
−  :* y depends on the Special stat. 
+  :* x depends on the Defense IV. 
−  * Z is equal to the Special stat when the Special stat is less than or equal to 3; when the Special stat is greater than 3, Z is equal to 3. 
+  :* y depends on the Attack IV. 
+  * Z is equal to the Special IV if the Special IV is less than 3; otherwise Z is equal to 3. 

Hidden Power's power is therefore a number ranging from 31 to 70, inclusively. 
Hidden Power's power is therefore a number ranging from 31 to 70, inclusively. 
Revision as of 20:46, 27 June 2013
In the Pokémon games, Hidden Power is a Normaltype move when the type is displayed, such as in battle and on status screens. However, the actual type of Hidden Power is determined by the Pokémon's individual values, and through calculation, can be set as one of the sixteen other natural types and with a power between 30 and 70.
The type of Hidden Power can be checked in Veilstone Game Corner's prize house in Pokémon Platinum, the Celadon Game Corner in Pokémon HeartGold and SoulSilver, in Mistralton City's Pokémon Center in Pokémon Black and White, and at the PWT in Pokémon Black 2 and White 2. There remains no ingame way to determine the power level directly, however.
Contents
Generation II
Type
Consider an example Pokémon, like Pikachu with this set of IVs:
Hit Points  Attack  Defense  Speed  Special  
14  15  15  15  14 
The type is determined by taking the two least significant bits of the Attack and Defense IVs, then concatenating these two values in that order.
Mathematically, this is the equivalent of:
Where a represents the Attack IV and b represents the Defense IV.
The resulting number will correspond to a type as marked below.
Number  Type 

0  Fighting 
1  Flying 
2  Poison 
3  Ground 
4  Rock 
5  Bug 
6  Ghost 
7  Steel 
8  Fire 
9  Water 
10  Grass 
11  Electric 
12  Psychic 
13  Ice 
14  Dragon 
15  Dark 
In our example, we get:
HPtype=4*(15 mod 4)+(15 mod 4)=4*3+3=12+3=15, which means that our Pikachu has a Darktype Hidden Power.
Damage
The damage of the Hidden Power is calculated using the following formula:
 The variables v through y (the "damage bits") represent the most significant bit of each IV. If a variable is less than eight, this bit is 0; otherwise, it is 1.
 v depends on the Special IV.
 w depends on the Speed IV.
 x depends on the Defense IV.
 y depends on the Attack IV.
 Z is equal to the Special IV if the Special IV is less than 3; otherwise Z is equal to 3.
Hidden Power's power is therefore a number ranging from 31 to 70, inclusively.
In our example, we get:
Hit Points  Attack  Defense  Speed  Special  
14 N/A 
15 1 
15 1 
15 1 
14 1 
HP Power = Floor[(5*(1 + 2*1 + 4*1 + 8*1) + 3)/2+31] = Floor[(5*(1 + 2 + 4 + 8) + 3)/2+31] = Floor[(5*15 + 3)/2+31] = Floor[(75 + 3)/2+31] = Floor[78/2+31] = Floor[39+31] = Floor[70] = 70, which means that our Pikachu's Hidden Power's power is 70
Hit Points  Attack  Defense  Speed  Special  
14  15  15  15  14 
Hidden Power:  Type: Dark 
Power: 70 
Generation III and on
This article is incomplete. Please feel free to edit this article to add missing information and complete it. Reason: Confirmation for Generation V games. 
Type
Consider an example Pokémon, like Pikachu with this set of IVs:
Hit Points  Attack  Defense  Speed  Sp.Attack  Sp.Defense  
30  31  31  31  30  31 
Hidden Power's type of a Pokémon with given IVs is represented by a number, calculated with this formula:
where a,b,c,d,e,f (the "type bits") are the least significant bit of their respective IV's. If a number is odd, its least significant bit is 1, and it is 0 otherwise.
 a depends on the HP IV.
 b and c depend on the Attack and Defense IV's respectively.
 d depends on the Speed IV.
 e and f depend on the Special Attack and Special Defense IV's respectively.
This simply means that every element of the sum in the brace is the remainder of division of corresponding IV and 2, multiplied by appropriate power of 2 (2^{0} in case of a and 2^{5} in case of f). The sum may range from 0 (when all IVs are even) to 63 (when all IVs are odd), inclusive. It is worth mentioning that the computed sum may be easily calculated by putting its variables a,b,c,d,e,f together in reverse order and interpreting this as a number in the binary system, which then needs to be reverted to decimal system:
fedcba_{(2)} = 32f+16e+8d+4c+2b+a _{(10)}
The summed value is then multiplied by 15 and divided by 63, to be sure that the number representing Hidden Power Type will range from 0 to 15, inclusively (16 values in total). The calculated number is then rounded down (floor[]), which simply means that only integral part of the calculated number is considered.
The resulting number will correspond to a type as marked below.
Number  Type 

0  Fighting 
1  Flying 
2  Poison 
3  Ground 
4  Rock 
5  Bug 
6  Ghost 
7  Steel 
8  Fire 
9  Water 
10  Grass 
11  Electric 
12  Psychic 
13  Ice 
14  Dragon 
15  Dark 
In our example, we get:
Hit Points  Attack  Defense  Speed  Sp.Attack  Sp.Defense  
30 0 
31 1 
31 1 
31 1 
30 0 
31 1 
HP Type = Floor[(0 + 2 + 4 + 8 + 0 + 32)*15/63] = Floor[46*15/63] = Floor[10.952] = 10, which means that our Pikachu has a Grasstype Hidden Power.
Damage
Damage of the Hidden Power is calculated in a manner very similar to that of its type, using the following formula:
 The variables u through z (the "damage bits") represent the second to last bit of each IV. If a variable has a remainder of 2 or 3 when divided by 4, this bit is 1. Otherwise, the bit is zero.
 u depends on the HP stat.
 v and w depend on the Attack and Defense stats respectively.
 x depends on the Speed stat.
 y and z depend on the Special Attack and Special Defense stats respectively.
Like before, the sum may range from 0 to 63, inclusively. The calculated number is then multiplied by 40 and divided by 63 to make sure that the fraction will not exceed 40. Then, the number is increased by 30 and rounded down, making Hidden Power's power a number ranging from 30 to 70, inclusively.
In our example, we get:
Hit Points  Attack  Defense  Speed  Sp.Attack  Sp.Defense  
30 1 
31 1 
31 1 
31 1 
30 1 
31 1 
HP Power = Floor[((1 + 2 + 4 + 8 + 16 + 32)*40/63)+30] = Floor [(63*40/63)+30] = Floor[70] = 70, which means that our Pikachu's Hidden Power's power is 70
Hit Points  Attack  Defense  Speed  Sp.Attack  Sp.Defense  
30  31  31  31  30  31 
Hidden Power:  Type: Grass 
Power: 70 
Number of possible Hidden Powers
As there are 6 IVs, ranging from 0 to 31 (32 in total), the number of different possible Hidden Powers should be 32^{6}=2^{30}, which is more than one billion possibilities. But let us consider two Pokémon with one different IV:
Hit Points  Attack  Defense  Speed  Sp.Attack  Sp.Defense  
30  31  31  31  30  31 
and
Hit Points  Attack  Defense  Speed  Sp.Attack  Sp.Defense  
26  31  31  31  30  31 
As we see, both 26 and 30 are divisible by 2 and give the remainder of 2 when divided by 4. So, in both cases the algorithms will interpret the IVs of those Pokémon in the same way, returning Grasstype Hidden Power with 70 power. It means that for the mentioned algorithms an IV of 30 is treated in the same way like IVs of 2,6,10,14,18,22 and 26 (8 in total).
In fact, there are only four essentially different types of IV when calculating Hidden Power:
1.  IV that gives a remainder of 0 when divided by 4  has damage bit 0 and type bit 0:  0, 4, 8, 12, 16, 20, 24, 28 
2.  IV that gives a remainder of 1 when divided by 4  has damage bit 0 and type bit 1:  1, 5, 9, 13, 17, 21, 25, 29 
3.  IV that gives a remainder of 2 when divided by 4  has damage bit 1 and type bit 0:  2, 6, 10, 14, 18, 22, 26, 30 
4.  IV that gives a remainder of 3 when divided by 4  has damage bit 1 and type bit 1:  3, 7, 11, 15, 19, 23, 27, 31 
In other words: only four IVs that give different remainders when divided by four would cover all possible Hidden Power types and powers.
If so, the number of possible Hidden Powers should be 4^{6}=2^{12}=64*64=4096. This number, however is again far too large, as the real number of possible variations of Hidden power is simply 16*41=656, as Hidden Power exists in 16 types and has 41 different powers. The significant difference between 656 and 4096 is explained by the function floor[], which reduces theoretically different numbers (for example 10.952 and 10.476) to the same integer, or whole number (in this case 10).
Percentage distribution of different variations of Hidden Power
Due to the fact that both Hidden Power's type and its power are the products of rounding down, chances of getting a Pokémon with certain Hidden Power are not equal, as one might have thought, and are different for every Hidden Power's type and damage value.
As it was stated before, the number of theoretically different Hidden Powers is 4096, which is the result of multiplying theoretical values of possible types (64) and powers (also 64). It means that every of 64 "types" comes into 64 "powers". After rounding down, however, the number of 64 "types" is reduced to 16 and the number of 64 "powers" to 41.


Trivia
 Although Hidden Power is listed as a Normaltype move, it cannot damage as a Normaltype attack (unless used by a Pokémon with the Ability Normalize).
 In Generation II, the calculation of the type and power of Hidden Power is completely independent of the HP IV.
External links
Many Pokémon related sites prepared webbased calculators, which allows to compute Hidden Power of a Pokémon with given IVs:
 Psypoke's Hidden Power calculator (Generation II)
 Psypoke's Hidden Power calculator (Generation III and on)
 Legendary Pokémon Hidden Power calculator (Generation III and on)
This game mechanic article is part of Project Games, a Bulbapedia project that aims to write comprehensive articles on the Pokémon games. 
 Mark McQuillan's Machamp to be distributed at Australian National Championships: Based on 2015 ...
 CD Media to become Nintendo distributor in Greece: Nintendo to return to Greece this October
 Pokémon Sun and Moon SteelBooks to be available in Europe, Russia: To be available on launch day
 Solgaleo and Lunala New 3DS XL to be available in Europe, Australia, New Zealand: To be ...
 Red Rescue Team, Blue Rescue Team, Explorers of Sky coming to North American Wii U Virtual ...