From 41a0dfe192f410e9dbc9fadab672ebf2f1135216 Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Fri, 23 Aug 2024 22:04:49 -0700 Subject: [PATCH] [Bug] Fix duplicate `FaintPhase` if Mimikyu faints to Disguise damage (#3686) * Fix duplicate `FaintPhase` if Mimikyu faints to Disguise damage * Add regression test --- src/data/ability.ts | 2 +- src/test/abilities/disguise.test.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index 75b828ca0db..022e2df0502 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -4243,7 +4243,7 @@ export class FormBlockDamageAbAttr extends ReceivedMoveDamageMultiplierAbAttr { (args[0] as Utils.NumberHolder).value = this.multiplier; pokemon.removeTag(this.tagType); if (this.recoilDamageFunc) { - pokemon.damageAndUpdate(this.recoilDamageFunc(pokemon), HitResult.OTHER); + pokemon.damageAndUpdate(this.recoilDamageFunc(pokemon), HitResult.OTHER, false, false, true, true); } } return true; diff --git a/src/test/abilities/disguise.test.ts b/src/test/abilities/disguise.test.ts index 58087b408a5..1094dc71a2d 100644 --- a/src/test/abilities/disguise.test.ts +++ b/src/test/abilities/disguise.test.ts @@ -207,4 +207,18 @@ describe("Abilities - Disguise", () => { expect(mimikyu1.formIndex).toBe(disguisedForm); }, TIMEOUT); + + it("doesn't faint twice when fainting due to Disguise break damage, nor prevent faint from Disguise break damage if using Endure", async () => { + game.override.enemyMoveset(Array(4).fill(Moves.ENDURE)); + await game.startBattle(); + + const mimikyu = game.scene.getEnemyPokemon()!; + mimikyu.hp = 1; + + game.doAttack(getMovePosition(game.scene, 0, Moves.SHADOW_SNEAK)); + await game.toNextWave(); + + expect(game.scene.getCurrentPhase()?.constructor.name).toBe("CommandPhase"); + expect(game.scene.currentBattle.waveIndex).toBe(2); + }, TIMEOUT); });