The exact catch rate formula of Pokémon is as follows:
a=((3*HPmax-2*HPcurrent)*rate*bonusball)/(3^HPmax)*bonusstatus
Where
- HPmax is the number of hit points the Pokémon has at full health,
- HPcurrent is the number of hit points the Pokémon has at the moment,
- rate is the catch rate of the Pokémon,
- bonusball is the multiplier for the Poké Ball used, and
- bonusstatus is the multiplier for any status ailment the Pokémon has (2 for sleep and freeze, 1.5 for paralyze, poison and burn).
Given this formula, the maximum value for
a (if the Pokémon could have 0 HP) would be catch rate × bonusball × bonusstatus. The minimum value for
a (for a Pokémon with full health) would be ⅓ × catch rate.
Calculate
b as follows:
b=(1048560/√ (√ 16711680/
a))=((2^16-1)4√
a)/(4√2^8-1)=(2^16-1)*4√ (
a/2^8-1)
Then generate 4 random numbers between 0 and 65535, inclusive. For each number, check whether it's less than
b; if so, the ball shakes once. If any number is greater than or equal to
b, the Pokémon immediately breaks free. If all four of the numbers are less than
b, then the Pokémon is caught. Note that if
a is 255 or greater, then
b is 65535 or greater, and then the Pokémon is guaranteed to be caught.
Therefore, the probability
p of catching a Pokémon, given the values
a and
b calculated above, is:
p={ 1 :
a > 255
{(
b+1/2^16)^4 :
a < 255
The second expression for
p may be expanded as follows:
p=1/2^64((2^16-1)4√ ((
a/2^8-1)+1)^4=(2^16-1)^4/(2^64)*(
a/2^8-1)+...
Since (2^16-1)4 ≈ 2^64, we can approximate
p with the following expression:
p≈
a/2^8-1
The percentage error in this approximation approaches 0 as
a approaches 255, and does not exceed 21.2%.
For a constant probability
p, the probability
P that a player can capture the Pokémon with no more than
r tries is:
P=1-(1-
p)^r
Note that this is the cumulative probability function for a geometric distribution. The expected value of
r is 1/
p, that is to say, on average, a Pokémon that can be caught with probability
p will be caught with 1/
p tries.
The inverse problem, the number of tries,
r, needed to have a probability
P of capturing a Pokémon is:
r=(log(1-
P))/(log(1-
p))