[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(() => {
|
beforeEach(() => {
|
||||||
game = new GameManager(phaserGame);
|
game = new GameManager(phaserGame);
|
||||||
vi.spyOn(overrides, "SINGLE_BATTLE_OVERRIDE", "get").mockReturnValue(true);
|
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_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_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]);
|
||||||
vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.CHARMANDER);
|
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 () => {
|
it("opposing fire attacks do 25% more damage", async () => {
|
||||||
vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.EMBER]);
|
vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.FLAMETHROWER]);
|
||||||
|
|
||||||
// ensure the enemy doesn't die to this
|
|
||||||
vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(30);
|
|
||||||
|
|
||||||
await game.startBattle();
|
await game.startBattle();
|
||||||
|
|
||||||
const enemy = game.scene.getEnemyPokemon();
|
const enemy = game.scene.getEnemyPokemon();
|
||||||
expect(enemy).not.toBe(undefined);
|
expect(enemy).toBeDefined();
|
||||||
|
const initialHP = 1000;
|
||||||
|
enemy.hp = initialHP;
|
||||||
|
|
||||||
// first turn
|
// first turn
|
||||||
vi.spyOn(game.scene, "randBattleSeedInt").mockReturnValue(0); // this makes moves always deal 85% damage
|
game.doAttack(getMovePosition(game.scene, 0, Moves.FLAMETHROWER));
|
||||||
game.doAttack(getMovePosition(game.scene, 0, Moves.EMBER));
|
|
||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
await game.phaseInterceptor.to(TurnEndPhase);
|
||||||
const fireDamageTakenWithDrySkin = enemy.getMaxHp() - enemy.hp;
|
const fireDamageTakenWithDrySkin = initialHP - enemy.hp;
|
||||||
|
|
||||||
expect(enemy.hp > 0);
|
expect(enemy.hp > 0);
|
||||||
enemy.hp = enemy.getMaxHp();
|
enemy.hp = initialHP;
|
||||||
vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE);
|
vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE);
|
||||||
|
|
||||||
// second turn
|
// second turn
|
||||||
game.doAttack(getMovePosition(game.scene, 0, Moves.EMBER));
|
game.doAttack(getMovePosition(game.scene, 0, Moves.FLAMETHROWER));
|
||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
await game.phaseInterceptor.to(TurnEndPhase);
|
||||||
const fireDamageTakenWithoutDrySkin = enemy.getMaxHp() - enemy.hp;
|
const fireDamageTakenWithoutDrySkin = initialHP - enemy.hp;
|
||||||
|
|
||||||
expect(fireDamageTakenWithDrySkin).toBeGreaterThan(fireDamageTakenWithoutDrySkin);
|
expect(fireDamageTakenWithDrySkin).toBeGreaterThan(fireDamageTakenWithoutDrySkin);
|
||||||
});
|
});
|
||||||
|
|
|
@ -31,6 +31,7 @@ describe("Abilities - Parental Bond", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
game = new GameManager(phaserGame);
|
game = new GameManager(phaserGame);
|
||||||
vi.spyOn(Overrides, "SINGLE_BATTLE_OVERRIDE", "get").mockReturnValue(true);
|
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, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.PARENTAL_BOND);
|
||||||
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX);
|
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX);
|
||||||
vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA);
|
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));
|
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
|
||||||
|
|
||||||
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
||||||
vi.spyOn(game.scene, "randBattleSeedInt").mockReturnValue(15);
|
|
||||||
|
|
||||||
await game.phaseInterceptor.to(DamagePhase);
|
await game.phaseInterceptor.to(DamagePhase);
|
||||||
const firstStrikeDamage = enemyStartingHp - enemyPokemon.hp;
|
const firstStrikeDamage = enemyStartingHp - enemyPokemon.hp;
|
||||||
|
@ -636,7 +636,6 @@ describe("Abilities - Parental Bond", () => {
|
||||||
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
|
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
|
||||||
|
|
||||||
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
||||||
vi.spyOn(game.scene, "randBattleSeedInt").mockReturnValue(15);
|
|
||||||
|
|
||||||
await game.phaseInterceptor.to(DamagePhase);
|
await game.phaseInterceptor.to(DamagePhase);
|
||||||
const enemyFirstHitDamage = enemyStartingHp.map((hp, i) => hp - enemyPokemon[i].hp);
|
const enemyFirstHitDamage = enemyStartingHp.map((hp, i) => hp - enemyPokemon[i].hp);
|
||||||
|
|
Loading…
Reference in New Issue