def get_action(self, battle): print("Choose an action: " + str(self.get_id())) print("Opponent") if (battle.active1 == self.active): battle.active2.print_min_decision_vars() else: battle.active1.print_min_decision_vars() print("Active Pokemon") self.active.print_min_decision_vars() print("Team") for pokemon in self.team.pokemon: if (pokemon.fainted == False and pokemon.is_active == False): pokemon.print_min_decision_vars() while True: possible_choices = [] for pokemon in self.team.pokemon: if (pokemon.fainted == False and pokemon.is_active == False): possible_choices.append( Action(SWITCH, self.active, pokemon)) for move in self.active.moves: if (move.pp > 0): possible_choices.append(Action(ATTACK, self.active, move)) possible_choices.append(Action(ATTACK, self.active, move)) possible_choices.append(Action(ATTACK, self.active, move)) return fakerandom.fakechoice(possible_choices)
def get_fainted_switch(self, battle, sim=False): print( str(self.get_id()) + ": Your active Pokemon fainted, choose a Pokemon to switch in") print("\n\nOpponent") if (battle.active1 == self.active): battle.active2.print_opponent_decision_vars() else: battle.active1.print_opponent_decision_vars() print("\n\nTeam") for pokemon in self.team.pokemon: if (pokemon.fainted == False): pokemon.print_team_decision_vars() print("\n") if sim: possible_choices = [] for pokemon in self.team.pokemon: if (pokemon.fainted == False): possible_choices.append(pokemon) return fakerandom.fakechoice(possible_choices) while True: choice = raw_input("Type Pokemon name to switch to that Pokemon: ") for pokemon in self.team.pokemon: if (pokemon.fainted == False and pokemon.template.species == choice): return pokemon
def get_action(self, battle): print ("Choose an action: " + str(self.get_id())) print ("Opponent") opponent_decision_vars = None if (battle.active1 == self.active): opponent_decision_vars = battle.active2.get_decision_vars() opponent_decision_vars.print_min_decision_vars() else: opponent_decision_vars = battle.active1.get_decision_vars() opponent_decision_vars.print_min_decision_vars() print ("Active Pokemon") active_decision_vars = self.active.get_decision_vars() active_decision_vars.print_min_decision_vars() print ("Team") for pokemon in self.team.pokemon: if (pokemon.fainted == False and pokemon.is_active == False): decision_vars = pokemon.get_decision_vars() decision_vars.print_min_decision_vars() while True: possible_choices = [] for pokemon in self.team.pokemon: if (pokemon.fainted == False and pokemon.is_active == False): possible_choices.append(Action(SWITCH, self.active, pokemon)) for move in self.active.moves: if (move.pp > 0): possible_choices.append(Action(ATTACK, self.active, move)) possible_choices.append(Action(ATTACK, self.active, move)) possible_choices.append(Action(ATTACK, self.active, move)) return fakerandom.fakechoice(possible_choices)
def get_fainted_switch(self, battle): print( str(self.get_id()) + ": Your active Pokemon fainted, choose a Pokemon to switch in") print("Opponent") if (battle.active1 == self.active): battle.active2.print_min_decision_vars() else: battle.active1.print_min_decision_vars() print("Team") for pokemon in self.team.pokemon: if (pokemon.fainted == False): pokemon.print_min_decision_vars() while True: possible_choices = [] for pokemon in self.team.pokemon: if (pokemon.fainted == False): possible_choices.append(pokemon) return fakerandom.fakechoice(possible_choices)
def get_fainted_switch(self, battle): print (str(self.get_id()) + ": Your active Pokemon fainted, choose a Pokemon to switch in") print ("Opponent") opponent_decision_vars = None if (battle.active1 == self.active): opponent_decision_vars = battle.active2.get_decision_vars() opponent_decision_vars.print_min_decision_vars() else: opponent_decision_vars = battle.active1.get_decision_vars() opponent_decision_vars.print_min_decision_vars() print ("Team") for pokemon in self.team.pokemon: if (pokemon.fainted == False): decision_vars = pokemon.get_decision_vars() decision_vars.print_min_decision_vars() while True: possible_choices = [] for pokemon in self.team.pokemon: if (pokemon.fainted == False): possible_choices.append(pokemon) return fakerandom.fakechoice(possible_choices)