adds failsafe for when randomizer can't find a Pokemon

This commit is contained in:
infinitefusion
2022-05-09 20:40:58 -04:00
parent 96261fd424
commit d741823669
14 changed files with 16 additions and 0 deletions

View File

@@ -128,12 +128,18 @@ def getRandomPokemon(originalPokemon,bstRange,maxDexNumber)
bstMax = originalBst+bstRange
foundAPokemon = false
int i=0
while ! foundAPokemon
newPoke = rand(maxDexNumber-1)+1
newPokeBST = getBaseStatsTotal(newPoke)
if newPokeBST >= bstMin && newPokeBST <= bstMax
foundAPokemon = true
end
i+=1
if i %10 ==0
bstMin-=5
bstMax+=5
end
end
return newPoke
end