Skip to content

Commit

Permalink
Fix active pokemon issue when not all mons are selected in team-preview
Browse files Browse the repository at this point in the history
  • Loading branch information
hsahovic committed Apr 10, 2023
1 parent 5229366 commit 58f2793
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/poke_env/environment/abstract_battle.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,8 @@ def _parse_message(self, split_message: List[str]) -> None:
self.get_pokemon(pokemon)._used_z_move()
elif split_message[1] == "clearpoke":
self._in_team_preview = True
for mon in self.team.values():
mon._clear_active()
elif split_message[1] == "gen":
self._format = split_message[2]
elif split_message[1] == "inactive":
Expand Down
3 changes: 3 additions & 0 deletions src/poke_env/environment/pokemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ def _cant_move(self):
if self._status == Status.SLP:
self._status_counter += 1

def _clear_active(self):
self._active = False

def _clear_boosts(self):
for stat in self._boosts:
self._boosts[stat] = 0
Expand Down
1 change: 0 additions & 1 deletion unit_tests/test_data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import pytest
from poke_env.data import GenData
from poke_env.environment import PokemonType
Expand Down

0 comments on commit 58f2793

Please sign in to comment.