54 lines
1.1 KiB
Python
Executable File
54 lines
1.1 KiB
Python
Executable File
#!/usr/bin/python
|
|
import argparse
|
|
|
|
chain = 0
|
|
|
|
def setChain(c):
|
|
global chain
|
|
chain = (c%256)
|
|
|
|
def generateShiny():
|
|
if chain<70:
|
|
return (4096,chain!=0)
|
|
else:
|
|
return (1024,False)
|
|
|
|
def generateIVs():
|
|
if chain<=4:
|
|
return 0
|
|
elif chain<=9:
|
|
return 1
|
|
elif chain<=19:
|
|
return 2
|
|
elif chain<=29:
|
|
return 3
|
|
else:
|
|
return 4
|
|
|
|
def generateHA():
|
|
if chain<10:
|
|
return 0
|
|
elif chain<20:
|
|
return 5
|
|
elif chain<30:
|
|
return 10
|
|
else:
|
|
return 15
|
|
|
|
if __name__=="__main__":
|
|
parser = argparse.ArgumentParser(description="Calculates shiny chance and IVs for SOS battles in generation 7.")
|
|
parser.add_argument("chain",type=int,help="Chain value. Due to overflow bug, will not be calculated hgher than 255 (handled automatically)")
|
|
args = parser.parse_args()
|
|
|
|
setChain(args.chain)
|
|
|
|
shiny = generateShiny()
|
|
iv = generateIVs()
|
|
ha = generateHA()
|
|
|
|
print "Shiny chance: 1/"+str(shiny[0])+("*" if shiny[1] else "")
|
|
print str(iv)+" guaranteed perfect IV(s)"
|
|
print "Hidden Ability chance: "+str(ha)+"%"
|
|
if shiny[1]:
|
|
print "* Shiny chances for chain values below 70 are not known."
|