Advertisement
PikalaxALT

Gen 3-6 IV/EV Calculator

Mar 1st, 2016
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.17 KB | None | 0 0
  1. from numpy import *
  2. possible_IVs = arange(32)
  3. possible_EVs = arange(64)
  4. combo_matrix = add.outer(possible_IVs, possible_EVs)
  5. stat_names = ["HP", "Attack", "Defense", "SpAtk", "SpDef", "Speed"]
  6.  
  7. def CalcIVsFromStats(stats, base_stats, level, nature):
  8.     # HP, Atk, Def, Spa, Spd, Spe
  9.     # Nature: tuple (up_idx, dn_idx)
  10.     for stat_idx, stat_value in enumerate(stats):
  11.         cur_stat = (base_stats[stat_idx] * 2 + combo_matrix) * level / 100
  12.         if not stat_idx:
  13.             cur_stat += level + 10
  14.         else:
  15.             cur_stat += 5
  16.             if stat_idx == nature[0]:
  17.                 cur_stat *= 11
  18.                 cur_stat /= 10
  19.             elif stat_idx == nature[1]:
  20.                 cur_stat *= 9
  21.                 cur_stat /= 10
  22.         putative_IVs, putative_EVs = where(cur_stat == stat_value)
  23.         print "Possible IV/EV combos for %s" % stat_names[stat_idx]
  24.         for EV_idx, IV_val in enumerate(putative_IVs):
  25.             cur_EV = 4 * putative_EVs[EV_idx]
  26.             print "IV: {:>2d}, EV: {:>3d} - {:>3d}".format(
  27.                     IV_val, cur_EV, cur_EV + 3
  28.                     )
  29.         print "-------------------------------------------"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement