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