Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3.6
- """Essence Calculator for Exalted 2.5 role-playing game.
- Calculates and prints mote pools for various Exalt types after entering relevant stats."""
- # 09/01/2013 v1.0 Created as a use case for learning Python.
- # 12/08/2017 v1.1 Updated to Python 3.6. Corrected potential crash conditions, added more comments.
- # 02/06/2018 v1.2 Added function to print pool results instead of doing it within calc functions.
- # 02/12/2018 v1.3 Changed formatting to conform to current standards, using pylint/pycodestyle.
- # Abbreviations:
- # essence = permanent Essence rating
- # will = permanent Willpower rating
- # comp = Compassion rating
- # conv = Conviction rating
- # temp = Temperance rating
- # valor = Valor rating
- # essence_peri = Peripheral Essence pool
- # essence_pers = Personal Essence pool
- # Essence calculation functions by Exalt type.
- def calc_essence_solar(essence, will, comp, conv, temp, valor):
- """Calculates and prints mote pools for Solar/Abyssal/Infernal Exalted."""
- essence_pers = (essence * 3) + will
- essence_peri = (essence * 7) + will + comp + conv + temp + valor
- print_pools(essence_pers, essence_peri)
- def calc_essence_lunar(essence, will, comp, conv, temp, valor):
- """Calculates and prints mote pools for Lunar Exalted."""
- virtues = [comp, conv, temp, valor]
- essence_pers = essence + (will * 2)
- essence_peri = (essence * 4) + (will * 2) + (max(virtues) * 4)
- print_pools(essence_pers, essence_peri)
- def calc_essence_sidereal(essence, will, comp, conv, temp, valor):
- """Calculates and prints mote pools for Sidereal Exalted."""
- essence_pers = (essence * 2) + will
- essence_peri = (essence * 6) + will + comp + conv + temp + valor
- print_pools(essence_pers, essence_peri)
- def calc_essence_terrestrial(essence, will, comp, conv, temp, valor):
- """Calculates and prints mote pools for Terrestrial Exalted.
- Create a list called virtues, populated with the values of the virtue ratings."""
- virtues = [comp, conv, temp, valor]
- # Assign the largest virtue rating to 'largest'.
- largest = max(virtues)
- # Remove the largest virtue rating from the list in order to get the second-largest.
- virtues.remove(max(virtues))
- # After removing the largest virtue rating from the list, assign the new largest rating to
- # 'second_largest'.
- second_largest = max(virtues)
- essence_pers = essence + will
- essence_peri = (essence * 4) + will + (largest + second_largest)
- print_pools(essence_pers, essence_peri)
- def calc_essence_alchemical(essence, will, comp, conv, temp, valor):
- """Calculates and prints mote pools for Terrestrial Exalted."""
- virtues = [comp, conv, temp, valor]
- essence_pers = (essence * 3) + will
- essence_peri = (essence * 5) + (will * 3) + (max(virtues) * 2)
- print_pools(essence_pers, essence_peri)
- def print_pools(essence_pers, essence_peri):
- """Prints pool amounts from values passed by calc_essence_ functions."""
- print()
- print("-" * 20)
- print("Personal Essence Pool: {} motes".format(essence_pers))
- print("Peripheral Essence Pool: {} motes".format(essence_peri))
- print("-" * 20)
- print()
- # User selects Exalt type
- while True:
- print()
- print("-" * 20)
- print("1. Solar/Abyssal/Infernal")
- print("2. Lunar")
- print("3. Sidereal")
- print("4. Terrestrial")
- print("5. Alchemical")
- print("-" * 20)
- print()
- EXALT_TYPE = input("Select Exalt Type: ")
- # User input is converted to an integer if possible.
- try:
- EXALT_TYPE = int(EXALT_TYPE)
- except ValueError:
- print()
- print("-" * 20)
- print("Please enter a number between 1 and 5.")
- print("-" * 20)
- print()
- continue
- # If the selection is an integer, check to see if it's in the range of 1-5.
- if EXALT_TYPE > 0 and EXALT_TYPE <= 5:
- print()
- break
- else:
- print()
- print("-" * 20)
- print("Please enter a number between 1 and 5.")
- print("-" * 20)
- print()
- # User enters Virtue, Essence, and Willpower scores. Scores are converted to integers, if possible,
- # then checked to see if they're in the correct range.
- # Virtue scores
- # Compassion
- while True:
- VIRTUE_COMP = input("Enter Compassion Rating (1-5): ")
- try:
- VIRTUE_COMP = int(VIRTUE_COMP)
- except ValueError:
- print("Invalid choice. Please choose a number between 1 and 5.\n")
- continue
- if VIRTUE_COMP in range(1, 6):
- break
- else:
- print("Invalid choice. Please choose a number between 1 and 5.\n")
- # Conviction
- while True:
- VIRTUE_CONV = input("Enter Conviction Rating (1-5): ")
- try:
- VIRTUE_CONV = int(VIRTUE_CONV)
- except ValueError:
- print("Invalid choice. Please choose a number between 1 and 5.\n")
- continue
- if VIRTUE_CONV in range(1, 6):
- break
- else:
- print("Invalid choice. Please choose a number between 1 and 5.\n")
- # Temperance
- while True:
- VIRTUE_TEMP = input("Enter Temperance Rating (1-5): ")
- try:
- VIRTUE_TEMP = int(VIRTUE_TEMP)
- except ValueError:
- print("Invalid choice. Please choose a number between 1 and 5.\n")
- continue
- if VIRTUE_TEMP in range(1, 6):
- break
- else:
- print("Invalid choice. Please choose a number between 1 and 5.\n")
- # Valor
- while True:
- VIRTUE_VALOR = input("Enter Valor Rating (1-5): ")
- try:
- VIRTUE_VALOR = int(VIRTUE_VALOR)
- except ValueError:
- print("Invalid choice. Please choose a number between 1 and 5.\n")
- continue
- if VIRTUE_VALOR in range(1, 6):
- break
- else:
- print("Invalid choice. Please choose a number between 1 and 5.\n")
- # Essence score
- while True:
- ESSENCE = input("Enter Essence Rating (2-10): ")
- try:
- ESSENCE = int(ESSENCE)
- except ValueError:
- print("Invalid choice. Please choose a number between 2 and 10.\n")
- continue
- if ESSENCE in range(2, 11):
- break
- else:
- print("Invalid choice. Please choose a number between 2 and 10.\n")
- # Willpower score
- while True:
- WILLPOWER = input("Enter Willpower Rating (1-10): ")
- try:
- WILLPOWER = int(WILLPOWER)
- except ValueError:
- print("Invalid choice. Please choose a number between 1 and 10.\n")
- continue
- if WILLPOWER in range(1, 11):
- break
- else:
- print("Invalid choice. Please choose a number between 1 and 10.\n")
- # Essence calculation functions are called based on Exalt type, using scores provided by user,
- # and mote pool totals are displayed.
- if EXALT_TYPE == 1:
- calc_essence_solar(ESSENCE, WILLPOWER, VIRTUE_COMP, VIRTUE_CONV, VIRTUE_TEMP, VIRTUE_VALOR)
- elif EXALT_TYPE == 2:
- calc_essence_lunar(ESSENCE, WILLPOWER, VIRTUE_COMP, VIRTUE_CONV, VIRTUE_TEMP, VIRTUE_VALOR)
- elif EXALT_TYPE == 3:
- calc_essence_sidereal(ESSENCE, WILLPOWER, VIRTUE_COMP, VIRTUE_CONV, VIRTUE_TEMP, VIRTUE_VALOR)
- elif EXALT_TYPE == 4:
- calc_essence_terrestrial(ESSENCE, WILLPOWER, VIRTUE_COMP, VIRTUE_CONV, VIRTUE_TEMP, VIRTUE_VALOR)
- elif EXALT_TYPE == 5:
- calc_essence_alchemical(ESSENCE, WILLPOWER, VIRTUE_COMP, VIRTUE_CONV, VIRTUE_TEMP, VIRTUE_VALOR)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement