Guest User

Untitled

a guest
Oct 20th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Character:
  2.     genders = ['M', 'F']
  3.     prompt = 'Please enter your character\'s gender ({}) '.format(genders)
  4.  
  5.     def __init__(self):
  6.         self.stat = 30
  7.         self.name = input("Please enter your character's name ")
  8.         self.gender = input(self.prompt)
  9.         while not self.gender in self.genders:
  10.             self.gender = input(self.prompt)
  11.  
  12.     def statAllocation(self):
  13.         """"
  14.         Allocates the character's stats
  15.         """
  16.         print("You will now be given 30 bonus stat points. Please allocate them to the 5 main stats (Strength, Intelligence, Agility" \
  17.         "Endurance and Luck. Please note that you can only allocate a max of 10 bonus stat points to a given stat.")
  18.  
  19.         while self.stat == 30:
  20.             strength = int(input("Now, enter your desired stat value for Strength "))
  21.             while strength > 10 or strength < 1:
  22.                 strength = int(input("Now, enter your desired stat value for Strength "))
  23.             self.stat-= strength
  24.             intelligence = int(input("Now, enter your desired stat value for Intelligence "))
  25.             while intelligence > 10 or intelligence < 1:
  26.                 intelligence = int(input("Now, enter your desired stat value for Intelligence "))
  27.             self.stat-= intelligence
  28.             agility = int(input("Now, enter your desired stat value for Agility "))
  29.             while agility > 10 or agility < 1:
  30.                 agility = int(input("Now, enter your desired stat value for Agility "))
  31.             self.stat-= agility
  32.             endurance = int(input("Now, enter your desired stat value for Endurance "))
  33.             while endurance > 10 or endurance < 1:
  34.                 endurance = int(input("Now, enter your desired stat value for Intelligence "))
  35.             self.stat-= endurance
  36.             luck = int(input("Now, enter your desired stat value for Luck "))
  37.             while luck > 10 or luck < 1:
  38.                 luck = int(input("Now, enter your desired stat value for Luck "))
  39.             self.stat-= luck
  40.  
  41.             if self.stat < 0:
  42.                 self.stat = 30
  43.                 print("you ended going over the stat limit. Try again")
  44.             else:
  45.                 print("Stats successfully allocated, here are their stats:")
  46.                 print("Strength: " + str(strength) + " Intelligence: " +str(intelligence) + " Agility: "+ str(agility) + " Endurance "+ str(endurance) + " Luck: " + str(luck))
  47.  
  48.  
  49. cc = Character()
  50. cc.statAllocation()
Advertisement
Add Comment
Please, Sign In to add comment