[Bug] Fix softlock caused by shields down preventing faint status (#5252)

This commit is contained in:
Sirz Benjie 2025-02-03 22:21:49 -06:00 committed by GitHub
parent 91a4333e96
commit 0d1dacbc7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 1 deletions

View File

@ -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;
}

View File

@ -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);
});
});