def enter(self): """ Enter the arena and start combat.""" result = combat.begin_combat(self.characters, None, False) if result == 'death': print "u ded" elif result == 'win': print "u a winrar"
def enter(self): """ Execute actions upon entering a scene. """ player = self.characters['player'] # 1. Print scene description and items self.cmd_look() # 2. Print encounter message self.print_encounter_msg() # if the boss attacks, go into combat if self.get_boss_attack(): print "The boar notices you and charges!" return combat.begin_combat(self.characters, self, True) # 3. Enter user-input loop while True: action = raw_input("> ") # reset surprised condition since we can take an action player.conditions['surprised'] = False # exit scene if action in self.exits.keys() and self.flags['can_leave']: self.scene_map.clock_tick() if self.scene_map.timeup: # time's up you lose return "timeup" return self.exits.get(action) # enter combat elif combat.ATTACK in action and self.flags['encounter']: return combat.begin_combat(self.characters, self, True) # map commands else: if self.process_action(action): # valid action if self.scene_map.timeup: # time's up you lose return "timeup" self.print_encounter_msg() # if the boss attacks, go into combat if self.get_boss_attack(): print "The boar notices you and charges!" return combat.begin_combat(self.characters, self, True) else: # if invalid action, prompt for input again pass