Added nightmare interaction to Wimp Out following bug fix

This commit is contained in:
muscode13 2024-10-21 21:56:01 -06:00
parent 82a6385e35
commit cce3818690
2 changed files with 27 additions and 0 deletions

View File

@ -3260,6 +3260,9 @@ function calculateSleepDamage(pokemon: Pokemon): number {
damageTaken += Utils.toDmgValue(pokemon.getMaxHp() / 8); damageTaken += Utils.toDmgValue(pokemon.getMaxHp() / 8);
} }
} }
if (pokemon.getTag(BattlerTagType.NIGHTMARE)) {
damageTaken += Utils.toDmgValue(pokemon.getMaxHp() / 4);
}
return damageTaken; return damageTaken;
} }

View File

@ -651,4 +651,28 @@ describe("Abilities - Wimp Out", () => {
expect(game.phaseInterceptor.log).not.toContain("MovePhase"); expect(game.phaseInterceptor.log).not.toContain("MovePhase");
expect(game.phaseInterceptor.log).toContain("BattleEndPhase"); 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);
});
}); });