Last active
January 25, 2017 18:29
-
-
Save Ads20000/164949589fd88f5f43e2358870b24ce0 to your computer and use it in GitHub Desktop.
From the Pokemon Showdown repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mbstmin = 1307; | |
// Type the base stats of the Pokemon in manually here: | |
hp = 79; | |
atk = 105; | |
def = 70; | |
spa = 145; | |
spd = 80; | |
spe = 101; | |
// This code works out the level (I think!) | |
mbst = (hp * 2 + 31 + 21 + 100) + 10; | |
mbst += (atk * 2 + 31 + 21 + 100) + 5; | |
mbst += (def * 2 + 31 + 21 + 100) + 5; | |
mbst += (spa * 2 + 31 + 21 + 100) + 5; | |
mbst += (spd * 2 + 31 + 21 + 100) + 5; | |
mbst += (spe * 2 + 31 + 21 + 100) + 5; | |
level = Math.floor(100 * mbstmin / mbst); | |
while (level < 100) { | |
mbst = Math.floor((hp * 2 + 31 + 21 + 100) * level / 100 + 10); | |
mbst += Math.floor(((atk * 2 + 31 + 21 + 100) * level / 100 + 5) * level / 100); | |
mbst += Math.floor((def * 2 + 31 + 21 + 100) * level / 100 + 5); | |
mbst += Math.floor(((spa * 2 + 31 + 21 + 100) * level / 100 + 5) * level / 100); | |
mbst += Math.floor((spd * 2 + 31 + 21 + 100) * level / 100 + 5); | |
mbst += Math.floor((spe * 2 + 31 + 21 + 100) * level / 100 + 5); | |
if (mbst >= mbstmin) break; | |
level++; | |
} | |
window.alert(level); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment