SHARE
TWEET

Chance of Survival given HP and Lethality Rating

magnificentophat Feb 26th, 2019 (edited) 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. l2 = [11]
  2. l3 = [12,21]
  3. l4 = [13, 22, 31]
  4. l5 = [14, 23, 32, 41]
  5. l6 = [15, 24, 33, 42, 51]
  6. l7 = [16, 25, 34, 43, 52, 61]
  7. l8 = [17, 26, 35, 44, 53, 62, 71]
  8. l9 = [18, 27, 36, 45, 54, 63, 72, 81]
  9. l10 = [19, 28, 37, 46, 55, 64, 73, 82, 91]
  10. l11 = [1, 10, 29, 38, 47, 56, 65, 74, 83, 92]
  11. l12 = [2, 20, 39, 48, 57, 66, 75, 84, 93]
  12. l13 = [3, 30, 49, 58, 67, 76, 85, 94]
  13. l14 = [4, 40, 59, 68, 77, 86, 95]
  14. l15 = [5, 50, 69, 78, 87, 96]
  15. l16 = [6, 60, 79, 88, 97]
  16. l17 = [7, 70, 89, 98]
  17. l18 = [8, 80, 99]
  18. l19 = [9, 90]
  19. l20 = [100]
  20.  
  21. listy = [l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, l15, l16, l17, l18, l19, l20]
  22.  
  23. lethal = []
  24.  
  25. for i in range(19):
  26.     new = [i+2,listy[i]]
  27.     lethal.append(new)
  28.  
  29. def inp():
  30.     while True:
  31.         n = input()
  32.         if n.isdigit():
  33.             return int(n)
  34.         else:
  35.             print("integers only, dummy")
  36.    
  37. def lethalizer():
  38.     go = True
  39.     while go:
  40.         print("HP?")
  41.         hp = inp()
  42.         half = 0
  43.         if hp%2 == 1:
  44.             half = hp/2
  45.         else:
  46.             half = hp/2-1
  47.         print("Armor?")
  48.         a = inp()
  49.         print("Lethality rating?")
  50.         lethality = inp()
  51.         if lethality > 99:
  52.             lethality = 99
  53.         print("Armor Piercing?")
  54.         ap = inp()
  55.         na = a - ap
  56.         if na < 0:
  57.             na = 0
  58.         dChance = 0
  59.         sChance = 0
  60.         uChance = 0
  61.         one = hp - 1
  62.         two = hp - 2
  63.         thingy = [0,0]
  64.         for d in lethal:
  65.             if ((d[0] - na) > half) & ((d[0] - na) < int(two)): #will the damage stun you?
  66.                 count = 0
  67.                 for i in d[1]:
  68.                     if i > lethality:
  69.                         count = count + 1
  70.                 sChance = sChance + count
  71.             if d[0] - na == one: #complicated stuff, but for incapactitation
  72.                 count = 0
  73.                 for i in d[1]:
  74.                     if i > lethality:
  75.                         count = count + 1
  76.                 thingy[0] = count
  77.             if d[0] -na == two:
  78.                 count = 0
  79.                 for i in d[1]:
  80.                     if i > lethality:
  81.                         count = count + 1
  82.                 thingy[1] = count
  83.             if d[0] == na:
  84.                 for i in d[1]:
  85.                     if i > lethality:
  86.                         uChance = uChance + 1
  87.             if d[0] -na > (hp - 1): #d for damage (does it kill you?)
  88.                 for r in d[1]: #r for the Lethality roll (what lethality roll are we looking at?)
  89.                     if r > lethality: #we don't want to doublecount any lethality ratings
  90.                         dChance = dChance + 1
  91.         dChance = dChance + lethality
  92.         iChance = (thingy[0] + thingy [1])
  93.         nChance = 100 - dChance - iChance - sChance
  94.         print("You have a")
  95.         print(str(dChance)+"% chance to instantly die,")
  96.         print(str(sChance)+"% chance to be stunned,")
  97.         print(str(iChance)+"% chance to be incapacitated,")
  98.         print(str(nChance)+"% chance to live to fight another round, and a")
  99.         print(str(uChance)+"% chance to survive completely unharmed...somehow")
  100.         print("press 'q' to quit, press any other key to continue")
  101.         q = input()
  102.         if q == "q":
  103.             go = False  
  104.  
  105. lethalizer()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top