Advertisement
Guest User

Jirachi simulation

a guest
Jul 6th, 2021
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.88 KB | None | 0 0
  1. ### Pokemon: Nature, 32 hp, jir: 252 attack 4 spec def 0 hp###
  2. jirHead=(8.3+9.6)/2#damage due to iron head
  3. oppMove=(49.5+58.9)/2#damage due to opponents attack
  4. oppAcc=1#chance of the opponents move landing
  5. critON=1#you can turn off the possibility of crits
  6. secondary=0.1#the chance that the opponents secondary effect triggers (burn para ect)
  7. leftON=0#you can give the opponent leftovers
  8.  
  9. for i in range(1,10000):
  10.     jirHP=100
  11.     oppHP=100
  12.     jirIsPara=0
  13.     jirIsBurnt=0
  14.     turn=0
  15.     while jirHP>0 and oppHP>0:
  16.         #turn+=1 #if you want magnezone to use t wave first turn, turn this on and other code marked *****
  17.         turnSkip=0
  18.         if (jirIsPara!=1 or rd.random()>1/3):
  19.             oppHP-=jirHead+jirHead*(rd.random()<=1/16)*critON
  20.             if oppHP<=0: break
  21.             oppHP+=1/16*100*leftON
  22.             if rd.random()<jirflch:
  23.                 oppHP-=jirHead+jirHead*(rd.random()<=1/16)*critON
  24.                 if oppHP<=0: break
  25.                 oppHP+=1/16*100*leftON
  26.                 jirHP+=1/16*100
  27.                 jirHP-=jirIsBurnt*1/8*100
  28.                 if jirHP<=0: break
  29.                 turnSkip=1
  30.             if rd.random()<para and turnSkip!=1:
  31.                     oppHP-=jirHead+jirHead*(rd.random()<=1/16)*critON
  32.                     if oppHP<=0: break
  33.                     oppHP+=1/16*100*leftON
  34.                     jirHP+=1/16*100
  35.                     jirHP-=jirIsBurnt*1/8*100
  36.                     if jirHP<=0: break
  37.                     turnSkip=1
  38.         if turnSkip!=1: #and turn!=1: *****
  39.             jirHP-=oppMove*(rd.random()<=oppAcc)+oppMove*(rd.random()<=1/16)*critON
  40.             if jirHP<=0: break
  41.             jirHP+=1/16*100
  42.             jirHP-=jirIsBurnt*1/8*100
  43.             if jirHP<=0: break
  44.             if rd.random()<=secondary:
  45.                 jirIsPara=1#required to match the stutus conditon of the opponents attack
  46.                 jirIsBurnt=0
  47.         #if turn==1: *****
  48.         #   jirIsPara=1 *****
  49.         if jirHP>100:
  50.             jirHP=100
  51.         if oppHP>100:
  52.             oppHP=100
  53.     if  jirHP>0:
  54.         winJir+=1
  55.     if  oppHP>0:
  56.         winOpp+=1
  57.  
  58. print('If opponent is paralyzed, then...')
  59. print('jir wins', winJir, 'times, and opponent wins', winOpp, 'times.')
  60. print('win rate is', winJir/(winJir+winOpp)*100,'percent')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement