mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-20 16:42:45 +02:00
* Grabbed reverted changes from stuff
* Added version migrator for rage fist data + deepMergeSpriteData tests
* fixed formattign
* Fied a few
* Fixed constructor (maybe), moved deepCopy and deepMergeSpriteData to own file
`common.ts` is hella bloated so seems legit
* Moved empty moveset verification mapping thing to upgrade script bc i wanted to
* Fixed tests
* test added
* Fixed summondata being cleared inside summonPhase, removed `summonDataPrimer`
like seriously how come no-one checked this
* Fixed test
I forgot that we outsped and oneshot
* Fixed test
* huhjjjjjb
* Hopefully fixed bug
my sanity and homework are paying the price for this lol
* added commented out console.log statement
uncomment to see new berry data
* Fixed migrate script, re-added deprecated attributes out of necessity
* Fixed failing test by not trying to mock rng
* Fixed test
* Fixed tests
* Update ability.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update ability.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update overrides.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update berry-phase.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update encounter-phase.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update game-data.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update move-phase.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Added utility function `randSeedFloat`
basically just `Phaser.math.RND.realInRange(0, 1)`
* Applied review comments, cleaned up code a bit
* Removed unnecessary null checks for turnData and co.
I explicitly made them initialized by default for this very reason
* Added tests for Last Resort regarding moveHistory
* Update pokemon.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update pokemon.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update pokemon.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update pokemon.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update pokemon.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update pokemon.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update pokemon.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update pokemon.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update battle-scene.ts
Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
* Update the-winstrate-challenge-encounter.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update pokemon.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update pokemon.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update pokemon.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update ability.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update move.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update move.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update move.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update battle-anims.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update pokemon.ts comments
* Fixed a few outstanding issues with documentation
* Updated switch summon phase comment
* Re-added BattleSummonData as TempSummonData
* Hppefully fixed -1 sprite scale glitch
* Fixed comment
* Reveted `pokemon-forms.ts`
* Fuxed constructor
* fixed -1 bug
* Revert "Added utility function `randSeedFloat`"
This reverts commit 4c3447c851
.
---------
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
158 lines
5.1 KiB
TypeScript
158 lines
5.1 KiB
TypeScript
import { Gender } from "#app/data/gender";
|
|
import { PokeballType } from "#app/enums/pokeball";
|
|
import { Abilities } from "#enums/abilities";
|
|
import { Moves } from "#enums/moves";
|
|
import { Species } from "#enums/species";
|
|
import GameManager from "#test/testUtils/gameManager";
|
|
import Phaser from "phaser";
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
|
|
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
|
|
.battleStyle("single")
|
|
.enemySpecies(Species.ZORUA)
|
|
.enemyAbility(Abilities.ILLUSION)
|
|
.enemyMoveset(Moves.TACKLE)
|
|
.enemyHeldItems([{ name: "WIDE_LENS", count: 3 }])
|
|
.moveset([Moves.WORRY_SEED, Moves.SOAK, Moves.TACKLE])
|
|
.startingHeldItems([{ name: "WIDE_LENS", count: 3 }]);
|
|
});
|
|
|
|
it("creates illusion at the start", async () => {
|
|
await game.classicMode.startBattle([Species.ZOROARK, Species.FEEBAS]);
|
|
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.FEEBAS]);
|
|
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.FEEBAS]);
|
|
game.move.select(Moves.WORRY_SEED);
|
|
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
|
|
|
const zorua = game.scene.getEnemyPokemon()!;
|
|
|
|
expect(!!zorua.summonData.illusion).equals(false);
|
|
});
|
|
|
|
it("break with neutralizing gas", 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.FEEBAS]);
|
|
|
|
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);
|
|
});
|
|
|
|
it("breaks when suppressed", async () => {
|
|
game.override.moveset(Moves.GASTRO_ACID);
|
|
await game.classicMode.startBattle([Species.MAGIKARP]);
|
|
const zorua = game.scene.getEnemyPokemon()!;
|
|
|
|
expect(!!zorua.summonData?.illusion).toBe(true);
|
|
|
|
game.move.select(Moves.GASTRO_ACID);
|
|
await game.phaseInterceptor.to("BerryPhase");
|
|
|
|
expect(zorua.isFullHp()).toBe(true);
|
|
expect(!!zorua.summonData?.illusion).toBe(false);
|
|
});
|
|
});
|