Skip to content

Commit

Permalink
Merge pull request #6012 from davidakachaos/optimizer_powerup_fix
Browse files Browse the repository at this point in the history
Optimizer powerup fix
  • Loading branch information
pogarek authored Apr 11, 2017
2 parents c9f63c2 + aafae90 commit 68ab99e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pokemongo_bot/cell_workers/pokemon_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,9 @@ def get_evolution_plan(self, family_id, family_list, keep, try_evolve, try_upgra
upgrade_level = min(self.config_upgrade_level, inventory.player().level + 1.5, 40)

for pokemon in try_upgrade:
# self.log("Considering %s for upgrade" % pokemon.name)
if pokemon.level >= upgrade_level:
# self.log("Pokemon already at target level. %s" % pokemon.level)
continue

full_upgrade_candy_cost = 0
Expand All @@ -597,8 +599,12 @@ def get_evolution_plan(self, family_id, family_list, keep, try_evolve, try_upgra
self.ongoing_stardust_count -= full_upgrade_stardust_cost

if (candies < 0) or (self.ongoing_stardust_count < 0):
# self.log("Not enough candy: %s" % candies)
# self.log("or stardust %s" % self.ongoing_stardust_count)
# We didn' t use the stardust, so refund it...
self.ongoing_stardust_count += full_upgrade_stardust_cost
continue

# self.log("Pokemon can be upgraded!!")
upgrade.append(pokemon)

if (not self.config_evolve_for_xp) or (family_name in self.config_evolve_for_xp_blacklist):
Expand Down

0 comments on commit 68ab99e

Please sign in to comment.