jabbink / PokemonGoBot

DEFUNCT - Bot that plays Pokemon Go
https://www.pogobot.club/
GNU General Public License v3.0
560 stars 234 forks source link

Evolve Pokemon #5

Closed jabbink closed 7 years ago

jabbink commented 7 years ago

General gameplay

For special occasions:

mroge009 commented 7 years ago

Started working on evolutionary transfers.
Keeps just as many as you need to evolve.

pgo1

class Release : Task {
    override fun run(context: Context?) {
        val groupedPokemon = context!!.api.pokebank.pokemons.groupBy { it.pokemonId }
        groupedPokemon.forEach {
            val sorted = it.value.sortedByDescending { it.cp }
            for ((index, pokemon) in sorted.withIndex()) {
                when (pokemon.pokemonId.name) {
                    "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" -> 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()
                    }
                    "WEEDLE" -> 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()
                    }
                    "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()
                    }
                    else -> {
                        if (index > 0 && pokemon.cp < 50) {
                            println("Going to transfer ${pokemon.pokemonId.name} with CP ${pokemon.cp}")
                            pokemon.transferPokemon()
                        }
                    }
                }
            }
        }
    }
}
bluebabyf1 commented 7 years ago

Hi mroge009, could you please tell me where do I add your code? I'm a bit noob on code aswell so your help would be grateful. Thanks

mroge009 commented 7 years ago

@bluebabyf1 Replace the code in your releasepokemon.kt with this if you want to use the same functionality. It keeps Rattatas, pidgey, caterpies, and weedles but you can add others.

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
                when (pokemon.pokemonId.name) {
                    "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()
                    }
                    else -> {
                        if (index > 0 && (pokemon.cp < maxCP || obligatoryTransfer.contains(pokemon.pokemonId.name)) &&
                                (!ignoredPokemon.contains(pokemon.pokemonId.name)) && IV < 80) {
                            println("Going to transfer ${pokemon.pokemonId.name} with CP ${pokemon.cp} and IV ${IV}")
                            pokemon.transferPokemon()
                        }
                    }
                }
            }
        }

In terms of an IDE I am using InteliJ IDEA and just pulled from the GIT repo

pascalpfeil commented 7 years ago

I think now is a good time to implement this, because the bot is kind of good now, and you get to level 20 easily. But from that onwards, progress is rather slow. So a mode to fram 12 candy evolution pkmn & mass evolving in combination with a lucky egg would be really nice.

Orabig commented 7 years ago

I wrote an "auto evolve" feature in PR #163

Agronis commented 7 years ago

I might suggest the following parameters for "evolve_mode" if you would..

Mixone-FinallyHere commented 7 years ago

Mixed with the evolution multipliers could calculate if it is at best moment to evolve no? Any progress on this yet? I'd help but I'm not good enough with java 😢

Orabig commented 7 years ago

Well, @Miguel, you can help by giving the formula for the computation and explain the criteria. Someone will then use this to implement the fonctionality...

2016-08-11 22:34 GMT+02:00 Miguel notifications@github.com:

Mixed with the evolution multipliers could calculate if it is at best moment to evolve no? Any progress on this yet? I'd help but I'm not good enough with java 😢

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jabbink/PokemonGoBot/issues/5#issuecomment-239283663, or mute the thread https://github.com/notifications/unsubscribe-auth/ACFENxkZIavRT64Ekns1HeHl8TTKDwZLks5qe4dwgaJpZM4JQzeC .

Mixone-FinallyHere commented 7 years ago

We would need an array then that contains floats with the multiplication value it would be an expected value, the actual could be higher or lower but still

Then we have a table that contains the max cp of a certain pokemon at your level

If pokemons CP is at least 75% of its maximum possible (so if say Pikachu could have 1000 CP minimum CP to evolve will be 750) this can be set by user though

We then calculate what its expected CP will be from that array using the pokemons ID as an index in both tables, if that CP is higher than amount set up by user for auto transfer, and all limits existing like max amount etc... proceed to evolve if its IV was a desirable one

Also in the table having final evolutions with a value of 0 (not NULL) so that even if there is a bug trying to evolve them it wont since 0 CP is always unwanted

Mixone-FinallyHere commented 7 years ago

I only mention IV at the end because people might want to evolve pokemon even if they have low IV so IV check here will be in theory unrelated to unwanted IV check from captures for auto transfer

Another extra implement might be actually checking in the pokedex if they have the pokemon or not also so as to give it a certain priority