-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Ultraball If No Other Balls (With Constraint) #3421
Changes from all commits
52b691f
b3b62c5
72e6ce3
2137f11
616d82f
6f14c2f
b08f630
940402a
0d5e9fa
2534f58
d0b76b4
5c4cf9b
00daaf8
90c023d
165aa99
bb3d083
844284e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -264,6 +264,12 @@ def _do_catch(self, pokemon, encounter_id, catch_rate_by_ball, is_vip=False): | |
berry_count = self.bot.item_inventory_count(berry_id) | ||
items_stock = self.bot.current_inventory() | ||
|
||
# use `min_ultraball_to_keep` from config if is not None | ||
min_ultraball_to_keep = items_stock[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 | ||
|
||
while True: | ||
|
||
# find lowest available ball | ||
|
@@ -272,7 +278,13 @@ def _do_catch(self, pokemon, encounter_id, catch_rate_by_ball, is_vip=False): | |
current_ball += 1 | ||
if items_stock[current_ball] == 0: | ||
self.emit_event('no_pokeballs', formatted='No usable pokeballs found!') | ||
break | ||
|
||
# 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: | ||
maximum_ball = ITEM_ULTRABALL | ||
continue | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you should remove this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exactly, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah, ok |
||
else: | ||
break | ||
|
||
# check future ball count | ||
num_next_balls = 0 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 285
min_ultraball_to_be_kept
Here
min_ultraball_to_keep
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I should close this and open a new PR?