mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
adds failsafe for when randomizer can't find a Pokemon
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user