From 74ea358f180a0df6a38486aa9bc8533f0fe53277 Mon Sep 17 00:00:00 2001 From: Lneacx Date: Thu, 3 Oct 2024 20:45:53 -0700 Subject: [PATCH] [Beta] Fix hit check so Poison-types do not brick semi-invuln. (#4567) --- src/phases/move-effect-phase.ts | 2 +- src/test/moves/toxic.test.ts | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/phases/move-effect-phase.ts b/src/phases/move-effect-phase.ts index 33f2394cd1e..7730a32eaa2 100644 --- a/src/phases/move-effect-phase.ts +++ b/src/phases/move-effect-phase.ts @@ -407,7 +407,7 @@ export class MoveEffectPhase extends PokemonPhase { const semiInvulnerableTag = target.getTag(SemiInvulnerableTag); if (semiInvulnerableTag && !this.move.getMove().getAttrs(HitsTagAttr).some(hta => hta.tagType === semiInvulnerableTag.tagType) - && !(this.move.getMove().getAttrs(ToxicAccuracyAttr) && user.isOfType(Type.POISON)) + && !(this.move.getMove().hasAttr(ToxicAccuracyAttr) && user.isOfType(Type.POISON)) ) { return false; } diff --git a/src/test/moves/toxic.test.ts b/src/test/moves/toxic.test.ts index 2d023c201c1..bfc41c8c92d 100644 --- a/src/test/moves/toxic.test.ts +++ b/src/test/moves/toxic.test.ts @@ -73,4 +73,17 @@ describe("Moves - Toxic", () => { expect(game.scene.getEnemyPokemon()!.status).toBeUndefined(); }); + + it("moves other than Toxic should not hit semi-invulnerable targets even if user is Poison-type", async () => { + game.override.moveset(Moves.SWIFT); + game.override.enemyMoveset(Moves.FLY); + await game.classicMode.startBattle([Species.TOXAPEX]); + + game.move.select(Moves.SWIFT); + await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]); + await game.phaseInterceptor.to("BerryPhase", false); + + const enemyPokemon = game.scene.getEnemyPokemon()!; + expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp()); + }); });