Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Character:
- genders = ['M', 'F']
- prompt = 'Please enter your character\'s gender ({}) '.format(genders)
- def __init__(self):
- self.stat = 30
- self.name = input("Please enter your character's name ")
- self.gender = input(self.prompt)
- while not self.gender in self.genders:
- self.gender = input(self.prompt)
- def statAllocation(self):
- """"
- Allocates the character's stats
- """
- print("You will now be given 30 bonus stat points. Please allocate them to the 5 main stats (Strength, Intelligence, Agility" \
- "Endurance and Luck. Please note that you can only allocate a max of 10 bonus stat points to a given stat.")
- while self.stat == 30:
- strength = int(input("Now, enter your desired stat value for Strength "))
- while strength > 10 or strength < 1:
- strength = int(input("Now, enter your desired stat value for Strength "))
- self.stat-= strength
- intelligence = int(input("Now, enter your desired stat value for Intelligence "))
- while intelligence > 10 or intelligence < 1:
- intelligence = int(input("Now, enter your desired stat value for Intelligence "))
- self.stat-= intelligence
- agility = int(input("Now, enter your desired stat value for Agility "))
- while agility > 10 or agility < 1:
- agility = int(input("Now, enter your desired stat value for Agility "))
- self.stat-= agility
- endurance = int(input("Now, enter your desired stat value for Endurance "))
- while endurance > 10 or endurance < 1:
- endurance = int(input("Now, enter your desired stat value for Intelligence "))
- self.stat-= endurance
- luck = int(input("Now, enter your desired stat value for Luck "))
- while luck > 10 or luck < 1:
- luck = int(input("Now, enter your desired stat value for Luck "))
- self.stat-= luck
- if self.stat < 0:
- self.stat = 30
- print("you ended going over the stat limit. Try again")
- else:
- print("Stats successfully allocated, here are their stats:")
- print("Strength: " + str(strength) + " Intelligence: " +str(intelligence) + " Agility: "+ str(agility) + " Endurance "+ str(endurance) + " Luck: " + str(luck))
- cc = Character()
- cc.statAllocation()
Advertisement
Add Comment
Please, Sign In to add comment