NerdimusPrime

Motonic v1.2 - Essence Calculator for Exalted 2.5 RPG

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