def sell_item(self, item): amount = 0 yes_no = question_with_options('Are you sure?', CHOICES_YES_NO) if yes_no == YES: if item.amount != 1 and item.amount > 0: amount = question_with_options( "How many?", ['all', f'You can choose between [1 - {item.amount}]']) self.gold += item.worth if item.amount == 0: del self.items[item] print(f'{amount}x of "{item.name}" sold for {item.worth}') else: print("No items sold.")
def list_skills(self): cls() print('List of Skills \n') for skill in self.skills: print(f' -> {skill} - {skill.description}') print() return question_with_options('Which one do you want to cast?', [skill.name for skill in self.skills])
def __init__(self): from game.config import PLAYABLE_CLASSES, PLAYABLE_RACES self.name = question('What is your Hero name?', True) self.race = question_with_options('\nWhat is the Race of your Hero?', PLAYABLE_RACES) self.classe = question_with_options('What is your Class?', PLAYABLE_CLASSES) self.hp = self.classe.hp self.mp = self.classe.mp self.strenght = self.classe.strenght self.intelligence = self.classe.intelligence self.agility = self.classe.agility self.inventory = Inventory([], 300) self.weapon = self.classe.starting_weapon self.skills = self.classe.skills self.level = self.get_level self.experience = 0
def remove(self, item): for item in self.items: print(f'{item.name} x {item.amount}') answer = question_with_options('Are you sure?', CHOICES_YES_NO) if answer == 'yes': del self.items[item.name]
def available_actions(self): """ Complicated """ dct = dict(self.base_options, **self.specific_options) return question_with_options('What will you do?', dct)
def run(self, game): intro(GAME_NAME, GAME_DESCRIPTION) game_menu() output = question_with_options('Type your answer below', GAME_OPTIONS, False, True) self.select_from_menu(output, game)
def air_travel(self, player): gp = GeoPositioning() answer = question_with_options("Where do you want to go?", gp.by_air, True) gp.make_travel(player.location, answer)