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

Use catch probability from encounter_data to select ball #322

Open
xasdf opened this issue Aug 15, 2016 · 0 comments
Open

Use catch probability from encounter_data to select ball #322

xasdf opened this issue Aug 15, 2016 · 0 comments

Comments

@xasdf
Copy link

xasdf commented Aug 15, 2016

I propose using catch probability to select ball instead of relying on combat_power.

Example plugins/catch_pokemon/init.py modifications:

        probability = encounter_data.probability[0]
        ...
        # TODO: This should probably be cleaned up
        for catch_attempt in range(20):
            if total_pokeballs == 0:
                log("No Pokeballs in inventory; cannot catch.", color="red")
                return

            pokeball = 0

            if balls_stock[1] > 0:
                pokeball = 1

            if balls_stock[2] > 0:
                if probability < 0.25 or pokemon_potential > 0.82 or combat_power > 1000 or (pokeball is 0 and balls_stock[2] > 9):
                    pokeball = 2

            if balls_stock[3] > 0:
                if probability < 0.15 or pokemon_potential > 0.92 or combat_power > 1200 or (pokeball is 0 and balls_stock[3] > 9):
                    pokeball = 3

            if pokeball == 0:
                log("No ball selected as all balls are low in stock. Saving for better Pokemon.", color="red")
                break

            log("Using {}... ({} left!)".format(bot.item_list[pokeball], balls_stock[pokeball]-1))

            probability -= 0.05
            balls_stock[pokeball] -= 1
            ...

Probability is decreased each time so that better balls can be selected as throws miss. This probably should be enhanced to use master balls too but I don't know their id (is it 4?).

Sorry this is not PR, maybe someone can pick it up and create a proper PR.

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

No branches or pull requests

2 participants