Closed hsahovic closed 1 year ago
Merging #442 (de7fc36) into master (f627cc2) will increase coverage by
0.09%
. Report is 4 commits behind head on master. The diff coverage is86.66%
.
@@ Coverage Diff @@
## master #442 +/- ##
==========================================
+ Coverage 83.32% 83.41% +0.09%
==========================================
Files 39 39
Lines 3946 3956 +10
==========================================
+ Hits 3288 3300 +12
+ Misses 658 656 -2
Fix https://github.com/hsahovic/poke-env/issues/437
We usually receive request messages before parsing the events of a turn. This leads to the status of pokemon being updated before actually receiving the corresponding individual messages. Because the
_swap
method that allyswitch messages call in battle objects checks whether a pokemon is fainted before switching their place, if a pokemon uses alyswitch before it or its partner faint later in the turn, we can erroneously not switch their place.This PR adds a check in double message request parsing: if the faint status and species of mons do not match, we force-switch them.
Additionally, to make the check more robust to form changes, this PR adds a
base_species
property toPokemon
objects.