LAMaglan / PokeFightSimulator

A (simple) fight simulator between any two Pokemon using FastAPI with Jinja frontend
0 stars 0 forks source link

Modify stats based on EV (effort values) #36

Closed LAMaglan closed 7 months ago

LAMaglan commented 8 months ago

Currently, when parsing data from pokeapi, I only take the "base_stat" for each stat:

            pokemon_data = response.json()
            stats = {
                stat["stat"]["name"]: stat["base_stat"]
                for stat in pokemon_data["stats"]
            }

Such that I get something like

{
   hp: 48
   attack: 52
    ....
}

However, in the source data, it is actually:

stats: [
   {
    base_stat: 48
    effort: 1
   stat: {
      name: "hp"
   }
   },
  {...}
  ...
]

I think what I should do is modify the Pokemon class, such that each stat looks something like:

hp: {base_stat: 48, effort: 1}
attack: {base_stat: 50, effort: 2}

Would then need to adjust all code accordingly

Could then also change the code for IV, such that IV becomes a part of the class. But maybe initialized "externally" whenever an endpoint is called, such that it is random each time endpoint is accessed (details in another issue)

LAMaglan commented 8 months ago

For type hint purposes, maybe easiest to make own (@data)class "Stats" with attributes "base_stat" and "effort" (and later, IV) which gets used in Pokemon