diff --git a/configs/config.json.optimizer.example b/configs/config.json.optimizer.example index cc49d73968..fdec70acae 100644 --- a/configs/config.json.optimizer.example +++ b/configs/config.json.optimizer.example @@ -25,6 +25,7 @@ "mode": "overall", "top": 1, "sort": ["max_cp", "cp"], + "evolve": false, "buddy": {"candy": -124} }, { @@ -50,7 +51,8 @@ { "mode": "by_family", "top": 1, - "sort": ["cp"] + "sort": ["cp"], + "evolve": false } ] } diff --git a/docs/pokemon_optimizer.md b/docs/pokemon_optimizer.md index bf554b8da0..ccfc6ea6bb 100644 --- a/docs/pokemon_optimizer.md +++ b/docs/pokemon_optimizer.md @@ -72,6 +72,7 @@ It will also collect the candies from your Buddy and select the next buddy. "mode": "overall", "top": 1, "sort": ["max_cp", "cp"], + "evolve": false, "buddy": {"candy": -124} }, { @@ -97,7 +98,8 @@ It will also collect the candies from your Buddy and select the next buddy. { "mode": "by_family", "top": 1, - "sort": ["cp"] + "sort": ["cp"], + "evolve": false } ] } @@ -167,7 +169,7 @@ It can help you rectify your configuration or guide you during manual transfer. ### evolve | Parameter | Possible values | Default | |-----------|-----------------|---------| -| `evolve` | `true`, `false` | `false` | +| `evolve` | `true`, `false` | `true` | The `evolve` parameter activate or deactivate the evolution of Pokemon. diff --git a/pokemongo_bot/cell_workers/pokemon_optimizer.py b/pokemongo_bot/cell_workers/pokemon_optimizer.py index cddb26ad89..d4111522f6 100644 --- a/pokemongo_bot/cell_workers/pokemon_optimizer.py +++ b/pokemongo_bot/cell_workers/pokemon_optimizer.py @@ -56,11 +56,11 @@ def initialize(self): self.config_upgrade = self.config.get("upgrade", False) self.config_upgrade_level = self.config.get("upgrade_level", 30) self.config_groups = self.config.get("groups", {"gym": ["Dragonite", "Snorlax", "Lapras", "Arcanine"]}) - self.config_rules = self.config.get("rules", [{"mode": "overall", "top": 1, "sort": ["max_cp", "cp"], "buddy": {"candy": -124}}, + self.config_rules = self.config.get("rules", [{"mode": "overall", "top": 1, "sort": ["max_cp", "cp"], "evolve": False, "buddy": {"candy": -124}}, {"mode": "by_family", "top": 3, "names": ["gym"], "sort": ["iv", "ncp"], "evolve": {"iv": 0.9, "ncp": 0.9}, "upgrade": {"iv": 0.9, "ncp": 0.9}}, {"mode": "by_family", "top": 1, "sort": ["iv"], "evolve": {"iv": 0.9}}, {"mode": "by_family", "top": 1, "sort": ["ncp"], "evolve": {"ncp": 0.9}}, - {"mode": "by_family", "top": 1, "sort": ["cp"]}]) + {"mode": "by_family", "top": 1, "sort": ["cp"], "evolve": False}]) if (not self.config_may_use_lucky_egg) and self.config_evolve_only_with_lucky_egg: self.config_evolve = False @@ -167,7 +167,7 @@ def work(self): if (not self.lock_buddy) and (len(buddy_all) > 0): new_buddy = buddy_all[0] - if self.buddy["id"] != new_buddy.unique_id: + if (not self.buddy) or (self.buddy["id"] != new_buddy.unique_id): self.set_buddy_pokemon(new_buddy) if self.get_pokemon_slot_left() > self.config_min_slots_left: @@ -508,8 +508,8 @@ def get_evolution_plan(self, family_id, family_list, keep, try_evolve, try_upgra full_upgrade_candy_cost = 0 full_upgrade_stardust_cost = 0 - for i in range(pokemon.level, upgrade_level, 0.5): - upgrade_cost = self.pokemon_upgrade_cost[2 * (i - 1)] + for i in range(int(pokemon.level * 2), int(upgrade_level * 2)): + upgrade_cost = self.pokemon_upgrade_cost[i - 2] full_upgrade_candy_cost += upgrade_cost[0] full_upgrade_stardust_cost += upgrade_cost[1]