Skip to content

Commit

Permalink
zoroark inferral edge case: don't infer if futuresight is ending
Browse files Browse the repository at this point in the history
dark pokemon can be immune to futuresight
  • Loading branch information
pmariglia committed Jan 15, 2025
1 parent e61edf1 commit 5ce3d66
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fp/battle_modifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -1408,6 +1408,7 @@ def immune(battle, split_msg):
)
== 0
and "from" not in split_msg[-1]
and battle.user.future_sight[0] != 1
):
# check if pkmn has terastallized and gained immunity
# exit if it has
Expand Down Expand Up @@ -1440,6 +1441,7 @@ def immune(battle, split_msg):
)
!= 0
and "from" not in split_msg[-1]
and battle.user.future_sight[0] != 1
):
# check if pkmn has terastallized and gained immunity
# exit if it has
Expand Down
20 changes: 20 additions & 0 deletions tests/test_battle_modifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4982,6 +4982,26 @@ def test_does_not_infer_zoroark_if_pkmn_naturally_immune(self):
self.assertEqual("urshifu", self.battle.opponent.active.name)
self.assertEqual(0, len(self.battle.opponent.reserve))

def test_does_not_infer_zoroark_if_futuresight_ending(self):
self.battle.battle_type = constants.RANDOM_BATTLE
self.battle.generation = "gen9"
RandomBattleTeamDatasets.initialize("gen9")
self.battle.opponent.reserve = []

self.battle.opponent.active = Pokemon("Urshifu", 100)
self.battle.user.future_sight = (1, "weedle")

self.battle.user.last_used_move = LastUsedMove("weedle", "tackle", 0)
split_msg = [
"",
"-immune",
"p2a: Urshifu",
]
immune(self.battle, split_msg)

self.assertEqual("urshifu", self.battle.opponent.active.name)
self.assertEqual(0, len(self.battle.opponent.reserve))

def test_infers_zoroark_from_immunity_that_pkmn_does_not_have(self):
self.battle.battle_type = constants.BATTLE_FACTORY
self.battle.generation = "gen9"
Expand Down

0 comments on commit 5ce3d66

Please sign in to comment.