Adjusts aurora veil test, minor tweaks to reflect and lightscreen tests

This commit is contained in:
Christopher Schmidt 2025-03-02 22:28:56 -05:00
parent e3c0ac8238
commit 60c4995e74
3 changed files with 36 additions and 7 deletions

View File

@ -1,7 +1,7 @@
import type BattleScene from "#app/battle-scene";
import { ArenaTagSide } from "#app/data/arena-tag";
import type Move from "#app/data/move";
import { allMoves } from "#app/data/move";
import { allMoves, CritOnlyAttr } from "#app/data/move";
import { ArenaTagType } from "#app/enums/arena-tag-type";
import type Pokemon from "#app/field/pokemon";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
@ -12,7 +12,7 @@ import { Species } from "#enums/species";
import { WeatherType } from "#enums/weather-type";
import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
let globalScene: BattleScene;
@ -47,7 +47,7 @@ describe("Moves - Aurora Veil", () => {
it("reduces damage of physical attacks by half in a single battle", async () => {
const moveToUse = Moves.TACKLE;
await game.startBattle([ Species.SHUCKLE ]);
await game.classicMode.startBattle([ Species.SHUCKLE ]);
game.move.select(moveToUse);
@ -61,7 +61,7 @@ describe("Moves - Aurora Veil", () => {
game.override.battleType("double");
const moveToUse = Moves.ROCK_SLIDE;
await game.startBattle([ Species.SHUCKLE, Species.SHUCKLE ]);
await game.classicMode.startBattle([ Species.SHUCKLE, Species.SHUCKLE ]);
game.move.select(moveToUse);
game.move.select(moveToUse, 1);
@ -74,7 +74,7 @@ describe("Moves - Aurora Veil", () => {
it("reduces damage of special attacks by half in a single battle", async () => {
const moveToUse = Moves.ABSORB;
await game.startBattle([ Species.SHUCKLE ]);
await game.classicMode.startBattle([ Species.SHUCKLE ]);
game.move.select(moveToUse);
@ -89,7 +89,7 @@ describe("Moves - Aurora Veil", () => {
game.override.battleType("double");
const moveToUse = Moves.DAZZLING_GLEAM;
await game.startBattle([ Species.SHUCKLE, Species.SHUCKLE ]);
await game.classicMode.startBattle([ Species.SHUCKLE, Species.SHUCKLE ]);
game.move.select(moveToUse);
game.move.select(moveToUse, 1);
@ -99,6 +99,31 @@ describe("Moves - Aurora Veil", () => {
expect(mockedDmg).toBe(allMoves[moveToUse].power * doubleBattleMultiplier);
});
it("does not affect physical critical hits", async () => {
game.override.moveset([ Moves.WICKED_BLOW ]);
const moveToUse = Moves.WICKED_BLOW;
await game.classicMode.startBattle([ Species.SHUCKLE ]);
game.move.select(moveToUse);
await game.phaseInterceptor.to(TurnEndPhase);
const mockedDmg = getMockedMoveDamage(game.scene.getEnemyPokemon()!, game.scene.getPlayerPokemon()!, allMoves[moveToUse]);
expect(mockedDmg).toBe(allMoves[moveToUse].power);
});
it("does not affect critical hits", async () => {
game.override.moveset([ Moves.FROST_BREATH ]);
const moveToUse = Moves.FROST_BREATH;
vi.spyOn(allMoves[Moves.FROST_BREATH], "accuracy", "get").mockReturnValue(100);
await game.classicMode.startBattle([ Species.SHUCKLE ]);
game.move.select(moveToUse);
await game.phaseInterceptor.to(TurnEndPhase);
const mockedDmg = getMockedMoveDamage(game.scene.getEnemyPokemon()!, game.scene.getPlayerPokemon()!, allMoves[moveToUse]);
expect(mockedDmg).toBe(allMoves[moveToUse].power);
});
});
/**
@ -115,7 +140,9 @@ const getMockedMoveDamage = (defender: Pokemon, attacker: Pokemon, move: Move) =
const side = defender.isPlayer() ? ArenaTagSide.PLAYER : ArenaTagSide.ENEMY;
if (globalScene.arena.getTagOnSide(ArenaTagType.AURORA_VEIL, side)) {
globalScene.arena.applyTagsForSide(ArenaTagType.AURORA_VEIL, side, false, attacker, move.category, multiplierHolder);
if (move.getAttrs(CritOnlyAttr).length === 0) {
globalScene.arena.applyTagsForSide(ArenaTagType.AURORA_VEIL, side, false, attacker, move.category, multiplierHolder);
}
}
return move.power * multiplierHolder.value;

View File

@ -84,6 +84,7 @@ describe("Moves - Light Screen", () => {
});
it("does not affect critical hits", async () => {
game.override.moveset([ Moves.FROST_BREATH ]);
const moveToUse = Moves.FROST_BREATH;
vi.spyOn(allMoves[Moves.FROST_BREATH], "accuracy", "get").mockReturnValue(100);
await game.classicMode.startBattle([ Species.SHUCKLE ]);

View File

@ -84,6 +84,7 @@ describe("Moves - Reflect", () => {
});
it("does not affect critical hits", async () => {
game.override.moveset([ Moves.WICKED_BLOW ]);
const moveToUse = Moves.WICKED_BLOW;
await game.classicMode.startBattle([ Species.SHUCKLE ]);