Skip to content

Commit

Permalink
dont parse move if any value in the split_msg has [from], not just th…
Browse files Browse the repository at this point in the history
…e last item
  • Loading branch information
pmariglia committed Feb 1, 2025
1 parent 006bc4c commit c47f0a6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
3 changes: 2 additions & 1 deletion fp/battle_modifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
18 changes: 17 additions & 1 deletion tests/test_battle_modifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1452,14 +1452,30 @@ 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)
m = Move("String Shot")

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"]

Expand Down

0 comments on commit c47f0a6

Please sign in to comment.