Skip to content

Commit

Permalink
Evolve only if evolvable candidates no less than a certain number.
Browse files Browse the repository at this point in the history
Previously, when user configured use_lucky_egg as true, the bot will use
lucky egg even evolvale candidates is zero. That's kinda of
waste. Meanwhile, if user didn't configured use_lucky_egg, the bot will
try to evolve after sort by cp&iv, but sometimes no good potential
pokemon in that batch, it's better delay the evolution after a
while. By adding a config item evovle_num_min can cope above two
problems. The bot evolves only if evolvable candidates no less than a
certain number.

1. Evolve only if evolvable candidates no less than a certain number.

2. Dragoniar's configuration is abnormal in pokemon.json, which lack of
"Previous evolution(s)" attribute, while the other middle-tier pokemon
has.

Fixed some issues after: Refactor evolve_all worker PokemonGoF#2244

1. The refactoring try to sort by pokemon index desc which is not
good. For example, why Venusaur which is PokemonGoF#3 should be with lower
priority than Pidgey(PokemonGoF#16)?

2. The refactoring always use dict.get(key, {}).get(key, {}) which will
eventually return a {} which will cause side effect. It's better
fail fast when the dict has no attribute which is unexpected by the
developer.

3. The reafctoring try to use cache when the pokemon is not
evovlable. That developer doesn't know previously we didn't caculate the
candy before evovling, thus caused a lot of failure when evovling. After
caculating candy requirements by the refactoring and this patch, the
failure rarely happens. Thus cache is not necessary when the pokemon is
not evovlable.
  • Loading branch information
Zhou committed Aug 3, 2016
1 parent 463bb1b commit d7574b2
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 431 deletions.
1 change: 1 addition & 0 deletions configs/config.json.cluster.example
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"first_evolve_by": "cp",
"evolve_above_cp": 500,
"evolve_above_iv": 0.8,
"evolve_num_min": 5,
"logic": "or",
"evolve_speed": 20,
"use_lucky_egg": false
Expand Down
1 change: 1 addition & 0 deletions configs/config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"first_evolve_by": "cp",
"evolve_above_cp": 500,
"evolve_above_iv": 0.8,
"evolve_num_min": 5,
"logic": "or",
"evolve_speed": 20,
"use_lucky_egg": false
Expand Down
1 change: 1 addition & 0 deletions configs/config.json.path.example
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"first_evolve_by": "cp",
"evolve_above_cp": 500,
"evolve_above_iv": 0.8,
"evolve_num_min": 5,
"logic": "or",
"evolve_speed": 20,
"use_lucky_egg": false
Expand Down
1 change: 1 addition & 0 deletions configs/config.json.pokemon.example
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"first_evolve_by": "cp",
"evolve_above_cp": 500,
"evolve_above_iv": 0.8,
"evolve_num_min": 5,
"logic": "or",
"evolve_speed": 20,
"use_lucky_egg": false
Expand Down
2 changes: 1 addition & 1 deletion data/pokemon.json

Large diffs are not rendered by default.

349 changes: 0 additions & 349 deletions pokemongo_bot/cell_workers/evolve_all.py

This file was deleted.

Loading

0 comments on commit d7574b2

Please sign in to comment.