Skip to content
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

Smart pinap function #6131

Closed
ChiefM3 opened this issue Jul 25, 2017 · 1 comment
Closed

Smart pinap function #6131

ChiefM3 opened this issue Jul 25, 2017 · 1 comment

Comments

@ChiefM3
Copy link
Contributor

ChiefM3 commented Jul 25, 2017

Short Description

I made a "smart pinap" function to maximize the use of pinap berries.
Ex1) If catch rate is over 85% for a normal mon use a pinap, but spare 3 for VIPs
Ex2) If catch rate is over a threshold (90%) for a VIP use a pinap, if under that threshold the original razz berry logic kicks in.
The current logic for VIP is fixed to razz or pinap, and for normal mon the level or CP determines the use of pinap. I think the actual catch rate is more important.

How do I add this to the bot? I am new to github, and I want to contribute to this bot.

Possible solution

I made something like this in pokemon_catch_worker.py
# SMART_PINAP: Use pinap when high catch rate, but spare some for VIP with high catch rate
if self.smart_pinap_enabled and ( (not is_vip and self.inventory.get(ITEM_PINAPBERRY).count > self.smart_pinap_to_keep and catch_rate_by_ball[current_ball] > self.pinap_threshold) or (is_vip and self.inventory.get(ITEM_PINAPBERRY).count > 0 and catch_rate_by_ball[current_ball] >= self.vip_berry_threshold) ) and not used_berry:
berry_id = ITEM_PINAPBERRY
new_catch_rate_by_ball = self._use_berry(berry_id, berry_count, encounter_id, catch_rate_by_ball, current_ball)
self.inventory.get(berry_id).remove(1)
berry_count -= 1
used_berry = True

How it would help others

Instead of throwing away pinap berries, you can get more candy!

@davidakachaos
Copy link
Contributor

Congrats on your first PR. Because it is merged, I'll close this issue 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants