From 0d1dacbc7ab619f409db258d7405a9e87b237610 Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Mon, 3 Feb 2025 22:21:49 -0600 Subject: [PATCH] [Bug] Fix softlock caused by shields down preventing faint status (#5252) --- src/data/ability.ts | 2 +- src/test/abilities/shields_down.test.ts | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index 8f0698e38b9..2c5d6949a67 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -2861,7 +2861,7 @@ export class PreSetStatusEffectImmunityAbAttr extends PreSetStatusAbAttr { * @returns A boolean indicating the result of the status application. */ applyPreSetStatus(pokemon: Pokemon, passive: boolean, simulated: boolean, effect: StatusEffect, cancelled: Utils.BooleanHolder, args: any[]): boolean { - if (this.immuneEffects.length < 1 || this.immuneEffects.includes(effect)) { + if (effect !== StatusEffect.FAINT && this.immuneEffects.length < 1 || this.immuneEffects.includes(effect)) { cancelled.value = true; return true; } diff --git a/src/test/abilities/shields_down.test.ts b/src/test/abilities/shields_down.test.ts index 6ffc28c37ab..ca6d945824e 100644 --- a/src/test/abilities/shields_down.test.ts +++ b/src/test/abilities/shields_down.test.ts @@ -189,4 +189,19 @@ describe("Abilities - SHIELDS DOWN", () => { } ); + test("should not prevent minior from receiving the fainted status effect in trainer battles", async () => { + game.override.enemyMoveset([ Moves.TACKLE ]); + game.override.moveset([ Moves.THUNDERBOLT ]); + game.override.startingLevel(100); + game.override.startingWave(5); + game.override.enemySpecies(Species.MINIOR); + await game.classicMode.startBattle([ Species.REGIELEKI ]); + const minior = game.scene.getEnemyPokemon()!; + + game.move.select(Moves.THUNDERBOLT); + await game.toNextTurn(); + expect(minior.isFainted()).toBe(true); + expect(minior.status?.effect).toBe(StatusEffect.FAINT); + }); + });