Skip to content

Commit

Permalink
[Unittest] Remove random berry effects from PBond tests (pagefaultgam…
Browse files Browse the repository at this point in the history
  • Loading branch information
innerthunder authored Jun 30, 2024
1 parent d278df8 commit 284c3c6
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/test/abilities/parental_bond.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Species } from "#enums/species";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { getMovePosition } from "../utils/gameManagerUtils";
import { CommandPhase, DamagePhase, MoveEffectPhase, MoveEndPhase, TurnEndPhase } from "#app/phases.js";
import { BerryPhase, CommandPhase, DamagePhase, MoveEffectPhase, MoveEndPhase, TurnEndPhase } from "#app/phases.js";
import { BattleStat } from "#app/data/battle-stat.js";
import { Type } from "#app/data/type.js";
import { BattlerTagType } from "#app/enums/battler-tag-type.js";
Expand Down Expand Up @@ -63,7 +63,7 @@ describe("Abilities - Parental Bond", () => {
const firstStrikeDamage = enemyStartingHp - enemyPokemon.hp;
enemyStartingHp = enemyPokemon.hp;

await game.phaseInterceptor.to(TurnEndPhase, false);
await game.phaseInterceptor.to(BerryPhase, false);

const secondStrikeDamage = enemyStartingHp - enemyPokemon.hp;

Expand All @@ -88,7 +88,7 @@ describe("Abilities - Parental Bond", () => {

game.doAttack(getMovePosition(game.scene, 0, Moves.POWER_UP_PUNCH));

await game.phaseInterceptor.to(TurnEndPhase, false);
await game.phaseInterceptor.to(BerryPhase, false);

expect(leadPokemon.turnData.hitCount).toBe(2);
expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(2);
Expand All @@ -109,7 +109,7 @@ describe("Abilities - Parental Bond", () => {
expect(enemyPokemon).not.toBe(undefined);

game.doAttack(getMovePosition(game.scene, 0, Moves.BABY_DOLL_EYES));
await game.phaseInterceptor.to(TurnEndPhase, false);
await game.phaseInterceptor.to(BerryPhase, false);

expect(enemyPokemon.summonData.battleStats[BattleStat.ATK]).toBe(-1);
}, TIMEOUT
Expand All @@ -134,7 +134,7 @@ describe("Abilities - Parental Bond", () => {

vi.spyOn(game.scene.getCurrentPhase() as MoveEffectPhase, "hitCheck").mockReturnValue(true);

await game.phaseInterceptor.to(TurnEndPhase, false);
await game.phaseInterceptor.to(BerryPhase, false);

expect(leadPokemon.turnData.hitCount).toBe(2);
}, TIMEOUT
Expand Down Expand Up @@ -201,7 +201,7 @@ describe("Abilities - Parental Bond", () => {
const enemyStartingHp = enemyPokemon.hp;

game.doAttack(getMovePosition(game.scene, 0, Moves.DRAGON_RAGE));
await game.phaseInterceptor.to(TurnEndPhase, false);
await game.phaseInterceptor.to(BerryPhase, false);

expect(enemyPokemon.hp).toBe(enemyStartingHp - 80);
}, TIMEOUT
Expand Down Expand Up @@ -229,7 +229,7 @@ describe("Abilities - Parental Bond", () => {

const playerDamage = playerStartingHp - leadPokemon.hp;

await game.phaseInterceptor.to(TurnEndPhase, false);
await game.phaseInterceptor.to(BerryPhase, false);

expect(enemyPokemon.hp).toBe(enemyStartingHp - 4*playerDamage);
}, TIMEOUT
Expand All @@ -256,7 +256,7 @@ describe("Abilities - Parental Bond", () => {
await game.phaseInterceptor.to(CommandPhase);

game.doAttack(getMovePosition(game.scene, 1, Moves.EARTHQUAKE));
await game.phaseInterceptor.to(TurnEndPhase, false);
await game.phaseInterceptor.to(BerryPhase, false);

playerPokemon.forEach(p => expect(p.turnData.hitCount).toBe(1));
}, TIMEOUT
Expand Down Expand Up @@ -302,7 +302,7 @@ describe("Abilities - Parental Bond", () => {
expect(leadPokemon.turnData.hitCount).toBe(2);

// This test will time out if the user faints
await game.phaseInterceptor.to(TurnEndPhase, false);
await game.phaseInterceptor.to(BerryPhase, false);

expect(leadPokemon.hp).toBe(Math.floor(leadPokemon.getMaxHp()/2));
}, TIMEOUT
Expand All @@ -329,7 +329,7 @@ describe("Abilities - Parental Bond", () => {
expect(enemyPokemon.hp).toBeGreaterThan(0);
expect(leadPokemon.isOfType(Type.FIRE)).toBe(true);

await game.phaseInterceptor.to(TurnEndPhase, false);
await game.phaseInterceptor.to(BerryPhase, false);

expect(leadPokemon.isOfType(Type.FIRE)).toBe(false);
}, TIMEOUT
Expand Down Expand Up @@ -560,7 +560,7 @@ describe("Abilities - Parental Bond", () => {
expect(leadPokemon.turnData.hitCount).toBe(2);
expect(enemyPokemon.status?.effect).toBe(StatusEffect.SLEEP);

await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to(BerryPhase, false);

expect(enemyPokemon.status?.effect).toBeUndefined();
}, TIMEOUT
Expand All @@ -582,7 +582,7 @@ describe("Abilities - Parental Bond", () => {

game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));

await game.phaseInterceptor.to(TurnEndPhase, false);
await game.phaseInterceptor.to(BerryPhase, false);

expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(-1);
}, TIMEOUT
Expand All @@ -604,7 +604,7 @@ describe("Abilities - Parental Bond", () => {

game.doAttack(getMovePosition(game.scene, 0, Moves.WATER_GUN));

await game.phaseInterceptor.to(TurnEndPhase, false);
await game.phaseInterceptor.to(BerryPhase, false);

expect(enemyPokemon.summonData.battleStats[BattleStat.SPATK]).toBe(1);
}, TIMEOUT
Expand Down Expand Up @@ -641,7 +641,7 @@ describe("Abilities - Parental Bond", () => {
await game.phaseInterceptor.to(DamagePhase);
const enemyFirstHitDamage = enemyStartingHp.map((hp, i) => hp - enemyPokemon[i].hp);

await game.phaseInterceptor.to(TurnEndPhase, false);
await game.phaseInterceptor.to(BerryPhase, false);

enemyPokemon.forEach((p, i) => expect(enemyStartingHp[i] - p.hp).toBe(2*enemyFirstHitDamage[i]));

Expand Down

0 comments on commit 284c3c6

Please sign in to comment.