def choose_action(self, previous_room): if (self.hunter.stats['alive'] == True and player.stats['alive'] == True): choice_ls = ['Give him the treasure', 'Fight!', 'Run away!'] menu = fn.Menu() choice = menu.generate(choice_ls, 'What do you do?') if choice == '1': player.stats['has_diamond'] = False player.stats['has_gold'] = False self.hostile = False print text.hunter_room['give_gold'] return self.exit() elif choice == '2': combat = fn.Combat(player, self.hunter, self.choose_action, previous_room) return combat.rounds() elif choice == '3': return previous_room else: return self.choose_action(previous_room) elif player.stats['alive'] == False: print text.hunter_room['death_by_hunter'] return (-1, -1) else: print "The treasure hunter is dead!" print "" return self.exit()
def choose_action(self, previous_room): if (self.spider.stats['alive'] == True and player.stats['alive'] == True): choice_ls = ['Fight!', 'Run away!'] menu = fn.Menu() choice = menu.generate(choice_ls, 'What do you do?') if choice == '1': combat = fn.Combat(player, self.spider, self.choose_action, previous_room) return combat.rounds() elif choice == '2': return previous_room else: return self.choose_action(previous_room) elif player.stats['alive'] == False: print text.spider_room['death_by_spider'] return (-1, -1) else: print text.spider_room['killing_spider'] return self.exit()
def choose_action(self, previous_room): if (self.dragon.stats['alive'] == True and player.stats['alive'] == True): choice_ls = ['Fight!', 'LEG IT!!!'] menu = fn.Menu() choice = menu.generate(choice_ls, 'What do you do?') if choice == '1': combat = fn.Combat(player, self.dragon, self.choose_action, previous_room) return combat.rounds() elif choice == '2': return previous_room else: return self.choose_action(previous_room) elif player.stats['alive'] == False: print text.dragon_room['death_by_dragon'] return (-1, -1) else: print "You?! Killed a DRAGON?!?" print "" return self.exit()
def choose_action(self, previous_room): if (self.harpy.stats['alive'] == True and player.stats['alive'] == True): choice_ls = ['Fight!', 'Run away!'] menu = fn.Menu() choice = menu.generate(choice_ls, 'What do you do?') if choice == '1': combat = fn.Combat(player, self.harpy, self.choose_action, previous_room) return combat.rounds() elif choice == '2': return previous_room else: return self.choose_action(previous_room) elif player.stats['alive'] == False: print text.harpy_room['death_by_harpy'] return (-1, -1) else: print "The harpy dies in an explosion of feathers!" print "" return self.exit()