PokemonGoF / PokemonGo-Bot

The Pokemon Go Bot, baking with community.
MIT License
3.87k stars 1.54k forks source link

Fast attacks and charged attacks are treated together when computing attack.rate_in_type #5960

Open MeisterLLD opened 7 years ago

MeisterLLD commented 7 years ago

Because of this, the nicknaming worker will always put fast attacks as lowercase, even if one mon has the best fast attack available (because in almost every case it will be less than 0.7*DPS than the best charged).

Expected Behavior

The bot shoud compute separate rate_in_type for fast / charged attacks, thus allowing to compare fast attacks only among fast attacks and charged only among charged.

Actual Behavior

In inventory.py (line 645)

for attack in attacks: # type: Attack attack.rate_in_type = (attack.dps - min_dps) / max_dps

I think this computes rate_in_type without distinguishing fast and charged, thus in nickname_pokemon.py (line 464)

if attack.rate_in_type < self.good_attack_threshold: char = char.lower() return char

at the end this if is almost always satisfied for fast attacks, even if a mon has its best fast attack. (e.g. Espeon with Confusion, which is how I detected the problem).

MeisterLLD commented 7 years ago

I don't have time to investigate the syntax more and how to change this loop in separate loops without messing up everything, but if necessary I can spend some time doing a PR. I just think it might be quite quicker if someone is already familiar with this code :)

I think an easy solution would just be to make sure that the

by_type[attack_type]

list we work with here contains only fast/charged depending on the context.

This list is created at line 636 :

if attack_type not in by_type:
            by_type[attack_type] = []
        by_type[attack_type].append(attack)

we should add when creating it another condition to make sure we are listing only attacks of the same class.

MerlionRock commented 7 years ago

Most of the old developers have left the project.

You can try do a PR when you're free. We need some new bloods into this project :)

MeisterLLD commented 7 years ago

I tried some basic ideas like separating the lists by two if depending on cls is if or cls is fast but it doesn't work (it runs but doesn't solve the problem). I'm actually a very old school programmer so I suck at OOP :\

Le 11 mars 2017 02:01, "MerlionRock" notifications@github.com a écrit :

Most of the old developers have left the project.

You can try do a PR when you're free. We need some new bloods into this project :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/PokemonGoF/PokemonGo-Bot/issues/5960#issuecomment-285848796, or mute the thread https://github.com/notifications/unsubscribe-auth/AXspxITD4ufOc_tb0zVVN-3_l4fNPl0Iks5rkkbhgaJpZM4MZpct .

davidakachaos commented 7 years ago

Luckely python is a functional programming language... :wink: We could indeed sure use the help! If we/I can help you out, we will!

It seems indeed the case we need to seperate the moves, maybe some info can be found on the SliphRoad? Like this reddit thread?

pogarek commented 7 years ago

The moves are separated in two files: data/fast_moves.json data/charged_moves.json

in past the were different files, now they are the same files. I mean they have the same content. Should we make them different again ?