From 1aa0e3bde12647eaabb2968d4ab5c9733afc5fe9 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Sun, 31 Jul 2016 16:40:53 +0200 Subject: [PATCH] Better enforce rules about Pokemons to retain. Rules about maximum CP and IV to transfer Pokemons are applied also when keeping the best ones. --- pokemongo_bot/cell_workers/transfer_pokemon.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pokemongo_bot/cell_workers/transfer_pokemon.py b/pokemongo_bot/cell_workers/transfer_pokemon.py index 34e4518096..735a9b1750 100644 --- a/pokemongo_bot/cell_workers/transfer_pokemon.py +++ b/pokemongo_bot/cell_workers/transfer_pokemon.py @@ -41,7 +41,12 @@ def work(self): all_pokemons.remove(pokemon) best_pokemons.append(pokemon) - if best_pokemons and all_pokemons: + transfer_pokemons = [pokemon for pokemon in all_pokemons + if self.should_release_pokemon(pokemon_name, + pokemon['cp'], + pokemon['iv'])] + + if transfer_pokemons: logger.log("Keep {} best {}, based on {}".format(len(best_pokemons), pokemon_name, order_criteria), "green") @@ -50,10 +55,10 @@ def work(self): best_pokemon['cp'], best_pokemon['iv']), 'green') - logger.log("Transferring {} pokemon".format(len(all_pokemons)), "green") + logger.log("Transferring {} pokemon".format(len(transfer_pokemons)), "green") - for pokemon in all_pokemons: - self.release_pokemon(pokemon_name, pokemon['cp'], pokemon['iv'], pokemon['pokemon_data']['id']) + for pokemon in transfer_pokemons: + self.release_pokemon(pokemon_name, pokemon['cp'], pokemon['iv'], pokemon['pokemon_data']['id']) else: group = sorted(group, key=lambda x: x['cp'], reverse=True) for item in group: