Skip to content

Commit

Permalink
Fix buddy crash and default evolve value in doc
Browse files Browse the repository at this point in the history
  • Loading branch information
julienlavergne committed Sep 20, 2016
1 parent ef2e9ea commit 53748f6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion configs/config.json.optimizer.example
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"mode": "overall",
"top": 1,
"sort": ["max_cp", "cp"],
"evolve": false,
"buddy": {"candy": -124}
},
{
Expand All @@ -50,7 +51,8 @@
{
"mode": "by_family",
"top": 1,
"sort": ["cp"]
"sort": ["cp"],
"evolve": false
}
]
}
Expand Down
6 changes: 4 additions & 2 deletions docs/pokemon_optimizer.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}
},
{
Expand All @@ -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
}
]
}
Expand Down Expand Up @@ -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.

Expand Down
6 changes: 3 additions & 3 deletions pokemongo_bot/cell_workers/pokemon_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 53748f6

Please sign in to comment.