diff --git a/src/data/ability.ts b/src/data/ability.ts index 38508f31902..383d8fb1af8 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -3260,6 +3260,9 @@ function calculateSleepDamage(pokemon: Pokemon): number { damageTaken += Utils.toDmgValue(pokemon.getMaxHp() / 8); } } + if (pokemon.getTag(BattlerTagType.NIGHTMARE)) { + damageTaken += Utils.toDmgValue(pokemon.getMaxHp() / 4); + } return damageTaken; } diff --git a/src/test/abilities/wimp_out.test.ts b/src/test/abilities/wimp_out.test.ts index 3e5ebcc3b70..6c3eae32924 100644 --- a/src/test/abilities/wimp_out.test.ts +++ b/src/test/abilities/wimp_out.test.ts @@ -651,4 +651,28 @@ describe("Abilities - Wimp Out", () => { expect(game.phaseInterceptor.log).not.toContain("MovePhase"); expect(game.phaseInterceptor.log).toContain("BattleEndPhase"); }); + it("Wimp Out will activate due to Nightmare", async () => { + // arrange + game.override + .moveset([ Moves.SPLASH ]) + .enemyMoveset([ Moves.NIGHTMARE ]) + .statusEffect(StatusEffect.SLEEP); + await game.startBattle([ + Species.WIMPOD, + Species.TYRUNT + ]); + const playerHp = game.scene.getPlayerPokemon()!.hp; + game.scene.getPlayerPokemon()!.hp = playerHp * 0.65; + + // act + game.move.select(Moves.NIGHTMARE); + game.doSelectPartyPokemon(1); + await game.toNextTurn(); + + // assert + expect(game.scene.getParty()[1].getHpRatio()).toBeGreaterThan(0); + expect(game.scene.getParty()[1].getHpRatio()).toBeLessThan(0.5); + expect(game.phaseInterceptor.log).toContain("SwitchSummonPhase"); + expect(game.scene.getPlayerPokemon()!.species.speciesId).toBe(Species.TYRUNT); + }); });