Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better enforce rules about Pokemons to retain. #2073

Merged
merged 1 commit into from
Aug 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions pokemongo_bot/cell_workers/transfer_pokemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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:
Expand Down