diff --git a/docs/configuration_files.md b/docs/configuration_files.md index d931ee5a7f..9fc17488b7 100644 --- a/docs/configuration_files.md +++ b/docs/configuration_files.md @@ -506,6 +506,7 @@ This task will fetch current pokemon spawns from /raw_data of an PokemonGo-Map i - `priority` - Will move to the pokemon with the highest priority assigned (tie breaking by distance) * `prioritize_vips` - Will prioritize vips in distance and priority mode above all normal pokemon if set to true * `min_time` - Minimum time the pokemon has to be available before despawn +* `min_ball` - Minimum amount of balls required to run task * `max_distance` - Maximum distance the pokemon is allowed to be when walking, ignored when sniping * `snipe`: - `True` - Will teleport to target pokemon, encounter it, teleport back then catch it diff --git a/pokemongo_bot/cell_workers/move_to_map_pokemon.py b/pokemongo_bot/cell_workers/move_to_map_pokemon.py index 39a927c547..e57cbb5725 100644 --- a/pokemongo_bot/cell_workers/move_to_map_pokemon.py +++ b/pokemongo_bot/cell_workers/move_to_map_pokemon.py @@ -286,7 +286,7 @@ def work(self): superballs_quantity = inventory.items().get(GREATBALL_ID).count ultraballs_quantity = inventory.items().get(ULTRABALL_ID).count - if (pokeballs_quantity + superballs_quantity + ultraballs_quantity) < 1: + if (pokeballs_quantity + superballs_quantity + ultraballs_quantity) < self.min_ball: return WorkerResult.SUCCESS self.update_map_location() @@ -305,11 +305,6 @@ def work(self): pokemon = pokemon_list[0] - if pokeballs_quantity < 1: - if superballs_quantity < 1: - if ultraballs_quantity < 1: - return WorkerResult.SUCCESS - if self.config['snipe']: if self.snipe_high_prio_only: if self.snipe_high_prio_threshold < pokemon['priority']: @@ -317,6 +312,12 @@ def work(self): else: return self.snipe(pokemon) + # check for pokeballs (excluding masterball) + # checking again as we may have lost some if we sniped + pokeballs_quantity = inventory.items().get(POKEBALL_ID).count + superballs_quantity = inventory.items().get(GREATBALL_ID).count + ultraballs_quantity = inventory.items().get(ULTRABALL_ID).count + if pokeballs_quantity + superballs_quantity + ultraballs_quantity < self.min_ball: return WorkerResult.SUCCESS