diff --git a/fp/battle_modifier.py b/fp/battle_modifier.py index cbcb3322..952fb60f 100644 --- a/fp/battle_modifier.py +++ b/fp/battle_modifier.py @@ -724,7 +724,8 @@ def move(battle, split_msg): ) ) return - elif "[from]" in split_msg[-1] and split_msg[-1] != "[from]lockedmove": + + elif any("[from]" in msg and msg != "[from]lockedmove" for msg in split_msg): return if "destinybond" in pkmn.volatile_statuses: diff --git a/tests/test_battle_modifiers.py b/tests/test_battle_modifiers.py index a0501021..21abb03c 100644 --- a/tests/test_battle_modifiers.py +++ b/tests/test_battle_modifiers.py @@ -1452,7 +1452,7 @@ def test_adds_truant_when_slaking_pkmn(self): move(self.battle, split_msg) self.assertIn("truant", self.battle.opponent.active.volatile_statuses) - def test_does_not_set_move_for_magicbounch(self): + def test_does_not_set_move_for_magicbounce(self): split_msg = ["", "move", "p2a: Caterpie", "String Shot", "[from]Magic Bounce"] move(self.battle, split_msg) @@ -1460,6 +1460,22 @@ def test_does_not_set_move_for_magicbounch(self): self.assertNotIn(m, self.battle.opponent.active.moves) + def test_does_not_set_move_for_magicbounce_when_still(self): + # |move|p2a: Espeon|Leech Seed||[from] ability: Magic Bounce|[still] + split_msg = [ + "", + "move", + "p2a: Caterpie", + "String Shot", + "[from]Magic Bounce", + "[still]", + ] + + move(self.battle, split_msg) + m = Move("String Shot") + + self.assertNotIn(m, self.battle.opponent.active.moves) + def test_new_move_has_one_pp_less_than_max(self): split_msg = ["", "move", "p2a: Caterpie", "String Shot"]