def handle_input(self, input): # If the user has not selected a class, check their choice if not self.character_class: # Check the choice is a valid character class if not input.lower() in AVAILABLE_CLASSES: print 'Sorry, that is not a valid character class.' return # Set the character class and display stats/abilities character_class = AVAILABLE_CLASSES.get(input.lower()) self.character_class = character_class self.display_details(self.character_class) # Ask user for confirmation class_name = self.character_class.get('name') print 'Are you sure you want to be a %s?' % class_name else: # If the character class has been set, check user confirmation confirmation = (input.lower() == 'yes') # If the user has confirmed the class, move to next state if confirmation: # TODO: transition to next state pass else: # User did not confirm, reset class and ask them again self.character_class = None self.display_choices()
def display_choices(): print 'Select a character class:' # Display a list of all the available classes (with stats) for name, data in AVAILABLE_CLASSES.items(): print '[%s]: %d HP | %d AC | %d STR | %d AGI | %d LUK' % ( data.get('name').upper(), data.get('health'), data.get('armor'), data.get('strength'), data.get('agility'), data.get('luck') )