LAMaglan / PokeFightSimulator

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

Fix stat update #50

Closed LAMaglan closed 3 months ago

LAMaglan commented 3 months ago

Some improvements and code refactoring (better weighting, etc.) At some point, the result of battle was always the "wrong" pokemon. The main problem was this return at end of the battle() function:

return attacker.name if pokemon2.hp["base_stat"] <= 0 else defender.name

Changed to this:

return defender.name if pokemon2.hp["base_stat"] <= 0 else attacker.name