2 """Faithful translations of calculations the games make."""
4 def calculated_stat(base_stat
, level
, iv
, effort
):
5 """Returns the calculated stat -- i.e. the value actually shown in the game
6 on a Pokémon's status tab.
9 # Remember: this is from C; use floor division!
10 return (base_stat
* 2 + iv
+ effort
// 4) * level
// 100 + 5
12 def calculated_hp(base_hp
, level
, iv
, effort
):
13 """Similar to `calculated_stat`, except with a slightly different formula
14 used specifically for HP.
17 # Shedinja's base stat of 1 is special; its HP is always 1
21 return (base_hp
* 2 + iv
+ effort
// 4) * level
// 100 + 10 + level
23 def earned_exp(base_exp
, level
):
24 """Returns the amount of EXP earned when defeating a Pokémon at the given
28 return base_exp
* level
// 7