Skip to content

Commit

Permalink
Add nature power and metronome to override moves
Browse files Browse the repository at this point in the history
  • Loading branch information
hsahovic committed Jun 18, 2023
1 parent 2b7f01e commit 7d62fda
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/poke_env/environment/abstract_battle.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,16 +413,13 @@ def _parse_message(self, split_message: List[str]) -> None:
if split_message[-1].startswith("[anim]"):
split_message = split_message[:-1]

if split_message[-1] == "null":
split_message = split_message[:-1]

if split_message[-1].startswith("[from]move: "):
override_move = split_message.pop()[12:]

if override_move == "Sleep Talk":
# Sleep talk was used, but also reveals another move
reveal_other_move = True
elif override_move == "Copycat":
elif override_move in {"Copycat", "Metronome", "Nature Power"}:
pass
else:
self.logger.warning(
Expand All @@ -434,6 +431,9 @@ def _parse_message(self, split_message: List[str]) -> None:
self.turn,
)

if split_message[-1] == "null":
split_message = split_message[:-1]

if split_message[-1].startswith("[from]ability: "):
revealed_ability = split_message.pop()[15:]
pokemon = split_message[2]
Expand Down Expand Up @@ -500,8 +500,8 @@ def _parse_message(self, split_message: List[str]) -> None:
temp_pokemon._start_effect("MINIMIZE")

if override_move:
# Both copy cat and sleep talk, the two moves that can trigger this branch, have two `move` messages.
# We're setting use=False in the one with the override in order to prevent two pps from being used
# Moves that can trigger this branch results in two `move` messages being sent.
# We're setting use=False in the one (with the override) in order to prevent two pps from being used
# incorrectly.
self.get_pokemon(pokemon)._moved(
override_move, failed=failed, use=False
Expand Down

0 comments on commit 7d62fda

Please sign in to comment.