From 5ce3d66b865cad623752d4b168b4e2c0acaadbfc Mon Sep 17 00:00:00 2001 From: pmariglia Date: Tue, 14 Jan 2025 22:47:50 -0500 Subject: [PATCH] zoroark inferral edge case: don't infer if futuresight is ending dark pokemon can be immune to futuresight --- fp/battle_modifier.py | 2 ++ tests/test_battle_modifiers.py | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/fp/battle_modifier.py b/fp/battle_modifier.py index f3f58821..b664cd67 100644 --- a/fp/battle_modifier.py +++ b/fp/battle_modifier.py @@ -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 @@ -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 diff --git a/tests/test_battle_modifiers.py b/tests/test_battle_modifiers.py index 46b66e92..3ffc2121 100644 --- a/tests/test_battle_modifiers.py +++ b/tests/test_battle_modifiers.py @@ -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"