mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-01 05:52:17 +02:00
test added
This commit is contained in:
parent
024b413611
commit
6374f38b11
@ -337,7 +337,7 @@ export class EncounterPhase extends BattlePhase {
|
||||
for (const pokemon of globalScene.getPlayerParty()) {
|
||||
// Only reset wave data, not battle data
|
||||
if (pokemon) {
|
||||
pokemon.resetBattleAndWaveData();
|
||||
pokemon.resetWaveData();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ describe("Abilities - Cud Chew", () => {
|
||||
});
|
||||
|
||||
describe("regurgiates berries", () => {
|
||||
it("re-triggers effects on eater without infinitely looping", async () => {
|
||||
it("re-triggers effects on eater without pushing to array", async () => {
|
||||
const apply = vi.spyOn(RepeatBerryNextTurnAbAttr.prototype, "apply");
|
||||
await game.classicMode.startBattle([Species.FARIGIRAF]);
|
||||
|
||||
@ -198,7 +198,6 @@ describe("Abilities - Cud Chew", () => {
|
||||
await game.toNextTurn();
|
||||
|
||||
// ate 1 sitrus the turn prior, spitball pending
|
||||
expect(farigiraf.battleData.berriesEaten).toEqual([BerryType.SITRUS]);
|
||||
expect(farigiraf.summonData.berriesEatenLast).toEqual([BerryType.SITRUS]);
|
||||
expect(farigiraf.turnData.berriesEaten).toEqual([]);
|
||||
expect(apply.mock.lastCall).toBeUndefined();
|
||||
@ -210,7 +209,6 @@ describe("Abilities - Cud Chew", () => {
|
||||
|
||||
// healed back up to half without adding any more to array
|
||||
expect(farigiraf.hp).toBeGreaterThan(turn1Hp);
|
||||
expect(farigiraf.battleData.berriesEaten).toEqual([BerryType.SITRUS]);
|
||||
expect(farigiraf.summonData.berriesEatenLast).toEqual([]);
|
||||
expect(farigiraf.turnData.berriesEaten).toEqual([]);
|
||||
});
|
||||
|
@ -19,7 +19,7 @@ describe("Abilities - Harvest", () => {
|
||||
const getPlayerBerries = () =>
|
||||
game.scene.getModifiers(BerryModifier, true).filter(b => b.pokemonId === game.scene.getPlayerPokemon()?.id);
|
||||
|
||||
/** Check whether the player's Modifiers contains the specified berries. */
|
||||
/** Check whether the player's Modifiers contains the specified berries and nothing else. */
|
||||
function expectBerriesContaining(...berries: ModifierOverride[]): void {
|
||||
const actualBerries: ModifierOverride[] = getPlayerBerries().map(
|
||||
// only grab berry type and quantity since that's literally all we care about
|
||||
@ -145,40 +145,29 @@ describe("Abilities - Harvest", () => {
|
||||
expect(regielekiReloaded.battleData.berriesEaten).toEqual([BerryType.PETAYA]);
|
||||
});
|
||||
|
||||
it("cannot restore capped berries, even if an ally has one under cap", async () => {
|
||||
it("cannot restore capped berries", async () => {
|
||||
const initBerries: ModifierOverride[] = [
|
||||
{ name: "BERRY", type: BerryType.LUM, count: 2 },
|
||||
{ name: "BERRY", type: BerryType.STARF, count: 2 },
|
||||
];
|
||||
game.override.startingHeldItems(initBerries);
|
||||
await game.classicMode.startBattle([Species.FEEBAS, Species.BELLOSSOM]);
|
||||
await game.classicMode.startBattle([Species.FEEBAS]);
|
||||
|
||||
const [feebas, bellossom] = game.scene.getPlayerParty();
|
||||
const feebas = game.scene.getPlayerPokemon()!;
|
||||
feebas.battleData.berriesEaten = [BerryType.LUM, BerryType.STARF];
|
||||
|
||||
// get rid of bellossom's modifiers and add a sitrus
|
||||
await game.scene.removePartyMemberModifiers(1);
|
||||
const newMod = game.scene
|
||||
.getModifiers(BerryModifier, true)
|
||||
.find(b => b.berryType === BerryType.SITRUS)
|
||||
?.clone()!;
|
||||
expect(newMod).toBeDefined();
|
||||
newMod.pokemonId = bellossom.id;
|
||||
game.scene.addModifier(newMod, true);
|
||||
|
||||
game.move.select(Moves.SPLASH);
|
||||
await game.forceEnemyMove(Moves.SPLASH);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
// Force RNG roll to hit the first berry we find.
|
||||
// Force RNG roll to hit the first berry we find that matches.
|
||||
// This does nothing on a success (since there'd only be a starf left to grab),
|
||||
// but ensures we don't accidentally let any false positives through.
|
||||
vi.spyOn(Phaser.Math.RND, "integerInRange").mockReturnValue(0);
|
||||
await game.phaseInterceptor.to("TurnEndPhase");
|
||||
|
||||
// recovered a starf,
|
||||
// recovered a starf
|
||||
expectBerriesContaining({ name: "BERRY", type: BerryType.STARF, count: 3 });
|
||||
expect(game.scene.getModifiers(BerryModifier, true).filter(b => b.pokemonId === bellossom.id)).toHaveLength(0);
|
||||
});
|
||||
|
||||
it("does nothing if all berries are capped", async () => {
|
||||
|
@ -137,7 +137,7 @@ describe("Moves - Rage Fist", () => {
|
||||
expect(ironHands.battleData.hitCount).toBe(0);
|
||||
});
|
||||
|
||||
it("should reset the hitRecCounter if we enter new biome", async () => {
|
||||
it("should reset hits recieved before new biome", async () => {
|
||||
game.override.enemySpecies(Species.MAGIKARP).startingWave(10);
|
||||
|
||||
await game.classicMode.startBattle([Species.MAGIKARP]);
|
||||
@ -153,7 +153,7 @@ describe("Moves - Rage Fist", () => {
|
||||
expect(move.calculateBattlePower).toHaveLastReturnedWith(150);
|
||||
});
|
||||
|
||||
it("should not reset the hitRecCounter if switched out", async () => {
|
||||
it("should not reset if switched out or on reload", async () => {
|
||||
game.override.enemyMoveset(Moves.TACKLE);
|
||||
|
||||
const getPartyHitCount = () =>
|
||||
@ -188,5 +188,14 @@ describe("Moves - Rage Fist", () => {
|
||||
expect(charizard).toBeDefined();
|
||||
expect(charizard.species.speciesId).toBe(Species.CHARIZARD);
|
||||
expect(move.calculateBattlePower).toHaveLastReturnedWith(150);
|
||||
|
||||
// go to new wave, reload game and beat up another poor sap
|
||||
await game.toNextWave();
|
||||
|
||||
await game.reload.reloadSession();
|
||||
|
||||
game.move.select(Moves.RAGE_FIST);
|
||||
await game.phaseInterceptor.to("MoveEndPhase");
|
||||
expect(move.calculateBattlePower).toHaveLastReturnedWith(250);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user