[Test] Update tests to enable no-crits override (#2971)
* Update tests to enable no-crits override * Rename variable maxHP to initialHP
This commit is contained in:
parent
d57a7c91af
commit
1965f2b147
|
@ -25,6 +25,7 @@ describe("Abilities - Dry Skin", () => {
|
|||
beforeEach(() => {
|
||||
game = new GameManager(phaserGame);
|
||||
vi.spyOn(overrides, "SINGLE_BATTLE_OVERRIDE", "get").mockReturnValue(true);
|
||||
vi.spyOn(overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true);
|
||||
vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.DRY_SKIN);
|
||||
vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]);
|
||||
vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.CHARMANDER);
|
||||
|
@ -77,30 +78,28 @@ describe("Abilities - Dry Skin", () => {
|
|||
});
|
||||
|
||||
it("opposing fire attacks do 25% more damage", async () => {
|
||||
vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.EMBER]);
|
||||
|
||||
// ensure the enemy doesn't die to this
|
||||
vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(30);
|
||||
vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.FLAMETHROWER]);
|
||||
|
||||
await game.startBattle();
|
||||
|
||||
const enemy = game.scene.getEnemyPokemon();
|
||||
expect(enemy).not.toBe(undefined);
|
||||
expect(enemy).toBeDefined();
|
||||
const initialHP = 1000;
|
||||
enemy.hp = initialHP;
|
||||
|
||||
// first turn
|
||||
vi.spyOn(game.scene, "randBattleSeedInt").mockReturnValue(0); // this makes moves always deal 85% damage
|
||||
game.doAttack(getMovePosition(game.scene, 0, Moves.EMBER));
|
||||
game.doAttack(getMovePosition(game.scene, 0, Moves.FLAMETHROWER));
|
||||
await game.phaseInterceptor.to(TurnEndPhase);
|
||||
const fireDamageTakenWithDrySkin = enemy.getMaxHp() - enemy.hp;
|
||||
const fireDamageTakenWithDrySkin = initialHP - enemy.hp;
|
||||
|
||||
expect(enemy.hp > 0);
|
||||
enemy.hp = enemy.getMaxHp();
|
||||
enemy.hp = initialHP;
|
||||
vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE);
|
||||
|
||||
// second turn
|
||||
game.doAttack(getMovePosition(game.scene, 0, Moves.EMBER));
|
||||
game.doAttack(getMovePosition(game.scene, 0, Moves.FLAMETHROWER));
|
||||
await game.phaseInterceptor.to(TurnEndPhase);
|
||||
const fireDamageTakenWithoutDrySkin = enemy.getMaxHp() - enemy.hp;
|
||||
const fireDamageTakenWithoutDrySkin = initialHP - enemy.hp;
|
||||
|
||||
expect(fireDamageTakenWithDrySkin).toBeGreaterThan(fireDamageTakenWithoutDrySkin);
|
||||
});
|
||||
|
|
|
@ -31,6 +31,7 @@ describe("Abilities - Parental Bond", () => {
|
|||
beforeEach(() => {
|
||||
game = new GameManager(phaserGame);
|
||||
vi.spyOn(Overrides, "SINGLE_BATTLE_OVERRIDE", "get").mockReturnValue(true);
|
||||
vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true);
|
||||
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.PARENTAL_BOND);
|
||||
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX);
|
||||
vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA);
|
||||
|
@ -57,7 +58,6 @@ describe("Abilities - Parental Bond", () => {
|
|||
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
|
||||
|
||||
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
||||
vi.spyOn(game.scene, "randBattleSeedInt").mockReturnValue(15);
|
||||
|
||||
await game.phaseInterceptor.to(DamagePhase);
|
||||
const firstStrikeDamage = enemyStartingHp - enemyPokemon.hp;
|
||||
|
@ -636,7 +636,6 @@ describe("Abilities - Parental Bond", () => {
|
|||
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
|
||||
|
||||
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
||||
vi.spyOn(game.scene, "randBattleSeedInt").mockReturnValue(15);
|
||||
|
||||
await game.phaseInterceptor.to(DamagePhase);
|
||||
const enemyFirstHitDamage = enemyStartingHp.map((hp, i) => hp - enemyPokemon[i].hp);
|
||||
|
|
Loading…
Reference in New Issue