PokemonGoBot icon indicating copy to clipboard operation
PokemonGoBot copied to clipboard

Recommendation: Compute IV and Auto Transfer <%

Open tonysguo opened this issue 10 years ago • 9 comments

Use formula via https://docs.google.com/spreadsheets/d/1wbtIc33K45iU1ScUnkB0PlslJ-eLaJlSZY47sPME2Uk/htmlview?usp=sharing&sle=true to calculate IV based on CP, HP, dust price of captured pokemon and auto-transfer those below a set threshold.

tonysguo avatar Jul 22 '16 06:07 tonysguo

I did something similar in #39 but I just used the CP. The dust price is the dust needed to level the pokemon up? Anyway all the characteristics of a pokemon that we can use are defined here https://github.com/AeonLucid/POGOProtos/blob/master/src/POGOProtos/Data/PokemonData.proto where stamina and stamina_max should be the HP, but i don't see the dust price.

mluigi avatar Jul 22 '16 08:07 mluigi

What does IV stand for?

Also stuff like the Dust price is available in the GAME_MASTER protobuf, which will be incorporated in the Java API soon'ish, so it would be futile to store them in this repo as well then.

jabbink avatar Jul 22 '16 10:07 jabbink

I added IV calculation with options in the properties to set minIV.

config.properties

#Minimum IV to keep a pokemon
transfer_IV_threshold=90

Bot.kt EDIT: This is not required. Just added to show current IV of pokebank.

api.pokebank.pokemons.map {
            var IV = ((it.individualStamina + it.individualAttack + it.individualDefense) * 100) / 45
            "Have ${it.pokemonId.name} (${it.nickname}) with ${it.cp} CP and IV ${IV}"
        }.forEach { println(it) }

Settings.kt val transferIVThreshold = getPropertyIfSet("Minimum IV to keep a pokemon", "transfer_IV_threshold", 80, String::toInt)

Releasepokemon.kt EDIT: Removed unfinished evolution transfer limits

val minIV = settings.transferIVThreshold

        groupedPokemon.forEach {
            val sorted = it.value.sortedByDescending { it.cp }
            for ((index, pokemon) in sorted.withIndex()) {
                var IV = ((pokemon.individualStamina + pokemon.individualAttack + pokemon.individualDefense) * 100) / 45
                // never transfer highest rated Pokemon
                // never transfer > maxCP, unless set in obligatoryTransfer
                // stop releasing when pokemon is set in ignoredPokemon
                        if (index > 0 && (pokemon.cp < maxCP || obligatoryTransfer.contains(pokemon.pokemonId.name)) &&
                                (!ignoredPokemon.contains(pokemon.pokemonId.name)) && IV < minIV) {
                            println("Going to transfer ${pokemon.pokemonId.name} with CP ${pokemon.cp} and IV ${IV}")
                            pokemon.transferPokemon()
                        }
                }
            }
        }

Marrcroger avatar Jul 22 '16 16:07 Marrcroger

I'm implementig this right now @mroge009. But i have to remove this part

"RATTATA" -> if (index > pokemon.candy / 25) {
                        println("Going to transfer ${pokemon.pokemonId.name} with CP ${pokemon.cp} because you currently have ${pokemon.getCandy() / 25} evolutions pending")
                        pokemon.transferPokemon()
                    }
                    "PIDGEY", "WEEDLE", "CATERPIE" -> if (index > pokemon.candy / 12) {
                        println("Going to transfer ${pokemon.pokemonId.name} with CP ${pokemon.cp} because you currently have ${pokemon.getCandy() / 12} evolutions pending")
                        pokemon.transferPokemon()
                    }

you have to let the user choose which pokemon to transfer directly, even if everyone is going to transfer those

mluigi avatar Jul 22 '16 16:07 mluigi

Yes, I forgot to remove that.
That's for me, and I am going to add a evolution switch which will use lucky eggs and do as many evolution as possible

EDIT: The bot.kt is not required. It is only so you can see the IV of current pokebank

Marrcroger avatar Jul 22 '16 16:07 Marrcroger

Awesome that was fast! @jabbink if you haven't looked it up, IV stood for individual value in the original games and is also in Go. Each Pokemon has a random +0 - 15 range to each stat, a perfect (100%) pokemon would have 15/15/15/15 to each of attack, defense, stamina, hp. So due to RNG a 0/0/0/0 vs. a 15/15/15/15 pokemon could vary by about 10% in CP.

TL;DR - don't just throw low CP pokemon away, one of these could be perfect and is really rare / worth spending the extra dust on leveling up.

tonysguo avatar Jul 22 '16 17:07 tonysguo

@xenxes I think IV is only atk, def, and sta where hp is a function of sta. I only used the first 3 in my calculations and they seem to work fine with my highest being a 93% Flareon

Marrcroger avatar Jul 22 '16 17:07 Marrcroger

@mroge009 yes sorry you are right, I went back to look at the formula, it is only atk/def/sta.

var IV = ((it.individualStamina + it.individualAttack + it.individualDefense) * 100) / 45

is correct :)

TY for adding this!

tonysguo avatar Jul 22 '16 17:07 tonysguo

Merged with a slight modification, instead of having this formula in the code twice, I added it as extension function to the Pokemon-class.

<3 Kotlin

jabbink avatar Jul 22 '16 23:07 jabbink