Advertisement
NerdimusPrime

Motonic v1.1 - Essence Calculator for Exalted 2.5 RPG

Jan 4th, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 6.71 KB | None | 0 0
  1. # Essence Calculator for Exalted 2.5 role-playing game.
  2. # Calculates and prints mote pools for various Exalt types after entering relevant stats.
  3. # 09/01/2013 Created as a use case for learning Python.
  4. # 12/08/2017 Updated to Python 3.6. Corrected potential crash conditions and added more comments.
  5.  
  6. # Abbreviations:
  7. # essence = permanent Essence rating
  8. # will = permanent Willpower rating
  9. # comp = Compassion rating
  10. # conv = Conviction rating
  11. # temp = Temperance rating
  12. # valor = Valor rating
  13. # essencePeri = Peripheral Essence pool
  14. # essencePers = Personal Essence pool
  15.  
  16. # Essence calculation functions by Exalt type.
  17. def calcEssenceSolar(essence, will, comp, conv, temp, valor):
  18.     # Calculates and prints mote pools for Solar/Abyssal/Infernal Exalted.
  19.     essencePers = (essence * 3) + will
  20.     essencePeri = (essence * 7) + will + comp + conv + temp + valor
  21.     print("\nPersonal Essence Pool: {} motes".format(essencePers))
  22.     print("Peripheral Essence Pool: {} motes".format(essencePeri))
  23.  
  24. def calcEssenceLunar(essence, will, comp, conv, temp, valor):
  25.     # Calculates and prints mote pools for Lunar Exalted.
  26.     virtues = [comp, conv, temp, valor]
  27.     essencePers = essence + (will * 2)
  28.     essencePeri = (essence * 4) + (will * 2) + (max(virtues) * 4)
  29.     print("\nPersonal Essence Pool: {} motes".format(essencePers))
  30.     print("Peripheral Essence Pool: {} motes".format(essencePeri))
  31.  
  32. def calcEssenceSidereal(essence, will, comp, conv, temp, valor):
  33.     # Calculates and prints mote pools for Sidereal Exalted.
  34.     essencePers = (essence * 2) + will
  35.     essencePeri = (essence * 6) + will + comp + conv + temp + valor
  36.     print("\nPersonal Essence Pool: {} motes".format(essencePers))
  37.     print("Peripheral Essence Pool: {} motes".format(essencePeri))
  38.  
  39. def calcEssenceTerrestrial(essence, will, comp, conv, temp, valor):
  40.     #Calculates and prints mote pools for Terrestrial Exalted.
  41.     #Create an array called virtues, populated with the values of the virtue ratings.
  42.     virtues = [comp, conv, temp, valor]
  43.     #Assign the largest virtue rating to 'largest'.
  44.     largest = max(virtues)
  45.     #Remove the largest virtue rating from the array in order to get the second-largest.
  46.     virtues.remove(max(virtues))
  47.     #After removing the largest virtue rating from the array, assign the new largest rating to 'second_largest'.
  48.     second_largest = max(virtues)
  49.     essencePers = essence + will
  50.     essencePeri = (essence * 4) + will + (largest + second_largest)
  51.     print("\nPersonal Essence Pool: {} motes".format(essencePers))
  52.     print("Peripheral Essence Pool: {} motes".format(essencePeri))
  53.  
  54. def calcEssenceAlchemical(essence, will, comp, conv, temp, valor):
  55.     #Calculates and prints mote pools for Terrestrial Exalted.
  56.     virtues = [comp, conv, temp, valor]
  57.     essencePers = (essence * 3) + will
  58.     essencePeri = (essence * 5) + (will * 3) + (max(virtues) * 2)
  59.     print("\nPersonal Essence Pool: {} motes".format(essencePers))
  60.     print("Peripheral Essence Pool: {} motes".format(essencePeri))
  61.  
  62. # User selects Exalt type
  63. while True:
  64.     print("\n1. Solar/Abyssal/Infernal")
  65.     print("2. Lunar")
  66.     print("3. Sidereal")
  67.     print("4. Terrestrial")
  68.     print("5. Alchemical\n")
  69.     exaltType = input("Select Exalt Type: ")
  70. # User input is converted to an integer if possible.
  71.     try:
  72.         exaltType = int(exaltType)
  73.     except:
  74.         print("\nInvalid choice. Try again.\n")
  75.         continue
  76. # If the selection is an integer, check to see if it's in the range of 1-5.
  77.     if exaltType > 0 and exaltType <= 5:
  78.         print()
  79.         break
  80.     else:
  81.         print("\nInvalid choice. Try again.\n")
  82.  
  83. # User enters Virtue, Essence, and Willpower scores. Scores are converted to integers, if possible,
  84. # then checked to see if they're in the correct range.
  85.  
  86. # Virtue scores
  87. #   Compassion
  88. while True:
  89.     virtueComp = input("Enter Compassion Rating (1-5): ")
  90.     try:
  91.         virtueComp = int(virtueComp)
  92.     except:
  93.         print("Invalid choice. Please choose a number between 1 and 5.\n")
  94.         continue
  95.     if virtueComp in range(1, 6):
  96.         break
  97.     else:
  98.         print("Invalid choice. Please choose a rating between 1 and 5.\n")
  99.  
  100. #   Conviction
  101. while True:
  102.     virtueConv = input("Enter Conviction Rating (1-5): ")
  103.     try:
  104.         virtueConv = int(virtueConv)
  105.     except:
  106.         print("Invalid choice. Please choose a number between 1 and 5.\n")
  107.         continue
  108.     if virtueConv in range(1, 6):
  109.         break
  110.     else:
  111.         print("Invalid choice. Please choose a rating between 1 and 5.\n")
  112.  
  113. #   Temperance
  114. while True:
  115.     virtueTemp = input("Enter Temperance Rating (1-5): ")
  116.     try:
  117.         virtueTemp = int(virtueTemp)
  118.     except:
  119.         print("Invalid choice. Please choose a number between 1 and 5.\n")
  120.         continue
  121.     if virtueTemp in range(1, 6):
  122.         break
  123.     else:
  124.         print("Invalid choice. Please choose a rating between 1 and 5.\n")
  125.  
  126. #   Valor
  127. while True:
  128.     virtueValor = input("Enter Valor Rating      (1-5): ")
  129.     try:
  130.         virtueValor = int(virtueValor)
  131.     except:
  132.         print("Invalid choice. Please choose a number between 1 and 5.\n")
  133.         continue
  134.     if virtueValor in range(1, 6):
  135.         break
  136.     else:
  137.         print("Invalid choice. Please choose a rating between 1 and 5.\n")
  138.  
  139. # Essence score
  140. while True:
  141.     essence = input("Enter Essence Rating   (2-10): ")
  142.     try:
  143.         essence = int(essence)
  144.     except:
  145.         print("Invalid choice. Please choose a number between 2 and 10.\n")
  146.         continue
  147.     if essence in range(2, 11):
  148.         break
  149.     else:
  150.         print("Invalid choice. Please choose a rating between 2 and 10.\n")
  151.  
  152. # Willpower score
  153. while True:
  154.     willpower = input("Enter Willpower Rating (1-10): ")
  155.     try:
  156.         willpower = int(willpower)
  157.     except:
  158.         print("Invalid choice. Please choose a number between 1 and 10.\n")
  159.         continue
  160.     if willpower in range(1, 11):
  161.         break
  162.     else:
  163.         print("Invalid choice. Please choose a rating between 1 and 10.\n")
  164.  
  165. # Essence calculation functions are called based on Exalt type, using scores provided by user,
  166. # and mote pool totals are displayed.
  167. if exaltType == 1:
  168.     calcEssenceSolar(essence, willpower, virtueComp, virtueConv, virtueTemp, virtueValor)
  169. elif exaltType == 2:
  170.     calcEssenceLunar(essence, willpower, virtueComp, virtueConv, virtueTemp, virtueValor)
  171. elif exaltType == 3:
  172.     calcEssenceSidereal(essence, willpower, virtueComp, virtueConv, virtueTemp, virtueValor)
  173. elif exaltType == 4:
  174.     calcEssenceTerrestrial(essence, willpower, virtueComp, virtueConv, virtueTemp, virtueValor)
  175. elif exaltType == 5:
  176.     calcEssenceAlchemical(essence, willpower, virtueComp, virtueConv, virtueTemp, virtueValor)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement