-
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 2 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 |
---|---|---|
|
@@ -60,3 +60,4 @@ | |
* thebigjc | ||
* JaapMoolenaar | ||
* eevee-github | ||
* joaodragao |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -282,6 +282,8 @@ 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() | ||
|
||
min_ultraball_to_be_kept = self.config.get('min_ultraball_to_be_kept', items_stock[ITEM_ULTRABALL]) | ||
|
||
while True: | ||
|
||
# find lowest available ball | ||
|
@@ -290,7 +292,18 @@ 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 | ||
if maximum_ball != ITEM_ULTRABALL and items_stock[ITEM_ULTRABALL] > min_ultraball_to_keep: | ||
maximum_ball = ITEM_ULTRABALL | ||
self.emit_event( | ||
'use_ultraball', | ||
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. This event is not necessary at all, we already have this: self.emit_event(
'threw_pokeball',
formatted='Used {ball_name}, with chance {success_percentage} ({count_left} left)',
data={
'ball_name': self.item_list[str(current_ball)],
'success_percentage': self._pct(catch_rate_by_ball[current_ball]),
'count_left': items_stock[current_ball]
}
) Which is enough information for the user. |
||
formatted='Use ultraball instead (ultraball count > {ultraball_count})', | ||
data={ | ||
'ultraball_count': min_ultraball_to_keep | ||
} | ||
) | ||
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?