jekirl / poketrainer

The original Pokemon Go bot
Other
120 stars 58 forks source link

[Bug] Second stage evolution not working #287

Open q32103940 opened 8 years ago

q32103940 commented 8 years ago

for pkmn families with 3 stages, code is not correctly detecting the family when looking at second stage pkmn who can still evolve. e.g., pidgeotto being identified as pidgeotto family instead of pidgey family, metapod as metapod family instead of caterpie family, etc.

error example:

File "pokecli.py", line 129, in main() File "pokecli.py", line 108, in main api = PGoApi(config, pokemon_names) File "C:\Python27\pogobot5\pgoapi\pgoapi.py", line 98, in init self.POKEMON_EVOLUTION_FAMILY[getattr(Enums_pb2, k)] = getattr(Enumspb2, "F AMILY" + k) AttributeError: 'module' object has no attribute 'FAMILY_METAPOD'

config.json, crash with above error unless pidgeotto and kakuna removed:

  "POKEMON_EVOLUTION": {
    "PIDGEY":12,
    "WEEDLE":12,
    "CATERPIE":12,
    "RATTATA":25,
    "ODDISH":25,
    "POLIWAG":25,
    "ABRA":25,
    "MACHOP":25,
    "BELLSPROUT":25,
    "GASTLY":25,
    "SPEAROW":50,
    "KAKUNA":50,
    "PIDGEOTTO":50
    }, 

possible problem location, ln640:

def is_pokemon_eligible_for_evolution(self, pokemon): return self.inventory.pokemon_candy.get(self.POKEMON_EVOLUTION_FAMILY.get(pokemon.pokemon_id, None), -1) > self.POKEMON_EVOLUTION.get(pokemon.pokemon_id, None) \ and pokemon.pokemon_id not in self.keep_pokemon_ids \ and not pokemon.is_favorite \ and pokemon.pokemon_id in self.POKEMON_EVOLUTION

jekirl commented 8 years ago

ah I see what is happening here...we should have candy required/family stored instead of creating the dictionary at run time...

Will hack together a quick fix when I am next at my computer if someone hasn't done so already

beeedy commented 8 years ago

It may be worth creating a large LUT hard coded with each Pokemon, it's evolution, candies needs to evolve, and it's family. I have one already created and can post it here for those interested

HibikiFox commented 8 years ago

Also as a side note... it will NEVER evlove a kakuna or a pidgeotto with those settings so they are somewhat pointless...

it will always evolve what it can as soon as it can so you will never accumulate enough candy to evolve the next stage... at least for now, possible fix/enhancement to add a wait?

but.. then again why would you... if the goal is to farm exp and not horrible pokemon why would you want a ton of pidgeot?

beeedy commented 8 years ago

I actually have a fully working feature where if you specify the second stage in your list along with the first stage evolution, the bot will evolve all of the second stage before falling back to evolving first stages. Reason for this is when coupled with release duplicates method you quickly get an incredibly strong (cp and IV) collection of Pokemon and don't hoard a bunch of 3rd evolutions

HibikiFox commented 8 years ago

Touche' good sir, in this case if you are going for CP IV over EXP then you would be correct and I didn't think of that!

would you be so kind as to share how you setup that feature ?

beeedy commented 8 years ago

As far as I am aware, the code to support this isn't currently in place on master or development. I haven't had much time to fully test it as much as I would like, and it is still a little buggy. I won't have time to personally dig into it until next week some time :(

The logic for it is fairly straight forward, although slight modifications are needed depending upon the current evolution implementation. Essentially it works as so: a giant look up table was constructed that specified each Pokemon, the family it belonged to, candies needed to evolve, and a reference to the Pokemon it evolved into (last stages linked to missingno aka #0). Initially the feature was setup to evolve all Pokemon to their final stage and would work as so:

if (we_dont_own_next_stage OR next_stage_is_last): 
     evolve 

Simple modifications could be made to adjust it to only evolve Pokemon in your list, or to just evolve_all: true But if you have even a little Python experience this would be an easily implementation!

Reason mine is a little buggier, it includes logic to check if an evolution of a first stage would result in a stronger second stage than we currently own (if we own one). If the first stage, after being evolved, was stronger the bot would transfer the existing second stage and evolve the first stage we own to take its place. Basically this was a mechanic to make the evolutions more candy efficient and getting the most XP possible for your candies!

Hopefully this makes sense, I apologize I am typing all this on my phone while traveling. If any questions please let me know and I'll do my best to answer :)

piprees commented 8 years ago

That sounds awesome @beeedy, I'd love to see something like that implemented! :o

BoBeR182 commented 8 years ago
Traceback (most recent call last):
  File "pokecli.py", line 179, in <module>
    main()
  File "pokecli.py", line 127, in main
    api = PGoApi(config)
  File "/home/bober/poketrainer/pgoapi/pgoapi.py", line 131, in __init__
    self.POKEMON_EVOLUTION_FAMILY[getattr(Enums_pb2, k)] = getattr(Enums_pb2, "FAMILY_" + k)
AttributeError: 'module' object has no attribute 'FAMILY_KADABRA'
BoBeR182 commented 8 years ago

As for never evolving T2, here is my config.json, I want to farm perfect IV 100 T3 evolutions.


      "POKEMON_EVOLUTION": {
        "BULBASAUR": 125,
        "IVYSAUR": 100,
        "CHARMANDER": 125,
        "CHARMELEON": 100,
        "SQUIRTLE": 125,
        "WARTORTLE": 100,
        "CATERPIE": 62,
        "METAPOD": 100,
        "WEEDLE": 62,
        "KAKUNA": 100,
        "PIDGEY": 62,
        "PIDGEOTTO": 100,
        "RATTATA": 62,
        "SPEAROW": 100,
        "EKANS": 100,
        "PIKACHU": 100,
        "SANDSHREW": 100,
        "NIDORAN_FEMALE": 125,
        "NIDORINA": 100,
        "NIDORAN_MALE": 125,
        "NIDORINO": 100,
        "CLEFAIRY": 100,
        "VULPIX": 100,
        "JIGGLYPUFF": 100,
        "ZUBAT": 100,
        "ODDISH": 125,
        "GLOOM": 100,
        "PARAS": 100,
        "VENONAT": 100,
        "DIGLETT": 100,
        "MEOWTH": 100,
        "PSYDUCK": 100,
        "MANKEY": 100,
        "GROWLITHE": 100,
        "POLIWAG": 125,
        "POLIWHIRL": 100,
        "ABRA": 125,
        "KADABRA": 100,
        "MACHOP": 125,
        "MACHOKE": 100,
        "BELLSPROUT": 125,
        "WEEPINBELL": 100,
        "TENTACOOL": 50,
        "GEODUDE": 125,
        "GRAVELER": 100,
        "PONYTA": 100,
        "SLOWPOKE": 100,
        "MAGNEMITE": 100,
        "FARFETCHD": 100,
        "DODUO": 100,
        "SEEL": 100,
        "GRIMER": 100,
        "SHELLDER": 100,
        "GASTLY": 125,
        "HAUNTER": 100,
        "DROWZEE": 100,
        "KRABBY": 100,
        "VOLTORB": 100,
        "EXEGGCUTE": 100,
        "CUBONE": 100,
        "KOFFING": 100,
        "RHYHORN": 100,
        "HORSEA": 100,
        "GOLDEEN": 100,
        "STARYU": 100,
        "MAGIKARP": 400,
        "EEVEE": 62,
        "OMANYTE": 100,
        "KABUTO": 100,
        "DRATINI": 125,
        "DRAGONAIR": 100