This commit is contained in:
Lylian 2024-10-10 18:02:31 +02:00
parent 2557a28796
commit 53fcc10145
1 changed files with 42 additions and 42 deletions

View File

@ -5,40 +5,40 @@ import overrides from "#app/overrides";
import { Species } from "#enums/species";
import { Gender } from "../../data/gender";
import { PokeballType } from "../../data/pokeball";
import {
import {
TurnEndPhase,
} from "#app/phases/turn-end-phase";
import { Moves } from "#enums/moves";
import { Abilities } from "#enums/abilities";
describe("Abilities - Illusion", () => {
describe("Abilities - Illusion", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
} );
} );
});
});
afterEach(() => {
afterEach(() => {
game.phaseInterceptor.restoreOg();
} );
});
beforeEach(() => {
beforeEach(() => {
game = new GameManager(phaserGame);
game.override.battleType("single");
game.override.enemySpecies(Species.ZORUA);
game.override.enemyAbility(Abilities.ILLUSION);
game.override.enemyMoveset([ Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE ] );
game.override.enemyHeldItems([ { name: "WIDE_LENS", count: 3 } ] );
game.override.enemyMoveset([ Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE ]);
game.override.enemyHeldItems([{ name: "WIDE_LENS", count: 3 }]);
game.override.moveset([ Moves.WORRY_SEED, Moves.SOAK, Moves.TACKLE, Moves.TACKLE ] );
game.override.startingHeldItems([ { name: "WIDE_LENS", count: 3 } ] );
} );
game.override.moveset([ Moves.WORRY_SEED, Moves.SOAK, Moves.TACKLE, Moves.TACKLE ]);
game.override.startingHeldItems([{ name: "WIDE_LENS", count: 3 }]);
});
it("creates illusion at the start", async () => {
await game.startBattle([ Species.ZOROARK, Species.AXEW ] );
it("creates illusion at the start", async () => {
await game.startBattle([ Species.ZOROARK, Species.AXEW ]);
const zoroark = game.scene.getPlayerPokemon()!;
const zorua = game.scene.getEnemyPokemon()!;
@ -46,10 +46,10 @@ describe("Abilities - Illusion", () => {
expect(zoroark.illusion.active).equals(true);
expect(zorua.illusion.active).equals(true);
expect(zoroark.illusion.available).equals(false);
} );
});
it("break after receiving damaging move", async () => {
await game.startBattle([ Species.AXEW ] );
it("break after receiving damaging move", async () => {
await game.startBattle([ Species.AXEW ]);
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
@ -57,10 +57,10 @@ describe("Abilities - Illusion", () => {
const zorua = game.scene.getEnemyPokemon()!;
expect(zorua.illusion.active).equals(false);
} );
});
it("break after getting ability changed", async () => {
await game.startBattle([ Species.AXEW ] );
it("break after getting ability changed", async () => {
await game.startBattle([ Species.AXEW ]);
game.move.select(Moves.WORRY_SEED);
await game.phaseInterceptor.to(TurnEndPhase);
@ -68,38 +68,38 @@ describe("Abilities - Illusion", () => {
const zorua = game.scene.getEnemyPokemon()!;
expect(zorua.illusion.active).equals(false);
} );
});
it("break if the ability is suppressed", async () => {
it("break if the ability is suppressed", async () => {
game.override.enemyAbility(Abilities.NEUTRALIZING_GAS);
await game.startBattle([ Species.KOFFING ] );
await game.startBattle([ Species.KOFFING ]);
const zorua = game.scene.getEnemyPokemon()!;
expect(zorua.illusion.active).equals(false);
} );
});
it("trick the enemy AI for moves effectiveness using ILLUSION type instead of actual type", async () => {
game.override.enemyMoveset([ Moves.FLAMETHROWER, Moves.PSYCHIC, Moves.TACKLE, Moves.TACKLE ] );
await game.startBattle([ Species.ZOROARK, Species.AXEW ] );
it("trick the enemy AI for moves effectiveness using ILLUSION type instead of actual type", async () => {
game.override.enemyMoveset([ Moves.FLAMETHROWER, Moves.PSYCHIC, Moves.TACKLE, Moves.TACKLE ]);
await game.startBattle([ Species.ZOROARK, Species.AXEW ]);
const enemy = game.scene.getEnemyPokemon()!;
const zoroark = game.scene.getPlayerPokemon()!;
const flameThrower = enemy.getMoveset()[ 0] !.getMove();
const psychic = enemy.getMoveset()[ 1] !.getMove();
const flameThrower = enemy.getMoveset()[0]!.getMove();
const psychic = enemy.getMoveset()[1]!.getMove();
const flameThrowerEffectiveness = zoroark.getAttackTypeEffectiveness(flameThrower.type, enemy, undefined, undefined, true);
const psychicEffectiveness = zoroark.getAttackTypeEffectiveness(psychic.type, enemy, undefined, undefined, true);
expect(psychicEffectiveness).above(flameThrowerEffectiveness);
} );
});
it("do not breaks if the pokemon takes indirect damages", async () => {
it("do not breaks if the pokemon takes indirect damages", async () => {
game.override.enemySpecies(Species.GIGALITH);
game.override.enemyAbility(Abilities.SAND_STREAM);
game.override.enemyMoveset([ Moves.WILL_O_WISP, Moves.WILL_O_WISP, Moves.WILL_O_WISP, Moves.WILL_O_WISP ] );
game.override.moveset([ Moves.FLARE_BLITZ ] );
game.override.enemyMoveset([ Moves.WILL_O_WISP, Moves.WILL_O_WISP, Moves.WILL_O_WISP, Moves.WILL_O_WISP ]);
game.override.moveset([ Moves.FLARE_BLITZ ]);
await game.startBattle([ Species.ZOROARK, Species.AZUMARILL ] );
await game.startBattle([ Species.ZOROARK, Species.AZUMARILL ]);
game.move.select(Moves.FLARE_BLITZ);
@ -108,12 +108,12 @@ describe("Abilities - Illusion", () => {
const zoroark = game.scene.getPlayerPokemon()!;
expect(zoroark.illusion.active).equals(true);
} );
});
it("copy the the name, the nickname, the gender, the shininess and the pokeball of the pokemon", async () => {
vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.SCARY_FACE, Moves.SCARY_FACE, Moves.SCARY_FACE, Moves.SCARY_FACE ] );
it("copy the the name, the nickname, the gender, the shininess and the pokeball of the pokemon", async () => {
vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.SCARY_FACE, Moves.SCARY_FACE, Moves.SCARY_FACE, Moves.SCARY_FACE ]);
await game.startBattle([ Species.ABRA, Species.ZOROARK, Species.AXEW ] );
await game.startBattle([ Species.ABRA, Species.ZOROARK, Species.AXEW ]);
const axew = game.scene.getParty().at(2)!;
axew.shiny = true;
@ -132,5 +132,5 @@ describe("Abilities - Illusion", () => {
expect(zoroark.getGender(false, true)).equals(Gender.FEMALE);
expect(zoroark.isShiny(true)).equals(true);
expect(zoroark.illusion.pokeball).equals(PokeballType.GREAT_BALL);
} );
} );
});
});