[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:
parent
1813009443
commit
41a0dfe192
|
@ -4243,7 +4243,7 @@ export class FormBlockDamageAbAttr extends ReceivedMoveDamageMultiplierAbAttr {
|
||||||
(args[0] as Utils.NumberHolder).value = this.multiplier;
|
(args[0] as Utils.NumberHolder).value = this.multiplier;
|
||||||
pokemon.removeTag(this.tagType);
|
pokemon.removeTag(this.tagType);
|
||||||
if (this.recoilDamageFunc) {
|
if (this.recoilDamageFunc) {
|
||||||
pokemon.damageAndUpdate(this.recoilDamageFunc(pokemon), HitResult.OTHER);
|
pokemon.damageAndUpdate(this.recoilDamageFunc(pokemon), HitResult.OTHER, false, false, true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -207,4 +207,18 @@ describe("Abilities - Disguise", () => {
|
||||||
|
|
||||||
expect(mimikyu1.formIndex).toBe(disguisedForm);
|
expect(mimikyu1.formIndex).toBe(disguisedForm);
|
||||||
}, TIMEOUT);
|
}, 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);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue