Advertisement
NerdimusPrime

Motonic 1.3

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