mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-04-28 12:34:37 +01:00
* implement illusion ability with unit test and localizations * try removing whitespace change on unnecessary files * nit corrections * nit update src/field/pokemon.ts Co-authored-by: Adrian T. <68144167+torranx@users.noreply.github.com> * nit update src/phases.ts Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com> * illusion test correction * unexpected error correction * refactor property pokemon.illusion to pokemon.battleData.illusion * nit * nit * update unit test up-to-date * add docs * merge up to date * bugfix * bugfix * merge up to date * refactor field illusion out of battleData * fix nit * fix nit * Zoroark change illusion after lastPokemon update * Zoroark change illusion after lastPokemon update * refactor bug fix * bugfix * bug fix on tests * Update src/field/pokemon.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * use GetFailedText * remove useless import * add condition 'no illusion' into transform move * wild Zoroark creates an illusion according to the current biome * wild Zoroark creates an illusion according to the current biome * delete console.log() * add doc * Update src/field/pokemon.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * fix tests * update locales submodule * update Illusion interface * bug fix * bug fix * bugfix * rename some params for future implementations * Zoroark keep illusion between battles * Zoroark keep illusion between battles * delete draft * merge up-to-date * bugfix * merge * merge * implement canApplyPresummon method * Update test/abilities/illusion.test.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * Update src/data/ability.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * Update src/data/ability.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * Update test/abilities/illusion.test.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * Update test/abilities/illusion.test.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * nit * review corrections * nit * type hints affected by enemy illusion * type hints affected by enemy illusionin fight-ui-handler * nit * rename some parameters back in useIllusion * Update src/field/pokemon.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Update src/field/pokemon.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * refactor battleData.illusion as summonData.illusion and delete oncePerBattleClause * add comments * illusion will break before evolution * Update src/field/pokemon.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * Update src/data/ability.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * Update src/data/ability.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * Update src/data/ability.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * Update src/data/ability.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * bug fix * g * get submodule back * get submodule back * bug fix to save illusion status * add pokemon.getPokeball() * Update src/field/pokemon.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * Update src/field/pokemon.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * Update src/field/pokemon.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * Update src/data/ability.ts Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * Update src/field/pokemon.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Update src/field/pokemon.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Update src/field/pokemon.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Update src/field/pokemon.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --------- Co-authored-by: Adrian T. <68144167+torranx@users.noreply.github.com> Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com> Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
145 lines
4.8 KiB
TypeScript
145 lines
4.8 KiB
TypeScript
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
import Phaser from "phaser";
|
|
import GameManager from "#test/testUtils/gameManager";
|
|
import { Species } from "#enums/species";
|
|
import { TurnEndPhase } from "#app/phases/turn-end-phase";
|
|
import { Moves } from "#enums/moves";
|
|
import { Abilities } from "#enums/abilities";
|
|
import { PokeballType } from "#app/enums/pokeball";
|
|
import { Gender } from "#app/data/gender";
|
|
|
|
describe("Abilities - Illusion", () => {
|
|
let phaserGame: Phaser.Game;
|
|
let game: GameManager;
|
|
|
|
beforeAll(() => {
|
|
phaserGame = new Phaser.Game({
|
|
type: Phaser.HEADLESS,
|
|
});
|
|
});
|
|
|
|
afterEach(() => {
|
|
game.phaseInterceptor.restoreOg();
|
|
});
|
|
|
|
beforeEach(() => {
|
|
game = new GameManager(phaserGame);
|
|
game.override.battleType("single");
|
|
game.override.enemySpecies(Species.ZORUA);
|
|
game.override.enemyAbility(Abilities.ILLUSION);
|
|
game.override.enemyMoveset(Moves.TACKLE);
|
|
game.override.enemyHeldItems([{ name: "WIDE_LENS", count: 3 }]);
|
|
|
|
game.override.moveset([Moves.WORRY_SEED, Moves.SOAK, Moves.TACKLE]);
|
|
game.override.startingHeldItems([{ name: "WIDE_LENS", count: 3 }]);
|
|
});
|
|
|
|
it("creates illusion at the start", async () => {
|
|
await game.classicMode.startBattle([Species.ZOROARK, Species.AXEW]);
|
|
const zoroark = game.scene.getPlayerPokemon()!;
|
|
const zorua = game.scene.getEnemyPokemon()!;
|
|
|
|
expect(!!zoroark.summonData?.illusion).equals(true);
|
|
expect(!!zorua.summonData?.illusion).equals(true);
|
|
});
|
|
|
|
it("break after receiving damaging move", async () => {
|
|
await game.classicMode.startBattle([Species.AXEW]);
|
|
game.move.select(Moves.TACKLE);
|
|
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
|
|
const zorua = game.scene.getEnemyPokemon()!;
|
|
|
|
expect(!!zorua.summonData?.illusion).equals(false);
|
|
expect(zorua.name).equals("Zorua");
|
|
});
|
|
|
|
it("break after getting ability changed", async () => {
|
|
await game.classicMode.startBattle([Species.AXEW]);
|
|
game.move.select(Moves.WORRY_SEED);
|
|
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
|
|
const zorua = game.scene.getEnemyPokemon()!;
|
|
|
|
expect(!!zorua.summonData?.illusion).equals(false);
|
|
});
|
|
|
|
it("break if the ability is suppressed", async () => {
|
|
game.override.enemyAbility(Abilities.NEUTRALIZING_GAS);
|
|
await game.classicMode.startBattle([Species.KOFFING]);
|
|
|
|
const zorua = game.scene.getEnemyPokemon()!;
|
|
|
|
expect(!!zorua.summonData?.illusion).equals(false);
|
|
});
|
|
|
|
it("causes enemy AI to consider the illusion's type instead of the actual type when considering move effectiveness", async () => {
|
|
game.override.enemyMoveset([Moves.FLAMETHROWER, Moves.PSYCHIC, Moves.TACKLE]);
|
|
await game.classicMode.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 flameThrowerEffectiveness = zoroark.getAttackTypeEffectiveness(
|
|
flameThrower.type,
|
|
enemy,
|
|
undefined,
|
|
undefined,
|
|
flameThrower,
|
|
true,
|
|
);
|
|
const psychicEffectiveness = zoroark.getAttackTypeEffectiveness(
|
|
psychic.type,
|
|
enemy,
|
|
undefined,
|
|
undefined,
|
|
psychic,
|
|
true,
|
|
);
|
|
expect(psychicEffectiveness).above(flameThrowerEffectiveness);
|
|
});
|
|
|
|
it("does not break from indirect damage", async () => {
|
|
game.override.enemySpecies(Species.GIGALITH);
|
|
game.override.enemyAbility(Abilities.SAND_STREAM);
|
|
game.override.enemyMoveset(Moves.WILL_O_WISP);
|
|
game.override.moveset([Moves.FLARE_BLITZ]);
|
|
|
|
await game.classicMode.startBattle([Species.ZOROARK, Species.AZUMARILL]);
|
|
|
|
game.move.select(Moves.FLARE_BLITZ);
|
|
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
|
|
const zoroark = game.scene.getPlayerPokemon()!;
|
|
|
|
expect(!!zoroark.summonData?.illusion).equals(true);
|
|
});
|
|
|
|
it("copies the the name, nickname, gender, shininess, and pokeball from the illusion source", async () => {
|
|
game.override.enemyMoveset(Moves.SPLASH);
|
|
await game.classicMode.startBattle([Species.ABRA, Species.ZOROARK, Species.AXEW]);
|
|
const axew = game.scene.getPlayerParty().at(2)!;
|
|
axew.shiny = true;
|
|
axew.nickname = btoa(unescape(encodeURIComponent("axew nickname")));
|
|
axew.gender = Gender.FEMALE;
|
|
axew.pokeball = PokeballType.GREAT_BALL;
|
|
|
|
game.doSwitchPokemon(1);
|
|
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
|
|
const zoroark = game.scene.getPlayerPokemon()!;
|
|
|
|
expect(zoroark.name).equals("Axew");
|
|
expect(zoroark.getNameToRender()).equals("axew nickname");
|
|
expect(zoroark.getGender(false, true)).equals(Gender.FEMALE);
|
|
expect(zoroark.isShiny(true)).equals(true);
|
|
expect(zoroark.getPokeball(true)).equals(PokeballType.GREAT_BALL);
|
|
});
|
|
});
|