[Bug] Fix duplicate FaintPhase if Mimikyu faints to Disguise damage (#3686)

* Fix duplicate `FaintPhase` if Mimikyu faints to Disguise damage

* Add regression test
This commit is contained in:
NightKev 2024-08-23 22:04:49 -07:00 committed by GitHub
parent 1813009443
commit 41a0dfe192
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 1 deletions

View File

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

View File

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