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

Possibly incorrect formula for Pokemon level #2515

Open
wfcook opened this issue Mar 4, 2018 · 4 comments
Open

Possibly incorrect formula for Pokemon level #2515

wfcook opened this issue Mar 4, 2018 · 4 comments

Comments

@wfcook
Copy link

wfcook commented Mar 4, 2018

Expected Behavior

Pokemon can have half-levels, although they don't appear in the wild that way. They can be in gyms with half-levels. The current equation appears to only allow for integer levels.

Current Behavior

In getPokemonLevel:
pokemonLevel = (Math.round(pokemonLevel) * 2) / 2

Possible Solution

pokemonLevel = Math.round(pokemonLevel*2)  / 2

Steps to Reproduce (for bugs)

This probably isn't being noticed because RM doesn't show pokemon level in the gym overlay. I suspect that if it did we'd see it. Pokemon in the wild only have integer levels.

Context

Not at all, but ... my OCD tendencies think it should be fixed.

Your Environment

Windows 10, Python 2.7

@sebastienvercammen
Copy link
Member

sebastienvercammen commented Mar 4, 2018

Strangely enough, this doesn't make much sense:

x * 2 / 2

because that's just x.

To be checked what the intention was.

@wfcook
Copy link
Author

wfcook commented Mar 4, 2018

Yeah, that's what piqued my interest. I'm pretty sure the intent was to round to the nearest half-level. I believe that this bug propagates to PokeAlarm, Monocle, and the Sloppy fork...I know I saw it in some python code somewhere also.

@wfcook
Copy link
Author

wfcook commented Mar 4, 2018

Also shows up in pogom/utils.py:

def calc_pokemon_level(cp_multiplier):
    if cp_multiplier < 0.734:
        pokemon_level = (58.35178527 * cp_multiplier * cp_multiplier -
                         2.838007664 * cp_multiplier + 0.8539209906)
    else:
        pokemon_level = 171.0112688 * cp_multiplier - 95.20425243
    pokemon_level = int((round(pokemon_level) * 2) / 2)
    return pokemon_level

@weizh888
Copy link
Contributor

weizh888 commented Apr 2, 2018

Multiply by 2, round, then divide by 2

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

3 participants