aeroblastt

recursioncina.py

Jul 9th, 2020
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.21 KB | None | 0 0
  1. import random
  2.  
  3. def suffix(num):
  4. return chr(97+num)
  5.  
  6. def hitchance():
  7. if showhit:
  8. return " (hit %.2f)" % random.random()
  9. else:
  10. return ""
  11.  
  12. def hitcalc(prefix, proc): # triggered only from main, can aether
  13. atk = "attack #%s: " % prefix
  14. extralist = []
  15. crit = False
  16.  
  17. for o in onhits:
  18. if random.random() < onhits[o] * proc:
  19. atk += o
  20. atk += ", "
  21.  
  22. for e in extrahits:
  23. if random.random() < extrahits[e]:
  24. atk += e
  25. atk += ", "
  26. extralist.append(e) #make list of all extra hit procs
  27.  
  28. if random.random() < critchance:
  29. atk += "crit, "
  30. crit = True
  31.  
  32. print (atk[0:-2] + hitchance())
  33.  
  34. subhit = 0
  35. for ex in extralist: #run one of the two functions depending on which proc
  36. if ex == "Aether":
  37. aethercalc(prefix + suffix(subhit), crit)
  38. else:
  39. subcalc(prefix + suffix(subhit), procs[ex], ex)
  40. subhit += 1
  41.  
  42. def aethercalc(prefix, crit): # triggered only from hitcalc, can only be hit 2 of aether
  43. atk = "attack #%s (Aether): " % prefix
  44. extralist = []
  45.  
  46. for o in onhits:
  47. if random.random() < onhits[o]:
  48. atk += o
  49. atk += ", "
  50.  
  51. for e in extrahits:
  52. if e == "Aether":
  53. continue
  54. if random.random() < extrahits[e]:
  55. atk += e
  56. atk += ", "
  57. extralist.append(e)
  58.  
  59. if crit:
  60. atk += "crit, "
  61.  
  62. print (atk[0:-2] + hitchance())
  63.  
  64. subhit = 0
  65. for ex in extralist:
  66. subcalc(prefix + suffix(subhit), procs[ex], ex)
  67. subhit += 1
  68.  
  69. def subcalc(prefix, proc, hit): # triggered from above two, cannot aether
  70. atk = "attack #%s (%s): " % (prefix, hit)
  71. extralist = []
  72.  
  73. for o in onhits:
  74. if random.random() < onhits[o] * proc:
  75. atk += o
  76. atk += ", "
  77.  
  78. for e in extrahits:
  79. if e == "Aether" or e == hit:
  80. continue
  81. if random.random() < extrahits[e]:
  82. atk += e
  83. atk += ", "
  84. extralist.append(e)
  85.  
  86. print (atk[0:-2] + hitchance())
  87.  
  88. subhit = 0
  89. for ex in extralist:
  90. subcalc(prefix + suffix(subhit), procs[ex], ex)
  91. subhit += 1
  92.  
  93. random.seed()
  94.  
  95. SPD = 115
  96. hitcount = 10
  97. showhit = False
  98. ult = False
  99. advanced = False
  100.  
  101. onhits = {"Snake Tail": .05, "Taser": .07, "Runald's Band": .08, "Kjaro's Band": .08, "Tri-Tip Dagger": .15}
  102. extrahits = {"Ukulele": .25}
  103. procs = {"Ukulele": .2}
  104. extrahits["Aether"] = SPD/500
  105. critchance = SPD/500
  106.  
  107. if ult:
  108. for o in onhits:
  109. onhits[o] *= 1.5
  110. for e in extrahits:
  111. onhits[o] *= 1.5
  112.  
  113. if not advanced: # all coeffs 1
  114. for i in range(hitcount):
  115. hitcalc(str(i + 1), 1.0)
  116. else:
  117. hits = [1.0] * hitcount # list of (hitcount) 1s representing base proc coeffs of each atk
  118. coeffs = {} # dict of any proc coeffs that are != 1, in form index: coeff
  119. current = 0
  120.  
  121. for coef in coeffs:
  122. hits[coef] = coeffs[coef]
  123.  
  124. for hit in hits:
  125. hitcalc(str(current), hit)
  126. current += 1
Advertisement
Add Comment
Please, Sign In to add comment