From cf8f778dd3a15d320bbfa384a4a8ef9a31f284bc Mon Sep 17 00:00:00 2001 From: Lylian Date: Thu, 10 Oct 2024 18:00:06 +0200 Subject: [PATCH] fix nit --- src/data/ability.ts | 2 +- src/field/pokemon.ts | 8 +-- src/test/abilities/illusion.test.ts | 86 ++++++++++++++--------------- 3 files changed, 48 insertions(+), 48 deletions(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index 23f926c6ad7..58a3049d29b 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -4562,7 +4562,7 @@ export class IllusionPreSummonAbAttr extends PreSummonAbAttr { */ applyPreSummon(pokemon: Pokemon, passive: boolean, args: any[]): boolean { let suppressed = false; - console.log("PRESUMMONILLUSION : ", pokemon.name) + console.log("PRESUMMONILLUSION : ", pokemon.name); pokemon.scene.getField(true).filter(p => p !== pokemon).map(p => { if ((p.getAbility().hasAttr(SuppressFieldAbilitiesAbAttr) && p.canApplyAbility()) || (p.getPassiveAbility().hasAttr(SuppressFieldAbilitiesAbAttr) && p.canApplyAbility(true))) { suppressed = true; diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index d1b27a68051..5badd040688 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -399,10 +399,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { */ generateIllusion(): boolean { if (this.hasTrainer()) { - console.log("GENERATEILLUSION() : ", this.name) + console.log("GENERATEILLUSION() : ", this.name); const party: Pokemon[] = (this.isPlayer() ? this.scene.getParty() : this.scene.getEnemyParty()).filter(p => p.isAllowedInBattle()); const lastPokemon: Pokemon = party.filter(p => p !== this).at(-1) || this; - console.log(lastPokemon.name) + console.log(lastPokemon.name); const speciesId = lastPokemon.species.speciesId; if ( lastPokemon === this || this.illusion.active || @@ -475,12 +475,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { this.name = randomIllusion.name; this.loadAssets(false, true).then(() => this.playAnim()); } - console.log("L'ILLUSION : ", this.illusion) + console.log("L'ILLUSION : ", this.illusion); return true; } breakIllusion(): boolean { - console.log("BREAKILLUSION") + console.log("BREAKILLUSION"); if (!this.illusion.active) { return false; } diff --git a/src/test/abilities/illusion.test.ts b/src/test/abilities/illusion.test.ts index c4414f3b871..5afc96c95a4 100644 --- a/src/test/abilities/illusion.test.ts +++ b/src/test/abilities/illusion.test.ts @@ -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; @@ -126,11 +126,11 @@ describe("Abilities - Illusion", () => { await game.phaseInterceptor.to(TurnEndPhase); const zoroark = game.scene.getPlayerPokemon()!; - console.log(zoroark.illusion) + console.log(zoroark.illusion); 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.illusion.pokeball).equals(PokeballType.GREAT_BALL); - }); -}); + } ); +} );