From 7d8bd5b57c051349e288ce5d4cfe43f3b5681f5c Mon Sep 17 00:00:00 2001 From: Haris Sahovic Date: Tue, 10 Dec 2024 02:31:22 +0100 Subject: [PATCH] Handle magician in item messages --- src/poke_env/environment/abstract_battle.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/poke_env/environment/abstract_battle.py b/src/poke_env/environment/abstract_battle.py index 0bfe7f194..5fcbc30c0 100644 --- a/src/poke_env/environment/abstract_battle.py +++ b/src/poke_env/environment/abstract_battle.py @@ -716,10 +716,16 @@ def parse_message(self, split_message: List[str]): item = event[3] self.get_pokemon(pickpocket).item = to_id_str(item) - self.get_pokemon(pickpocket).ability = to_id_str( - cause.replace("[from] ability: ", "") - ) + self.get_pokemon(pickpocket).ability = to_id_str("pickpocket") self.get_pokemon(pickpocketed).item = None + elif cause == "[from] ability: Magician": + magician = event[2] + victim = event[5].replace("[of] ", "") + item = event[3] + + self.get_pokemon(magician).item = to_id_str(item) + self.get_pokemon(magician).ability = to_id_str("magician") + self.get_pokemon(victim).item = None elif cause in {"[from] move: Thief"}: thief = event[2] victim = event[5]