Skip to content

Commit

Permalink
Update use ultraball with constraint (#3760)
Browse files Browse the repository at this point in the history
* Add Use Ultraball (#1)

* Add `use_ultraball` event to Event Manager

* Add use ultraball if pokeball + greatball = 0

* Add Use Ultraball if No Other Balls (#2)

* Add `use_ultraball` event to Event Manager

* Add use ultraball if pokeball + greatball = 0

* Add New Contributor

* Revert "Add Use Ultraball" (#4)

* Use Ultraball If No Other Balls (#3)

* Add `use_ultraball` event to Event Manager

* Add use ultraball if pokeball + greatball = 0

* Add New Contributor

* Remove 'use_ultraball' event.

* Remove `use_ultraball` event call

* Update & add avoid catching Pokemon if no pokeball

* Update conflict contributors

* Add get `min_ultraball_to_keep` from config file

* Improved `min_ultraball_to_keep` with condition

* Added `min_ultraball_to_keep` option

* Added `min_ultraball_to_keep` option

* Added `min_ultraball_to_keep` option

* Added `min_ultraball_to_keep` option

* Add `min_ultraball_to_keep` option

* Remove count all pokeballs

* Resolved Conflicts

* Change from `items_stock` to `ball_count`
  • Loading branch information
joaodragao authored and douglascamata committed Aug 12, 2016
1 parent 12b47d3 commit 4b632d8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pokemongo_bot/cell_workers/pokemon_catch_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def _do_catch(self, pokemon, encounter_id, catch_rate_by_ball, is_vip=False):
ball_count[ball_id] = self.inventory.get(ball_id).count

# use `min_ultraball_to_keep` from config if is not None
min_ultraball_to_keep = items_stock[ITEM_ULTRABALL]
min_ultraball_to_keep = ball_count[ITEM_ULTRABALL]
if self.config.min_ultraball_to_keep is not None:
if self.config.min_ultraball_to_keep >= 0 and self.config.min_ultraball_to_keep < min_ultraball_to_keep:
min_ultraball_to_keep = self.config.min_ultraball_to_keep
Expand All @@ -267,7 +267,7 @@ def _do_catch(self, pokemon, encounter_id, catch_rate_by_ball, is_vip=False):
self.emit_event('no_pokeballs', formatted='No usable pokeballs found!')

# use untraball if there is no other balls with constraint to `min_ultraball_to_keep`
if maximum_ball != ITEM_ULTRABALL and items_stock[ITEM_ULTRABALL] > min_ultraball_to_keep:
if maximum_ball != ITEM_ULTRABALL and ball_count[ITEM_ULTRABALL] > min_ultraball_to_keep:
maximum_ball = ITEM_ULTRABALL
continue
else:
Expand Down

0 comments on commit 4b632d8

Please sign in to comment.