From 061c9872658011c1eefba3c10b2de33bdff8a0b0 Mon Sep 17 00:00:00 2001 From: Bertie690 <136088738+Bertie690@users.noreply.github.com> Date: Sun, 15 Jun 2025 03:40:41 -0400 Subject: [PATCH] [Test] Convert `game.override` calls into chained line where possible https://github.com/pagefaultgames/pokerogue/pull/5926 * Condensed all overrides into 1 line where possible I hope I got them all... * Fixed tests 0.5 * Cleaned up safeguard test to not use outdated code; fixed rest of errors * Fixed illusion test * Revert safeguart etst * Fixed battle tets * Fixed stuff * Fixed things2.0 * Fixed import issues * Revert changes outside of the tests directory * Revert changes outside of the tests directory --------- Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --- test/abilities/battery.test.ts | 11 ++- test/abilities/costar.test.ts | 9 +- test/abilities/disguise.test.ts | 34 +++---- test/abilities/flash_fire.test.ts | 19 ++-- test/abilities/flower_gift.test.ts | 7 +- test/abilities/good_as_gold.test.ts | 16 ++- test/abilities/hustle.test.ts | 3 +- test/abilities/ice_face.test.ts | 25 ++--- test/abilities/illusion.test.ts | 15 ++- test/abilities/imposter.test.ts | 3 +- test/abilities/intimidate.test.ts | 3 +- test/abilities/intrepid_sword.test.ts | 9 +- test/abilities/libero.test.ts | 12 +-- test/abilities/magic_bounce.test.ts | 97 ++++++++----------- test/abilities/magic_guard.test.ts | 52 +++++----- test/abilities/mirror_armor.test.ts | 37 +++---- test/abilities/moxie.test.ts | 15 +-- test/abilities/normalize.test.ts | 10 +- test/abilities/parental_bond.test.ts | 39 +++----- test/abilities/perish_body.test.ts | 28 +++--- test/abilities/power_construct.test.ts | 6 +- test/abilities/power_spot.test.ts | 11 ++- test/abilities/protean.test.ts | 12 +-- test/abilities/quick_draw.test.ts | 19 ++-- test/abilities/sand_spit.test.ts | 17 ++-- test/abilities/schooling.test.ts | 3 +- test/abilities/screen_cleaner.test.ts | 4 +- test/abilities/seed_sower.test.ts | 17 ++-- test/abilities/shield_dust.test.ts | 13 +-- test/abilities/shields_down.test.ts | 38 ++++---- test/abilities/steely_spirit.test.ts | 11 ++- test/abilities/sturdy.test.ts | 17 ++-- test/abilities/sweet_veil.test.ts | 5 +- test/abilities/unseen_fist.test.ts | 3 +- test/abilities/volt_absorb.test.ts | 34 ++++--- test/abilities/wind_power.test.ts | 21 ++-- test/abilities/wonder_skin.test.ts | 13 +-- test/abilities/zen_mode.test.ts | 3 +- test/abilities/zero_to_hero.test.ts | 3 +- test/achievements/achievement.test.ts | 6 -- test/arena/weather_fog.test.ts | 14 +-- test/arena/weather_strong_winds.test.ts | 11 ++- test/battle/battle-order.test.ts | 11 ++- test/battle/battle.test.ts | 81 +++++++--------- test/escape-calculations.test.ts | 3 +- test/evolution.test.ts | 11 +-- test/field/pokemon.test.ts | 13 +-- test/items/exp_booster.test.ts | 4 +- test/moves/baneful_bunker.test.ts | 18 ++-- test/moves/baton_pass.test.ts | 13 +-- test/moves/beak_blast.test.ts | 3 +- test/moves/beat_up.test.ts | 17 ++-- test/moves/ceaseless_edge.test.ts | 20 ++-- test/moves/clangorous_soul.test.ts | 13 +-- test/moves/crafty_shield.test.ts | 21 ++-- test/moves/dragon_rage.test.ts | 30 +++--- test/moves/dynamax_cannon.test.ts | 10 +- test/moves/fillet_away.test.ts | 13 +-- test/moves/fissure.test.ts | 28 +++--- test/moves/flame_burst.test.ts | 17 ++-- test/moves/flower_shield.test.ts | 11 ++- test/moves/follow_me.test.ts | 20 ++-- test/moves/gastro_acid.test.ts | 17 ++-- test/moves/glaive_rush.test.ts | 21 ++-- test/moves/growth.test.ts | 11 ++- test/moves/hard_press.test.ts | 13 +-- test/moves/haze.test.ts | 19 ++-- test/moves/hyper_beam.test.ts | 16 +-- test/moves/lunar_blessing.test.ts | 15 ++- test/moves/magic_coat.test.ts | 44 ++++----- test/moves/make_it_rain.test.ts | 20 ++-- test/moves/mat_block.test.ts | 18 ++-- test/moves/parting_shot.test.ts | 11 ++- test/moves/powder.test.ts | 3 +- test/moves/protect.test.ts | 18 ++-- test/moves/purify.test.ts | 17 ++-- test/moves/quick_guard.test.ts | 24 ++--- test/moves/rage_powder.test.ts | 13 +-- test/moves/rollout.test.ts | 21 ++-- test/moves/roost.test.ts | 13 +-- test/moves/safeguard.test.ts | 39 ++++---- test/moves/spikes.test.ts | 4 +- test/moves/spit_up.test.ts | 17 ++-- test/moves/spotlight.test.ts | 15 +-- test/moves/stockpile.test.ts | 17 ++-- test/moves/substitute.test.ts | 30 ++---- test/moves/tackle.test.ts | 1 + test/moves/tail_whip.test.ts | 15 +-- test/moves/thousand_arrows.test.ts | 16 +-- test/moves/tidy_up.test.ts | 19 ++-- test/moves/toxic.test.ts | 3 +- test/moves/transform.test.ts | 3 +- test/moves/wide_guard.test.ts | 18 ++-- .../a-trainers-test-encounter.test.ts | 9 +- .../absolute-avarice-encounter.test.ts | 16 ++- ...an-offer-you-cant-refuse-encounter.test.ts | 3 +- .../bug-type-superfan-encounter.test.ts | 9 +- .../clowning-around-encounter.test.ts | 9 +- .../dancing-lessons-encounter.test.ts | 12 +-- .../encounters/delibirdy-encounter.test.ts | 9 +- .../department-store-sale-encounter.test.ts | 12 +-- .../encounters/field-trip-encounter.test.ts | 11 ++- .../fight-or-flight-encounter.test.ts | 9 +- .../fun-and-games-encounter.test.ts | 12 +-- .../global-trade-system-encounter.test.ts | 12 +-- .../encounters/lost-at-sea-encounter.test.ts | 12 +-- .../mysterious-challengers-encounter.test.ts | 12 +-- .../encounters/part-timer-encounter.test.ts | 12 +-- .../encounters/safari-zone.test.ts | 12 +-- .../teleporting-hijinks-encounter.test.ts | 9 +- .../the-expert-breeder-encounter.test.ts | 12 +-- .../the-pokemon-salesman-encounter.test.ts | 12 +-- .../the-strong-stuff-encounter.test.ts | 3 +- .../the-winstrate-challenge-encounter.test.ts | 12 +-- .../trash-to-treasure-encounter.test.ts | 9 +- .../encounters/weird-dream-encounter.test.ts | 9 +- .../mystery-encounter-utils.test.ts | 1 + .../mystery-encounter.test.ts | 3 +- test/phases/mystery-encounter-phase.test.ts | 5 +- test/testUtils/helpers/moveHelper.ts | 4 +- test/ui/pokedex.test.ts | 4 +- test/ui/transfer-item.test.ts | 23 ++--- 122 files changed, 877 insertions(+), 993 deletions(-) diff --git a/test/abilities/battery.test.ts b/test/abilities/battery.test.ts index 980eaa5b381..db129e72b0b 100644 --- a/test/abilities/battery.test.ts +++ b/test/abilities/battery.test.ts @@ -26,11 +26,12 @@ describe("Abilities - Battery", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("double"); - game.override.enemySpecies(SpeciesId.SHUCKLE); - game.override.enemyAbility(AbilityId.BALL_FETCH); - game.override.moveset([MoveId.TACKLE, MoveId.BREAKING_SWIPE, MoveId.SPLASH, MoveId.DAZZLING_GLEAM]); - game.override.enemyMoveset(MoveId.SPLASH); + game.override + .battleStyle("double") + .enemySpecies(SpeciesId.SHUCKLE) + .enemyAbility(AbilityId.BALL_FETCH) + .moveset([MoveId.TACKLE, MoveId.BREAKING_SWIPE, MoveId.SPLASH, MoveId.DAZZLING_GLEAM]) + .enemyMoveset(MoveId.SPLASH); }); it("raises the power of allies' special moves by 30%", async () => { diff --git a/test/abilities/costar.test.ts b/test/abilities/costar.test.ts index ae09aeea096..a40d84e72f5 100644 --- a/test/abilities/costar.test.ts +++ b/test/abilities/costar.test.ts @@ -24,10 +24,11 @@ describe("Abilities - COSTAR", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("double"); - game.override.ability(AbilityId.COSTAR); - game.override.moveset([MoveId.SPLASH, MoveId.NASTY_PLOT]); - game.override.enemyMoveset(MoveId.SPLASH); + game.override + .battleStyle("double") + .ability(AbilityId.COSTAR) + .moveset([MoveId.SPLASH, MoveId.NASTY_PLOT]) + .enemyMoveset(MoveId.SPLASH); }); test("ability copies positive stat stages", async () => { diff --git a/test/abilities/disguise.test.ts b/test/abilities/disguise.test.ts index 64e0715774d..4ccd825e574 100644 --- a/test/abilities/disguise.test.ts +++ b/test/abilities/disguise.test.ts @@ -66,8 +66,7 @@ describe("Abilities - Disguise", () => { }); it("takes no damage from the first hit of a multihit move and transforms to Busted form, then takes damage from the second hit", async () => { - game.override.moveset([MoveId.SURGING_STRIKES]); - game.override.enemyLevel(5); + game.override.moveset([MoveId.SURGING_STRIKES]).enemyLevel(5); await game.classicMode.startBattle(); const mimikyu = game.scene.getEnemyPokemon()!; @@ -106,8 +105,7 @@ describe("Abilities - Disguise", () => { }); it("persists form change when switched out", async () => { - game.override.enemyMoveset([MoveId.SHADOW_SNEAK]); - game.override.starterSpecies(0); + game.override.enemyMoveset([MoveId.SHADOW_SNEAK]).starterSpecies(0); await game.classicMode.startBattle([SpeciesId.MIMIKYU, SpeciesId.FURRET]); @@ -131,8 +129,7 @@ describe("Abilities - Disguise", () => { }); it("persists form change when wave changes with no arena reset", async () => { - game.override.starterSpecies(0); - game.override.starterForms({ + game.override.starterSpecies(0).starterForms({ [SpeciesId.MIMIKYU]: bustedForm, }); await game.classicMode.startBattle([SpeciesId.FURRET, SpeciesId.MIMIKYU]); @@ -148,11 +145,12 @@ describe("Abilities - Disguise", () => { }); it("reverts to Disguised form on arena reset", async () => { - game.override.startingWave(4); - game.override.starterSpecies(SpeciesId.MIMIKYU); - game.override.starterForms({ - [SpeciesId.MIMIKYU]: bustedForm, - }); + game.override + .startingWave(4) + .starterSpecies(SpeciesId.MIMIKYU) + .starterForms({ + [SpeciesId.MIMIKYU]: bustedForm, + }); await game.classicMode.startBattle(); @@ -168,11 +166,12 @@ describe("Abilities - Disguise", () => { }); it("reverts to Disguised form on biome change when fainted", async () => { - game.override.startingWave(10); - game.override.starterSpecies(0); - game.override.starterForms({ - [SpeciesId.MIMIKYU]: bustedForm, - }); + game.override + .startingWave(10) + .starterSpecies(0) + .starterForms({ + [SpeciesId.MIMIKYU]: bustedForm, + }); await game.classicMode.startBattle([SpeciesId.MIMIKYU, SpeciesId.FURRET]); @@ -206,8 +205,7 @@ describe("Abilities - Disguise", () => { }); it("activates when Aerilate circumvents immunity to the move's base type", async () => { - game.override.ability(AbilityId.AERILATE); - game.override.moveset([MoveId.TACKLE]); + game.override.ability(AbilityId.AERILATE).moveset([MoveId.TACKLE]); await game.classicMode.startBattle(); diff --git a/test/abilities/flash_fire.test.ts b/test/abilities/flash_fire.test.ts index 92bd7b52e57..c3477388912 100644 --- a/test/abilities/flash_fire.test.ts +++ b/test/abilities/flash_fire.test.ts @@ -73,8 +73,7 @@ describe("Abilities - Flash Fire", () => { }, 20000); it("activated after being frozen", async () => { - game.override.enemyMoveset([MoveId.EMBER]).moveset(MoveId.SPLASH); - game.override.statusEffect(StatusEffect.FREEZE); + game.override.enemyMoveset([MoveId.EMBER]).moveset(MoveId.SPLASH).statusEffect(StatusEffect.FREEZE); await game.classicMode.startBattle([SpeciesId.BLISSEY]); const blissey = game.scene.getPlayerPokemon()!; @@ -102,8 +101,11 @@ describe("Abilities - Flash Fire", () => { }, 20000); it("boosts Fire-type move when the ability is activated", async () => { - game.override.enemyMoveset([MoveId.FIRE_PLEDGE]).moveset([MoveId.EMBER, MoveId.SPLASH]); - game.override.enemyAbility(AbilityId.FLASH_FIRE).ability(AbilityId.NONE); + game.override + .enemyMoveset([MoveId.FIRE_PLEDGE]) + .moveset([MoveId.EMBER, MoveId.SPLASH]) + .enemyAbility(AbilityId.FLASH_FIRE) + .ability(AbilityId.NONE); await game.classicMode.startBattle([SpeciesId.BLISSEY]); const blissey = game.scene.getPlayerPokemon()!; const initialHP = 1000; @@ -127,9 +129,12 @@ describe("Abilities - Flash Fire", () => { }, 20000); it("still activates regardless of accuracy check", async () => { - game.override.moveset(MoveId.FIRE_PLEDGE).enemyMoveset(MoveId.EMBER); - game.override.enemyAbility(AbilityId.NONE).ability(AbilityId.FLASH_FIRE); - game.override.enemySpecies(SpeciesId.BLISSEY); + game.override + .moveset(MoveId.FIRE_PLEDGE) + .enemyMoveset(MoveId.EMBER) + .enemyAbility(AbilityId.NONE) + .ability(AbilityId.FLASH_FIRE) + .enemySpecies(SpeciesId.BLISSEY); await game.classicMode.startBattle([SpeciesId.RATTATA]); const blissey = game.scene.getEnemyPokemon()!; diff --git a/test/abilities/flower_gift.test.ts b/test/abilities/flower_gift.test.ts index 26180492cbd..f072afe7f34 100644 --- a/test/abilities/flower_gift.test.ts +++ b/test/abilities/flower_gift.test.ts @@ -47,9 +47,10 @@ describe("Abilities - Flower Gift", () => { allyAbility = AbilityId.BALL_FETCH, enemyAbility = AbilityId.BALL_FETCH, ): Promise<[number, number]> => { - game.override.battleStyle("double"); - game.override.moveset([MoveId.SPLASH, MoveId.SUNNY_DAY, move, MoveId.HEAL_PULSE]); - game.override.enemyMoveset([MoveId.SPLASH, MoveId.HEAL_PULSE]); + game.override + .battleStyle("double") + .moveset([MoveId.SPLASH, MoveId.SUNNY_DAY, move, MoveId.HEAL_PULSE]) + .enemyMoveset([MoveId.SPLASH, MoveId.HEAL_PULSE]); const target_index = allyAttacker ? BattlerIndex.ENEMY : BattlerIndex.PLAYER_2; const attacker_index = allyAttacker ? BattlerIndex.PLAYER_2 : BattlerIndex.ENEMY; const ally_move = allyAttacker ? move : MoveId.SPLASH; diff --git a/test/abilities/good_as_gold.test.ts b/test/abilities/good_as_gold.test.ts index 85fadd472dc..3b6600eabd4 100644 --- a/test/abilities/good_as_gold.test.ts +++ b/test/abilities/good_as_gold.test.ts @@ -63,9 +63,10 @@ describe("Abilities - Good As Gold", () => { }); it("should not block any status moves that target the field, one side, or all pokemon", async () => { - game.override.battleStyle("double"); - game.override.enemyMoveset([MoveId.STEALTH_ROCK, MoveId.HAZE]); - game.override.moveset([MoveId.SWORDS_DANCE, MoveId.SAFEGUARD]); + game.override + .battleStyle("double") + .enemyMoveset([MoveId.STEALTH_ROCK, MoveId.HAZE]) + .moveset([MoveId.SWORDS_DANCE, MoveId.SAFEGUARD]); await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.FEEBAS]); const [good_as_gold, ball_fetch] = game.scene.getPlayerField(); @@ -85,8 +86,7 @@ describe("Abilities - Good As Gold", () => { }); it("should not block field targeted effects in singles", async () => { - game.override.battleStyle("single"); - game.override.enemyMoveset([MoveId.SPIKES]); + game.override.battleStyle("single").enemyMoveset([MoveId.SPIKES]); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); game.move.select(MoveId.SPLASH, 0); @@ -96,8 +96,7 @@ describe("Abilities - Good As Gold", () => { }); it("should block the ally's helping hand", async () => { - game.override.battleStyle("double"); - game.override.moveset([MoveId.HELPING_HAND, MoveId.TACKLE]); + game.override.battleStyle("double").moveset([MoveId.HELPING_HAND, MoveId.TACKLE]); await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.FEEBAS]); game.move.select(MoveId.HELPING_HAND, 0); @@ -129,8 +128,7 @@ describe("Abilities - Good As Gold", () => { }); it("should not block field targeted effects like rain dance", async () => { - game.override.battleStyle("single"); - game.override.enemyMoveset([MoveId.RAIN_DANCE]); + game.override.battleStyle("single").enemyMoveset([MoveId.RAIN_DANCE]); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); game.move.use(MoveId.SPLASH, 0); diff --git a/test/abilities/hustle.test.ts b/test/abilities/hustle.test.ts index 58aa01bb39a..7ac636b15b2 100644 --- a/test/abilities/hustle.test.ts +++ b/test/abilities/hustle.test.ts @@ -75,8 +75,7 @@ describe("Abilities - Hustle", () => { }); it("does not affect OHKO moves", async () => { - game.override.startingLevel(100); - game.override.enemyLevel(30); + game.override.startingLevel(100).enemyLevel(30); await game.classicMode.startBattle([SpeciesId.PIKACHU]); const pikachu = game.scene.getPlayerPokemon()!; diff --git a/test/abilities/ice_face.test.ts b/test/abilities/ice_face.test.ts index 2899120db5a..c42713d7e6c 100644 --- a/test/abilities/ice_face.test.ts +++ b/test/abilities/ice_face.test.ts @@ -30,10 +30,11 @@ describe("Abilities - Ice Face", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - game.override.enemySpecies(SpeciesId.EISCUE); - game.override.enemyAbility(AbilityId.ICE_FACE); - game.override.moveset([MoveId.TACKLE, MoveId.ICE_BEAM, MoveId.TOXIC_THREAD, MoveId.HAIL]); + game.override + .battleStyle("single") + .enemySpecies(SpeciesId.EISCUE) + .enemyAbility(AbilityId.ICE_FACE) + .moveset([MoveId.TACKLE, MoveId.ICE_BEAM, MoveId.TOXIC_THREAD, MoveId.HAIL]); }); it("takes no damage from physical move and transforms to Noice", async () => { @@ -51,8 +52,7 @@ describe("Abilities - Ice Face", () => { }); it("takes no damage from the first hit of multihit physical move and transforms to Noice", async () => { - game.override.moveset([MoveId.SURGING_STRIKES]); - game.override.enemyLevel(1); + game.override.moveset([MoveId.SURGING_STRIKES]).enemyLevel(1); await game.classicMode.startBattle([SpeciesId.HITMONLEE]); game.move.select(MoveId.SURGING_STRIKES); @@ -196,12 +196,13 @@ describe("Abilities - Ice Face", () => { }); it("reverts to Ice Face on arena reset", async () => { - game.override.startingWave(4); - game.override.startingLevel(4); - game.override.enemySpecies(SpeciesId.MAGIKARP); - game.override.starterForms({ - [SpeciesId.EISCUE]: noiceForm, - }); + game.override + .startingWave(4) + .startingLevel(4) + .enemySpecies(SpeciesId.MAGIKARP) + .starterForms({ + [SpeciesId.EISCUE]: noiceForm, + }); await game.classicMode.startBattle([SpeciesId.EISCUE]); diff --git a/test/abilities/illusion.test.ts b/test/abilities/illusion.test.ts index 37e2ca59c6a..1c2809ad813 100644 --- a/test/abilities/illusion.test.ts +++ b/test/abilities/illusion.test.ts @@ -116,26 +116,23 @@ describe("Abilities - Illusion", () => { expect(psychicEffectiveness).above(flameThrowerEffectiveness); }); - it("does not break from indirect damage", async () => { - game.override.enemySpecies(SpeciesId.GIGALITH); - game.override.enemyAbility(AbilityId.SAND_STREAM); - game.override.enemyMoveset(MoveId.WILL_O_WISP); - game.override.moveset([MoveId.FLARE_BLITZ]); + it("should not break from indirect damage from status, weather or recoil", async () => { + game.override.enemySpecies(SpeciesId.GIGALITH).enemyAbility(AbilityId.SAND_STREAM); await game.classicMode.startBattle([SpeciesId.ZOROARK, SpeciesId.AZUMARILL]); - game.move.select(MoveId.FLARE_BLITZ); - - await game.phaseInterceptor.to("TurnEndPhase"); + game.move.use(MoveId.FLARE_BLITZ); + await game.move.forceEnemyMove(MoveId.WILL_O_WISP); + await game.toEndOfTurn(); 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(MoveId.SPLASH); await game.classicMode.startBattle([SpeciesId.ABRA, SpeciesId.ZOROARK, SpeciesId.AXEW]); + const axew = game.scene.getPlayerParty().at(2)!; axew.shiny = true; axew.nickname = btoa(unescape(encodeURIComponent("axew nickname"))); diff --git a/test/abilities/imposter.test.ts b/test/abilities/imposter.test.ts index e9ae6bd64bb..30491139877 100644 --- a/test/abilities/imposter.test.ts +++ b/test/abilities/imposter.test.ts @@ -162,8 +162,7 @@ describe("Abilities - Imposter", () => { }); it("should stay transformed with the correct form after reload", async () => { - game.override.moveset([MoveId.ABSORB]); - game.override.enemySpecies(SpeciesId.UNOWN); + game.override.moveset([MoveId.ABSORB]).enemySpecies(SpeciesId.UNOWN); await game.classicMode.startBattle([SpeciesId.DITTO]); const enemy = game.scene.getEnemyPokemon()!; diff --git a/test/abilities/intimidate.test.ts b/test/abilities/intimidate.test.ts index e72b9669b6e..cc75b257686 100644 --- a/test/abilities/intimidate.test.ts +++ b/test/abilities/intimidate.test.ts @@ -88,8 +88,7 @@ describe("Abilities - Intimidate", () => { }, 20000); it("should not activate again if there is no switch or new entry", async () => { - game.override.startingWave(2); - game.override.moveset([MoveId.SPLASH]); + game.override.startingWave(2).moveset([MoveId.SPLASH]); await game.classicMode.startBattle([SpeciesId.MIGHTYENA, SpeciesId.POOCHYENA]); const playerPokemon = game.scene.getPlayerPokemon()!; diff --git a/test/abilities/intrepid_sword.test.ts b/test/abilities/intrepid_sword.test.ts index 7cfa9581bb9..3a24f44a78e 100644 --- a/test/abilities/intrepid_sword.test.ts +++ b/test/abilities/intrepid_sword.test.ts @@ -22,10 +22,11 @@ describe("Abilities - Intrepid Sword", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - game.override.enemySpecies(SpeciesId.ZACIAN); - game.override.enemyAbility(AbilityId.INTREPID_SWORD); - game.override.ability(AbilityId.INTREPID_SWORD); + game.override + .battleStyle("single") + .enemySpecies(SpeciesId.ZACIAN) + .enemyAbility(AbilityId.INTREPID_SWORD) + .ability(AbilityId.INTREPID_SWORD); }); it("should raise ATK stat stage by 1 on entry", async () => { diff --git a/test/abilities/libero.test.ts b/test/abilities/libero.test.ts index 6cae83219fd..eaa2630e90d 100644 --- a/test/abilities/libero.test.ts +++ b/test/abilities/libero.test.ts @@ -108,8 +108,7 @@ describe("Abilities - Libero", () => { }); test("ability applies correctly even if the type has changed by another ability", async () => { - game.override.moveset([MoveId.TACKLE]); - game.override.passiveAbility(AbilityId.REFRIGERATE); + game.override.moveset([MoveId.TACKLE]).passiveAbility(AbilityId.REFRIGERATE); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); @@ -156,8 +155,7 @@ describe("Abilities - Libero", () => { }); test("ability applies correctly even if the pokemon's move misses", async () => { - game.override.moveset([MoveId.TACKLE]); - game.override.enemyMoveset(MoveId.SPLASH); + game.override.moveset([MoveId.TACKLE]).enemyMoveset(MoveId.SPLASH); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); @@ -188,8 +186,7 @@ describe("Abilities - Libero", () => { }); test("ability applies correctly even if the pokemon's move fails because of type immunity", async () => { - game.override.moveset([MoveId.TACKLE]); - game.override.enemySpecies(SpeciesId.GASTLY); + game.override.moveset([MoveId.TACKLE]).enemySpecies(SpeciesId.GASTLY); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); @@ -262,8 +259,7 @@ describe("Abilities - Libero", () => { }); test("ability applies correctly even if the pokemon's Trick-or-Treat fails", async () => { - game.override.moveset([MoveId.TRICK_OR_TREAT]); - game.override.enemySpecies(SpeciesId.GASTLY); + game.override.moveset([MoveId.TRICK_OR_TREAT]).enemySpecies(SpeciesId.GASTLY); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); diff --git a/test/abilities/magic_bounce.test.ts b/test/abilities/magic_bounce.test.ts index 3c4ff2ad909..fb4f273950a 100644 --- a/test/abilities/magic_bounce.test.ts +++ b/test/abilities/magic_bounce.test.ts @@ -41,18 +41,16 @@ describe("Abilities - Magic Bounce", () => { it("should reflect basic status moves", async () => { await game.classicMode.startBattle([SpeciesId.MAGIKARP]); - game.move.select(MoveId.GROWL); + game.move.use(MoveId.GROWL); await game.phaseInterceptor.to("BerryPhase"); expect(game.scene.getPlayerPokemon()!.getStatStage(Stat.ATK)).toBe(-1); }); it("should not bounce moves while the target is in the semi-invulnerable state", async () => { await game.classicMode.startBattle([SpeciesId.MAGIKARP]); - game.override.moveset([MoveId.GROWL]); - game.override.enemyMoveset([MoveId.FLY]); - game.move.select(MoveId.GROWL); - await game.move.selectEnemyMove(MoveId.FLY); + game.move.use(MoveId.GROWL); + await game.move.forceEnemyMove(MoveId.FLY); await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]); await game.phaseInterceptor.to("BerryPhase"); @@ -61,11 +59,10 @@ describe("Abilities - Magic Bounce", () => { it("should individually bounce back multi-target moves", async () => { game.override.battleStyle("double"); - game.override.moveset([MoveId.GROWL, MoveId.SPLASH]); await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MAGIKARP]); - game.move.select(MoveId.GROWL, 0); - game.move.select(MoveId.SPLASH, 1); + game.move.use(MoveId.GROWL, 0); + game.move.use(MoveId.SPLASH, 1); await game.phaseInterceptor.to("BerryPhase"); const user = game.scene.getPlayerField()[0]; @@ -75,9 +72,8 @@ describe("Abilities - Magic Bounce", () => { it("should still bounce back a move that would otherwise fail", async () => { await game.classicMode.startBattle([SpeciesId.MAGIKARP]); game.scene.getEnemyPokemon()?.setStatStage(Stat.ATK, -6); - game.override.moveset([MoveId.GROWL]); - game.move.select(MoveId.GROWL); + game.move.use(MoveId.GROWL); await game.phaseInterceptor.to("BerryPhase"); expect(game.scene.getPlayerPokemon()!.getStatStage(Stat.ATK)).toBe(-1); @@ -107,29 +103,26 @@ describe("Abilities - Magic Bounce", () => { game.override.ability(AbilityId.MOLD_BREAKER); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); - game.move.select(MoveId.GROWL); + game.move.use(MoveId.GROWL); await game.phaseInterceptor.to("BerryPhase"); expect(game.scene.getEnemyPokemon()!.getStatStage(Stat.ATK)).toBe(-1); }); it("should bounce back a spread status move against both pokemon", async () => { - game.override.battleStyle("double"); - game.override.moveset([MoveId.GROWL, MoveId.SPLASH]); - game.override.enemyMoveset([MoveId.SPLASH]); + game.override.battleStyle("double").enemyMoveset([MoveId.SPLASH]); await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MAGIKARP]); - game.move.select(MoveId.GROWL, 0); - game.move.select(MoveId.SPLASH, 1); + game.move.use(MoveId.GROWL, 0); + game.move.use(MoveId.SPLASH, 1); await game.phaseInterceptor.to("BerryPhase"); expect(game.scene.getPlayerField().every(p => p.getStatStage(Stat.ATK) === -2)).toBeTruthy(); }); it("should only bounce spikes back once in doubles when both targets have magic bounce", async () => { - game.override.battleStyle("double"); + game.override.battleStyle("double").moveset([MoveId.SPIKES]); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); - game.override.moveset([MoveId.SPIKES]); game.move.select(MoveId.SPIKES); await game.phaseInterceptor.to("BerryPhase"); @@ -139,8 +132,7 @@ describe("Abilities - Magic Bounce", () => { }); it("should bounce spikes even when the target is protected", async () => { - game.override.moveset([MoveId.SPIKES]); - game.override.enemyMoveset([MoveId.PROTECT]); + game.override.moveset([MoveId.SPIKES]).enemyMoveset([MoveId.PROTECT]); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); game.move.select(MoveId.SPIKES); @@ -149,8 +141,7 @@ describe("Abilities - Magic Bounce", () => { }); it("should not bounce spikes when the target is in the semi-invulnerable state", async () => { - game.override.moveset([MoveId.SPIKES]); - game.override.enemyMoveset([MoveId.FLY]); + game.override.moveset([MoveId.SPIKES]).enemyMoveset([MoveId.FLY]); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); game.move.select(MoveId.SPIKES); @@ -160,9 +151,8 @@ describe("Abilities - Magic Bounce", () => { }); it("should not bounce back curse", async () => { - game.override.starterSpecies(SpeciesId.GASTLY); - await game.classicMode.startBattle([SpeciesId.GASTLY]); game.override.moveset([MoveId.CURSE]); + await game.classicMode.startBattle([SpeciesId.GASTLY]); game.move.select(MoveId.CURSE); await game.phaseInterceptor.to("BerryPhase"); @@ -171,8 +161,7 @@ describe("Abilities - Magic Bounce", () => { }); it("should not cause encore to be interrupted after bouncing", async () => { - game.override.moveset([MoveId.SPLASH, MoveId.GROWL, MoveId.ENCORE]); - game.override.enemyMoveset([MoveId.TACKLE, MoveId.GROWL]); + game.override.moveset([MoveId.SPLASH, MoveId.GROWL, MoveId.ENCORE]).enemyMoveset([MoveId.TACKLE, MoveId.GROWL]); // game.override.ability(AbilityId.MOLD_BREAKER); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); const playerPokemon = game.scene.getPlayerPokemon()!; @@ -199,9 +188,10 @@ describe("Abilities - Magic Bounce", () => { // TODO: encore is failing if the last move was virtual. it.todo("should not cause the bounced move to count for encore", async () => { - game.override.moveset([MoveId.SPLASH, MoveId.GROWL, MoveId.ENCORE]); - game.override.enemyMoveset([MoveId.GROWL, MoveId.TACKLE]); - game.override.enemyAbility(AbilityId.MAGIC_BOUNCE); + game.override + .moveset([MoveId.SPLASH, MoveId.GROWL, MoveId.ENCORE]) + .enemyMoveset([MoveId.GROWL, MoveId.TACKLE]) + .enemyAbility(AbilityId.MAGIC_BOUNCE); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); const playerPokemon = game.scene.getPlayerPokemon()!; @@ -227,9 +217,8 @@ describe("Abilities - Magic Bounce", () => { // TODO: stomping tantrum should consider moves that were bounced. it.todo("should cause stomping tantrum to double in power when the last move was bounced", async () => { - game.override.battleStyle("single"); + game.override.battleStyle("single").moveset([MoveId.STOMPING_TANTRUM, MoveId.CHARM]); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); - game.override.moveset([MoveId.STOMPING_TANTRUM, MoveId.CHARM]); const stomping_tantrum = allMoves[MoveId.STOMPING_TANTRUM]; vi.spyOn(stomping_tantrum, "calculateBattlePower"); @@ -242,36 +231,30 @@ describe("Abilities - Magic Bounce", () => { expect(stomping_tantrum.calculateBattlePower).toHaveReturnedWith(150); }); - // TODO: stomping tantrum should consider moves that were bounced. - it.todo( - "should properly cause the enemy's stomping tantrum to be doubled in power after bouncing and failing", - async () => { - game.override.enemyMoveset([MoveId.STOMPING_TANTRUM, MoveId.SPLASH, MoveId.CHARM]); - await game.classicMode.startBattle([SpeciesId.BULBASAUR]); + // TODO: stomping tantrum should consider moves that were bounced + it.todo("should boost enemy's stomping tantrum after failed bounce", async () => { + game.override.enemyMoveset([MoveId.STOMPING_TANTRUM, MoveId.SPLASH, MoveId.CHARM]); + await game.classicMode.startBattle([SpeciesId.BULBASAUR]); - const stomping_tantrum = allMoves[MoveId.STOMPING_TANTRUM]; - const enemy = game.scene.getEnemyPokemon()!; - vi.spyOn(stomping_tantrum, "calculateBattlePower"); + const stomping_tantrum = allMoves[MoveId.STOMPING_TANTRUM]; + const enemy = game.scene.getEnemyPokemon()!; + vi.spyOn(stomping_tantrum, "calculateBattlePower"); - game.move.select(MoveId.SPORE); - await game.move.selectEnemyMove(MoveId.CHARM); - await game.phaseInterceptor.to("TurnEndPhase"); - expect(enemy.getLastXMoves(1)[0].result).toBe("success"); + // Spore gets reflected back onto us + game.move.select(MoveId.SPORE); + await game.move.selectEnemyMove(MoveId.CHARM); + await game.toNextTurn(); + expect(enemy.getLastXMoves(1)[0].result).toBe("success"); - await game.phaseInterceptor.to("BerryPhase"); - expect(stomping_tantrum.calculateBattlePower).toHaveReturnedWith(75); - - await game.toNextTurn(); - game.move.select(MoveId.GROWL); - await game.phaseInterceptor.to("BerryPhase"); - expect(stomping_tantrum.calculateBattlePower).toHaveReturnedWith(75); - }, - ); + game.move.select(MoveId.SPORE); + await game.move.selectEnemyMove(MoveId.STOMPING_TANTRUM); + await game.toNextTurn(); + expect(stomping_tantrum.calculateBattlePower).toHaveReturnedWith(150); + }); it("should respect immunities when bouncing a move", async () => { vi.spyOn(allMoves[MoveId.THUNDER_WAVE], "accuracy", "get").mockReturnValue(100); - game.override.moveset([MoveId.THUNDER_WAVE, MoveId.GROWL]); - game.override.ability(AbilityId.SOUNDPROOF); + game.override.moveset([MoveId.THUNDER_WAVE, MoveId.GROWL]).ability(AbilityId.SOUNDPROOF); await game.classicMode.startBattle([SpeciesId.PHANPY]); // Turn 1 - thunder wave immunity test @@ -309,8 +292,7 @@ describe("Abilities - Magic Bounce", () => { }); it("should always apply the leftmost available target's magic bounce when bouncing moves like sticky webs in doubles", async () => { - game.override.battleStyle("double"); - game.override.moveset([MoveId.STICKY_WEB, MoveId.SPLASH, MoveId.TRICK_ROOM]); + game.override.battleStyle("double").moveset([MoveId.STICKY_WEB, MoveId.SPLASH, MoveId.TRICK_ROOM]); await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MAGIKARP]); const [enemy_1, enemy_2] = game.scene.getEnemyField(); @@ -345,6 +327,7 @@ describe("Abilities - Magic Bounce", () => { it("should not bounce back status moves that hit through semi-invulnerable states", async () => { game.override.moveset([MoveId.TOXIC, MoveId.CHARM]); await game.classicMode.startBattle([SpeciesId.BULBASAUR]); + game.move.select(MoveId.TOXIC); await game.move.selectEnemyMove(MoveId.FLY); await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]); diff --git a/test/abilities/magic_guard.test.ts b/test/abilities/magic_guard.test.ts index 40bb3203673..4274e692a2e 100644 --- a/test/abilities/magic_guard.test.ts +++ b/test/abilities/magic_guard.test.ts @@ -30,16 +30,16 @@ describe("Abilities - Magic Guard", () => { beforeEach(() => { game = new GameManager(phaserGame); - /** Player Pokemon overrides */ - game.override.ability(AbilityId.MAGIC_GUARD); - game.override.moveset([MoveId.SPLASH]); - game.override.startingLevel(100); - - /** Enemy Pokemon overrides */ - game.override.enemySpecies(SpeciesId.SNORLAX); - game.override.enemyAbility(AbilityId.INSOMNIA); - game.override.enemyMoveset(MoveId.SPLASH); - game.override.enemyLevel(100); + game.override + /** Player Pokemon overrides */ + .ability(AbilityId.MAGIC_GUARD) + .moveset([MoveId.SPLASH]) + .startingLevel(100) + /** Enemy Pokemon overrides */ + .enemySpecies(SpeciesId.SNORLAX) + .enemyAbility(AbilityId.INSOMNIA) + .enemyMoveset(MoveId.SPLASH) + .enemyLevel(100); }); //Bulbapedia Reference: https://bulbapedia.bulbagarden.net/wiki/Magic_Guard_(Ability) @@ -89,8 +89,9 @@ describe("Abilities - Magic Guard", () => { }); it("ability effect should not persist when the ability is replaced", async () => { - game.override.enemyMoveset([MoveId.WORRY_SEED, MoveId.WORRY_SEED, MoveId.WORRY_SEED, MoveId.WORRY_SEED]); - game.override.statusEffect(StatusEffect.POISON); + game.override + .enemyMoveset([MoveId.WORRY_SEED, MoveId.WORRY_SEED, MoveId.WORRY_SEED, MoveId.WORRY_SEED]) + .statusEffect(StatusEffect.POISON); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); @@ -108,8 +109,7 @@ describe("Abilities - Magic Guard", () => { }); it("Magic Guard prevents damage caused by burn but other non-damaging effects are still applied", async () => { - game.override.enemyStatusEffect(StatusEffect.BURN); - game.override.enemyAbility(AbilityId.MAGIC_GUARD); + game.override.enemyStatusEffect(StatusEffect.BURN).enemyAbility(AbilityId.MAGIC_GUARD); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); @@ -130,8 +130,7 @@ describe("Abilities - Magic Guard", () => { }); it("Magic Guard prevents damage caused by toxic but other non-damaging effects are still applied", async () => { - game.override.enemyStatusEffect(StatusEffect.TOXIC); - game.override.enemyAbility(AbilityId.MAGIC_GUARD); + game.override.enemyStatusEffect(StatusEffect.TOXIC).enemyAbility(AbilityId.MAGIC_GUARD); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); @@ -208,8 +207,7 @@ describe("Abilities - Magic Guard", () => { it("Magic Guard prevents against damage from volatile status effects", async () => { await game.classicMode.startBattle([SpeciesId.DUSKULL]); - game.override.moveset([MoveId.CURSE]); - game.override.enemyAbility(AbilityId.MAGIC_GUARD); + game.override.moveset([MoveId.CURSE]).enemyAbility(AbilityId.MAGIC_GUARD); const leadPokemon = game.scene.getPlayerPokemon()!; @@ -331,8 +329,9 @@ describe("Abilities - Magic Guard", () => { //Tests the ability Bad Dreams game.override.statusEffect(StatusEffect.SLEEP); //enemy pokemon is given Spore just in case player pokemon somehow awakens during test - game.override.enemyMoveset([MoveId.SPORE, MoveId.SPORE, MoveId.SPORE, MoveId.SPORE]); - game.override.enemyAbility(AbilityId.BAD_DREAMS); + game.override + .enemyMoveset([MoveId.SPORE, MoveId.SPORE, MoveId.SPORE, MoveId.SPORE]) + .enemyAbility(AbilityId.BAD_DREAMS); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); @@ -353,8 +352,7 @@ describe("Abilities - Magic Guard", () => { it("Magic Guard prevents damage from abilities with PostFaintContactDamageAbAttr", async () => { //Tests the abilities Innards Out/Aftermath - game.override.moveset([MoveId.TACKLE]); - game.override.enemyAbility(AbilityId.AFTERMATH); + game.override.moveset([MoveId.TACKLE]).enemyAbility(AbilityId.AFTERMATH); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); @@ -377,8 +375,7 @@ describe("Abilities - Magic Guard", () => { it("Magic Guard prevents damage from abilities with PostDefendContactDamageAbAttr", async () => { //Tests the abilities Iron Barbs/Rough Skin - game.override.moveset([MoveId.TACKLE]); - game.override.enemyAbility(AbilityId.IRON_BARBS); + game.override.moveset([MoveId.TACKLE]).enemyAbility(AbilityId.IRON_BARBS); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); @@ -400,8 +397,7 @@ describe("Abilities - Magic Guard", () => { it("Magic Guard prevents damage from abilities with ReverseDrainAbAttr", async () => { //Tests the ability Liquid Ooze - game.override.moveset([MoveId.ABSORB]); - game.override.enemyAbility(AbilityId.LIQUID_OOZE); + game.override.moveset([MoveId.ABSORB]).enemyAbility(AbilityId.LIQUID_OOZE); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); @@ -422,9 +418,7 @@ describe("Abilities - Magic Guard", () => { }); it("Magic Guard prevents HP loss from abilities with PostWeatherLapseDamageAbAttr", async () => { - //Tests the abilities Solar Power/Dry Skin - game.override.passiveAbility(AbilityId.SOLAR_POWER); - game.override.weather(WeatherType.SUNNY); + game.override.passiveAbility(AbilityId.SOLAR_POWER).weather(WeatherType.SUNNY); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); const leadPokemon = game.scene.getPlayerPokemon()!; diff --git a/test/abilities/mirror_armor.test.ts b/test/abilities/mirror_armor.test.ts index 540a3b5d426..71b072c7d06 100644 --- a/test/abilities/mirror_armor.test.ts +++ b/test/abilities/mirror_armor.test.ts @@ -37,8 +37,7 @@ describe("Ability - Mirror Armor", () => { }); it("Player side + single battle Intimidate - opponent loses stats", async () => { - game.override.ability(AbilityId.MIRROR_ARMOR); - game.override.enemyAbility(AbilityId.INTIMIDATE); + game.override.ability(AbilityId.MIRROR_ARMOR).enemyAbility(AbilityId.INTIMIDATE); await game.classicMode.startBattle([SpeciesId.BULBASAUR]); const enemyPokemon = game.scene.getEnemyPokemon()!; @@ -54,8 +53,7 @@ describe("Ability - Mirror Armor", () => { }); it("Enemy side + single battle Intimidate - player loses stats", async () => { - game.override.enemyAbility(AbilityId.MIRROR_ARMOR); - game.override.ability(AbilityId.INTIMIDATE); + game.override.enemyAbility(AbilityId.MIRROR_ARMOR).ability(AbilityId.INTIMIDATE); await game.classicMode.startBattle([SpeciesId.BULBASAUR]); const enemyPokemon = game.scene.getEnemyPokemon()!; @@ -71,9 +69,7 @@ describe("Ability - Mirror Armor", () => { }); it("Player side + double battle Intimidate - opponents each lose -2 atk", async () => { - game.override.battleStyle("double"); - game.override.ability(AbilityId.MIRROR_ARMOR); - game.override.enemyAbility(AbilityId.INTIMIDATE); + game.override.battleStyle("double").ability(AbilityId.MIRROR_ARMOR).enemyAbility(AbilityId.INTIMIDATE); await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.CHARMANDER]); const [enemy1, enemy2] = game.scene.getEnemyField(); @@ -93,9 +89,7 @@ describe("Ability - Mirror Armor", () => { }); it("Enemy side + double battle Intimidate - players each lose -2 atk", async () => { - game.override.battleStyle("double"); - game.override.enemyAbility(AbilityId.MIRROR_ARMOR); - game.override.ability(AbilityId.INTIMIDATE); + game.override.battleStyle("double").enemyAbility(AbilityId.MIRROR_ARMOR).ability(AbilityId.INTIMIDATE); await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.CHARMANDER]); const [enemy1, enemy2] = game.scene.getEnemyField(); @@ -115,8 +109,7 @@ describe("Ability - Mirror Armor", () => { }); it("Player side + single battle Intimidate + Tickle - opponent loses stats", async () => { - game.override.ability(AbilityId.MIRROR_ARMOR); - game.override.enemyAbility(AbilityId.INTIMIDATE); + game.override.ability(AbilityId.MIRROR_ARMOR).enemyAbility(AbilityId.INTIMIDATE); await game.classicMode.startBattle([SpeciesId.BULBASAUR]); const enemyPokemon = game.scene.getEnemyPokemon()!; @@ -134,9 +127,7 @@ describe("Ability - Mirror Armor", () => { }); it("Player side + double battle Intimidate + Tickle - opponents each lose -3 atk, -1 def", async () => { - game.override.battleStyle("double"); - game.override.ability(AbilityId.MIRROR_ARMOR); - game.override.enemyAbility(AbilityId.INTIMIDATE); + game.override.battleStyle("double").ability(AbilityId.MIRROR_ARMOR).enemyAbility(AbilityId.INTIMIDATE); await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.CHARMANDER]); const [enemy1, enemy2] = game.scene.getEnemyField(); @@ -159,8 +150,7 @@ describe("Ability - Mirror Armor", () => { }); it("Enemy side + single battle Intimidate + Tickle - player loses stats", async () => { - game.override.enemyAbility(AbilityId.MIRROR_ARMOR); - game.override.ability(AbilityId.INTIMIDATE); + game.override.enemyAbility(AbilityId.MIRROR_ARMOR).ability(AbilityId.INTIMIDATE); await game.classicMode.startBattle([SpeciesId.BULBASAUR]); const enemyPokemon = game.scene.getEnemyPokemon()!; @@ -178,8 +168,7 @@ describe("Ability - Mirror Armor", () => { }); it("Player side + single battle Intimidate + oppoenent has white smoke - no one loses stats", async () => { - game.override.enemyAbility(AbilityId.WHITE_SMOKE); - game.override.ability(AbilityId.MIRROR_ARMOR); + game.override.enemyAbility(AbilityId.WHITE_SMOKE).ability(AbilityId.MIRROR_ARMOR); await game.classicMode.startBattle([SpeciesId.BULBASAUR]); const enemyPokemon = game.scene.getEnemyPokemon()!; @@ -197,8 +186,7 @@ describe("Ability - Mirror Armor", () => { }); it("Enemy side + single battle Intimidate + player has white smoke - no one loses stats", async () => { - game.override.ability(AbilityId.WHITE_SMOKE); - game.override.enemyAbility(AbilityId.MIRROR_ARMOR); + game.override.ability(AbilityId.WHITE_SMOKE).enemyAbility(AbilityId.MIRROR_ARMOR); await game.classicMode.startBattle([SpeciesId.BULBASAUR]); const enemyPokemon = game.scene.getEnemyPokemon()!; @@ -252,9 +240,7 @@ describe("Ability - Mirror Armor", () => { }); it("Both sides have mirror armor - does not loop, player loses attack", async () => { - game.override.enemyAbility(AbilityId.MIRROR_ARMOR); - game.override.ability(AbilityId.MIRROR_ARMOR); - game.override.ability(AbilityId.INTIMIDATE); + game.override.enemyAbility(AbilityId.MIRROR_ARMOR).ability(AbilityId.MIRROR_ARMOR).ability(AbilityId.INTIMIDATE); await game.classicMode.startBattle([SpeciesId.BULBASAUR]); const enemyPokemon = game.scene.getEnemyPokemon()!; @@ -288,8 +274,7 @@ describe("Ability - Mirror Armor", () => { }); it("Double battle + sticky web applied player side - player switches out and enemy 1 should lose -1 speed", async () => { - game.override.battleStyle("double"); - game.override.ability(AbilityId.MIRROR_ARMOR); + game.override.battleStyle("double").ability(AbilityId.MIRROR_ARMOR); await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.CHARMANDER, SpeciesId.SQUIRTLE]); const [enemy1, enemy2] = game.scene.getEnemyField(); diff --git a/test/abilities/moxie.test.ts b/test/abilities/moxie.test.ts index 8b658f60bf6..7631a0dfd2d 100644 --- a/test/abilities/moxie.test.ts +++ b/test/abilities/moxie.test.ts @@ -27,13 +27,14 @@ describe("Abilities - Moxie", () => { beforeEach(() => { game = new GameManager(phaserGame); const moveToUse = MoveId.AERIAL_ACE; - game.override.battleStyle("single"); - game.override.enemySpecies(SpeciesId.RATTATA); - game.override.enemyAbility(AbilityId.MOXIE); - game.override.ability(AbilityId.MOXIE); - game.override.startingLevel(2000); - game.override.moveset([moveToUse]); - game.override.enemyMoveset(MoveId.SPLASH); + game.override + .battleStyle("single") + .enemySpecies(SpeciesId.RATTATA) + .enemyAbility(AbilityId.MOXIE) + .ability(AbilityId.MOXIE) + .startingLevel(2000) + .moveset([moveToUse]) + .enemyMoveset(MoveId.SPLASH); }); it("should raise ATK stat stage by 1 when winning a battle", async () => { diff --git a/test/abilities/normalize.test.ts b/test/abilities/normalize.test.ts index 821ce9589a1..2e000e76a27 100644 --- a/test/abilities/normalize.test.ts +++ b/test/abilities/normalize.test.ts @@ -45,8 +45,9 @@ describe("Abilities - Normalize", () => { }); it("should not apply the old type boost item after changing a move's type", async () => { - game.override.startingHeldItems([{ name: "ATTACK_TYPE_BOOSTER", count: 1, type: PokemonType.GRASS }]); - game.override.moveset([MoveId.LEAFAGE]); + game.override + .startingHeldItems([{ name: "ATTACK_TYPE_BOOSTER", count: 1, type: PokemonType.GRASS }]) + .moveset([MoveId.LEAFAGE]); const powerSpy = vi.spyOn(allMoves[MoveId.LEAFAGE], "calculateBattlePower"); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); @@ -58,8 +59,9 @@ describe("Abilities - Normalize", () => { }); it("should apply silk scarf's power boost after changing a move's type", async () => { - game.override.startingHeldItems([{ name: "ATTACK_TYPE_BOOSTER", count: 1, type: PokemonType.NORMAL }]); - game.override.moveset([MoveId.LEAFAGE]); + game.override + .startingHeldItems([{ name: "ATTACK_TYPE_BOOSTER", count: 1, type: PokemonType.NORMAL }]) + .moveset([MoveId.LEAFAGE]); const powerSpy = vi.spyOn(allMoves[MoveId.LEAFAGE], "calculateBattlePower"); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); diff --git a/test/abilities/parental_bond.test.ts b/test/abilities/parental_bond.test.ts index 73efd0f57e2..f9bd703d751 100644 --- a/test/abilities/parental_bond.test.ts +++ b/test/abilities/parental_bond.test.ts @@ -26,14 +26,15 @@ describe("Abilities - Parental Bond", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - game.override.disableCrits(); - game.override.ability(AbilityId.PARENTAL_BOND); - game.override.enemySpecies(SpeciesId.SNORLAX); - game.override.enemyAbility(AbilityId.FUR_COAT); - game.override.enemyMoveset(MoveId.SPLASH); - game.override.startingLevel(100); - game.override.enemyLevel(100); + game.override + .battleStyle("single") + .disableCrits() + .ability(AbilityId.PARENTAL_BOND) + .enemySpecies(SpeciesId.SNORLAX) + .enemyAbility(AbilityId.FUR_COAT) + .enemyMoveset(MoveId.SPLASH) + .startingLevel(100) + .enemyLevel(100); }); it("should add second strike to attack move", async () => { @@ -61,8 +62,7 @@ describe("Abilities - Parental Bond", () => { }); it("should apply secondary effects to both strikes", async () => { - game.override.moveset([MoveId.POWER_UP_PUNCH]); - game.override.enemySpecies(SpeciesId.AMOONGUSS); + game.override.moveset([MoveId.POWER_UP_PUNCH]).enemySpecies(SpeciesId.AMOONGUSS); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); @@ -148,8 +148,7 @@ describe("Abilities - Parental Bond", () => { }); it("should not apply multiplier to counter moves", async () => { - game.override.moveset([MoveId.COUNTER]); - game.override.enemyMoveset([MoveId.TACKLE]); + game.override.moveset([MoveId.COUNTER]).enemyMoveset([MoveId.TACKLE]); await game.classicMode.startBattle([SpeciesId.SHUCKLE]); @@ -167,9 +166,7 @@ describe("Abilities - Parental Bond", () => { }); it("should not apply to multi-target moves", async () => { - game.override.battleStyle("double"); - game.override.moveset([MoveId.EARTHQUAKE]); - game.override.passiveAbility(AbilityId.LEVITATE); + game.override.battleStyle("double").moveset([MoveId.EARTHQUAKE]).passiveAbility(AbilityId.LEVITATE); await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.FEEBAS]); @@ -237,8 +234,7 @@ describe("Abilities - Parental Bond", () => { }); it("Moves boosted by this ability and Multi-Lens should strike 3 times", async () => { - game.override.moveset([MoveId.TACKLE]); - game.override.startingHeldItems([{ name: "MULTI_LENS", count: 1 }]); + game.override.moveset([MoveId.TACKLE]).startingHeldItems([{ name: "MULTI_LENS", count: 1 }]); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); @@ -252,8 +248,7 @@ describe("Abilities - Parental Bond", () => { }); it("Seismic Toss boosted by this ability and Multi-Lens should strike 3 times", async () => { - game.override.moveset([MoveId.SEISMIC_TOSS]); - game.override.startingHeldItems([{ name: "MULTI_LENS", count: 1 }]); + game.override.moveset([MoveId.SEISMIC_TOSS]).startingHeldItems([{ name: "MULTI_LENS", count: 1 }]); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); @@ -378,8 +373,7 @@ describe("Abilities - Parental Bond", () => { }); it("should not cause user to hit into King's Shield more than once", async () => { - game.override.moveset([MoveId.TACKLE]); - game.override.enemyMoveset([MoveId.KINGS_SHIELD]); + game.override.moveset([MoveId.TACKLE]).enemyMoveset([MoveId.KINGS_SHIELD]); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); @@ -393,8 +387,7 @@ describe("Abilities - Parental Bond", () => { }); it("should not cause user to hit into Storm Drain more than once", async () => { - game.override.moveset([MoveId.WATER_GUN]); - game.override.enemyAbility(AbilityId.STORM_DRAIN); + game.override.moveset([MoveId.WATER_GUN]).enemyAbility(AbilityId.STORM_DRAIN); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); diff --git a/test/abilities/perish_body.test.ts b/test/abilities/perish_body.test.ts index 9668bf349a8..5b98aab5f6c 100644 --- a/test/abilities/perish_body.test.ts +++ b/test/abilities/perish_body.test.ts @@ -21,19 +21,18 @@ describe("Abilities - Perish Song", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - game.override.disableCrits(); - - game.override.enemySpecies(SpeciesId.MAGIKARP); - game.override.enemyAbility(AbilityId.BALL_FETCH); - - game.override.starterSpecies(SpeciesId.CURSOLA); - game.override.ability(AbilityId.PERISH_BODY); - game.override.moveset([MoveId.SPLASH]); + game.override + .battleStyle("single") + .disableCrits() + .enemySpecies(SpeciesId.MAGIKARP) + .enemyAbility(AbilityId.BALL_FETCH) + .starterSpecies(SpeciesId.CURSOLA) + .ability(AbilityId.PERISH_BODY) + .moveset([MoveId.SPLASH]) + .enemyMoveset([MoveId.AQUA_JET]); }); it("should trigger when hit with damaging move", async () => { - game.override.enemyMoveset([MoveId.AQUA_JET]); await game.classicMode.startBattle(); const cursola = game.scene.getPlayerPokemon(); const magikarp = game.scene.getEnemyPokemon(); @@ -46,7 +45,7 @@ describe("Abilities - Perish Song", () => { }); it("should trigger even when fainting", async () => { - game.override.enemyMoveset([MoveId.AQUA_JET]).enemyLevel(100).startingLevel(1); + game.override.enemyLevel(100).startingLevel(1); await game.classicMode.startBattle([SpeciesId.CURSOLA, SpeciesId.FEEBAS]); const magikarp = game.scene.getEnemyPokemon(); @@ -87,9 +86,10 @@ describe("Abilities - Perish Song", () => { }); it("should activate if cursola already has perish song, but not reset its counter", async () => { - game.override.enemyMoveset([MoveId.PERISH_SONG, MoveId.AQUA_JET, MoveId.SPLASH]); - game.override.moveset([MoveId.WHIRLWIND, MoveId.SPLASH]); - game.override.startingWave(5); + game.override + .enemyMoveset([MoveId.PERISH_SONG, MoveId.AQUA_JET, MoveId.SPLASH]) + .moveset([MoveId.WHIRLWIND, MoveId.SPLASH]) + .startingWave(5); await game.classicMode.startBattle([SpeciesId.CURSOLA]); const cursola = game.scene.getPlayerPokemon(); diff --git a/test/abilities/power_construct.test.ts b/test/abilities/power_construct.test.ts index f8e3de802e6..2ea14597ef9 100644 --- a/test/abilities/power_construct.test.ts +++ b/test/abilities/power_construct.test.ts @@ -35,8 +35,7 @@ describe("Abilities - POWER CONSTRUCT", () => { test("check if fainted 50% Power Construct Pokemon switches to base form on arena reset", async () => { const baseForm = 2, completeForm = 4; - game.override.startingWave(4); - game.override.starterForms({ + game.override.startingWave(4).starterForms({ [SpeciesId.ZYGARDE]: completeForm, }); @@ -62,8 +61,7 @@ describe("Abilities - POWER CONSTRUCT", () => { test("check if fainted 10% Power Construct Pokemon switches to base form on arena reset", async () => { const baseForm = 3, completeForm = 5; - game.override.startingWave(4); - game.override.starterForms({ + game.override.startingWave(4).starterForms({ [SpeciesId.ZYGARDE]: completeForm, }); diff --git a/test/abilities/power_spot.test.ts b/test/abilities/power_spot.test.ts index 5e6cbce7742..11f75588386 100644 --- a/test/abilities/power_spot.test.ts +++ b/test/abilities/power_spot.test.ts @@ -26,11 +26,12 @@ describe("Abilities - Power Spot", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("double"); - game.override.moveset([MoveId.TACKLE, MoveId.BREAKING_SWIPE, MoveId.SPLASH, MoveId.DAZZLING_GLEAM]); - game.override.enemyMoveset(MoveId.SPLASH); - game.override.enemySpecies(SpeciesId.SHUCKLE); - game.override.enemyAbility(AbilityId.BALL_FETCH); + game.override + .battleStyle("double") + .moveset([MoveId.TACKLE, MoveId.BREAKING_SWIPE, MoveId.SPLASH, MoveId.DAZZLING_GLEAM]) + .enemyMoveset(MoveId.SPLASH) + .enemySpecies(SpeciesId.SHUCKLE) + .enemyAbility(AbilityId.BALL_FETCH); }); it("raises the power of allies' special moves by 30%", async () => { diff --git a/test/abilities/protean.test.ts b/test/abilities/protean.test.ts index a0b04fa0be5..09c9addbc35 100644 --- a/test/abilities/protean.test.ts +++ b/test/abilities/protean.test.ts @@ -108,8 +108,7 @@ describe("Abilities - Protean", () => { }); test("ability applies correctly even if the type has changed by another ability", async () => { - game.override.moveset([MoveId.TACKLE]); - game.override.passiveAbility(AbilityId.REFRIGERATE); + game.override.moveset([MoveId.TACKLE]).passiveAbility(AbilityId.REFRIGERATE); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); @@ -156,8 +155,7 @@ describe("Abilities - Protean", () => { }); test("ability applies correctly even if the pokemon's move misses", async () => { - game.override.moveset([MoveId.TACKLE]); - game.override.enemyMoveset(MoveId.SPLASH); + game.override.moveset([MoveId.TACKLE]).enemyMoveset(MoveId.SPLASH); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); @@ -188,8 +186,7 @@ describe("Abilities - Protean", () => { }); test("ability applies correctly even if the pokemon's move fails because of type immunity", async () => { - game.override.moveset([MoveId.TACKLE]); - game.override.enemySpecies(SpeciesId.GASTLY); + game.override.moveset([MoveId.TACKLE]).enemySpecies(SpeciesId.GASTLY); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); @@ -262,8 +259,7 @@ describe("Abilities - Protean", () => { }); test("ability applies correctly even if the pokemon's Trick-or-Treat fails", async () => { - game.override.moveset([MoveId.TRICK_OR_TREAT]); - game.override.enemySpecies(SpeciesId.GASTLY); + game.override.moveset([MoveId.TRICK_OR_TREAT]).enemySpecies(SpeciesId.GASTLY); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); diff --git a/test/abilities/quick_draw.test.ts b/test/abilities/quick_draw.test.ts index 5e5e57fb056..02c2ff86a56 100644 --- a/test/abilities/quick_draw.test.ts +++ b/test/abilities/quick_draw.test.ts @@ -23,16 +23,15 @@ describe("Abilities - Quick Draw", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - - game.override.starterSpecies(SpeciesId.MAGIKARP); - game.override.ability(AbilityId.QUICK_DRAW); - game.override.moveset([MoveId.TACKLE, MoveId.TAIL_WHIP]); - - game.override.enemyLevel(100); - game.override.enemySpecies(SpeciesId.MAGIKARP); - game.override.enemyAbility(AbilityId.BALL_FETCH); - game.override.enemyMoveset([MoveId.TACKLE]); + game.override + .battleStyle("single") + .starterSpecies(SpeciesId.MAGIKARP) + .ability(AbilityId.QUICK_DRAW) + .moveset([MoveId.TACKLE, MoveId.TAIL_WHIP]) + .enemyLevel(100) + .enemySpecies(SpeciesId.MAGIKARP) + .enemyAbility(AbilityId.BALL_FETCH) + .enemyMoveset([MoveId.TACKLE]); vi.spyOn( allAbilities[AbilityId.QUICK_DRAW].getAttrs("BypassSpeedChanceAbAttr")[0], diff --git a/test/abilities/sand_spit.test.ts b/test/abilities/sand_spit.test.ts index 96e6380ae88..9be23e7f7c2 100644 --- a/test/abilities/sand_spit.test.ts +++ b/test/abilities/sand_spit.test.ts @@ -22,15 +22,14 @@ describe("Abilities - Sand Spit", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - game.override.disableCrits(); - - game.override.enemySpecies(SpeciesId.MAGIKARP); - game.override.enemyAbility(AbilityId.BALL_FETCH); - - game.override.starterSpecies(SpeciesId.SILICOBRA); - game.override.ability(AbilityId.SAND_SPIT); - game.override.moveset([MoveId.SPLASH, MoveId.COIL]); + game.override + .battleStyle("single") + .disableCrits() + .enemySpecies(SpeciesId.MAGIKARP) + .enemyAbility(AbilityId.BALL_FETCH) + .starterSpecies(SpeciesId.SILICOBRA) + .ability(AbilityId.SAND_SPIT) + .moveset([MoveId.SPLASH, MoveId.COIL]); }); it("should trigger when hit with damaging move", async () => { diff --git a/test/abilities/schooling.test.ts b/test/abilities/schooling.test.ts index 728e9bb7024..646beafb80f 100644 --- a/test/abilities/schooling.test.ts +++ b/test/abilities/schooling.test.ts @@ -31,8 +31,7 @@ describe("Abilities - SCHOOLING", () => { test("check if fainted pokemon switches to base form on arena reset", async () => { const soloForm = 0, schoolForm = 1; - game.override.startingWave(4); - game.override.starterForms({ + game.override.startingWave(4).starterForms({ [SpeciesId.WISHIWASHI]: schoolForm, }); diff --git a/test/abilities/screen_cleaner.test.ts b/test/abilities/screen_cleaner.test.ts index 619cc08bccf..e896d2e51f9 100644 --- a/test/abilities/screen_cleaner.test.ts +++ b/test/abilities/screen_cleaner.test.ts @@ -24,9 +24,7 @@ describe("Abilities - Screen Cleaner", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - game.override.ability(AbilityId.SCREEN_CLEANER); - game.override.enemySpecies(SpeciesId.SHUCKLE); + game.override.battleStyle("single").ability(AbilityId.SCREEN_CLEANER).enemySpecies(SpeciesId.SHUCKLE); }); it("removes Aurora Veil", async () => { diff --git a/test/abilities/seed_sower.test.ts b/test/abilities/seed_sower.test.ts index 761342bfb27..4b649275d83 100644 --- a/test/abilities/seed_sower.test.ts +++ b/test/abilities/seed_sower.test.ts @@ -22,15 +22,14 @@ describe("Abilities - Seed Sower", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - game.override.disableCrits(); - - game.override.enemySpecies(SpeciesId.MAGIKARP); - game.override.enemyAbility(AbilityId.BALL_FETCH); - - game.override.starterSpecies(SpeciesId.ARBOLIVA); - game.override.ability(AbilityId.SEED_SOWER); - game.override.moveset([MoveId.SPLASH]); + game.override + .battleStyle("single") + .disableCrits() + .enemySpecies(SpeciesId.MAGIKARP) + .enemyAbility(AbilityId.BALL_FETCH) + .starterSpecies(SpeciesId.ARBOLIVA) + .ability(AbilityId.SEED_SOWER) + .moveset([MoveId.SPLASH]); }); it("should trigger when hit with damaging move", async () => { diff --git a/test/abilities/shield_dust.test.ts b/test/abilities/shield_dust.test.ts index db1266d3088..6bb63fd16a5 100644 --- a/test/abilities/shield_dust.test.ts +++ b/test/abilities/shield_dust.test.ts @@ -26,12 +26,13 @@ describe("Abilities - Shield Dust", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - game.override.enemySpecies(SpeciesId.ONIX); - game.override.enemyAbility(AbilityId.SHIELD_DUST); - game.override.startingLevel(100); - game.override.moveset(MoveId.AIR_SLASH); - game.override.enemyMoveset(MoveId.TACKLE); + game.override + .battleStyle("single") + .enemySpecies(SpeciesId.ONIX) + .enemyAbility(AbilityId.SHIELD_DUST) + .startingLevel(100) + .moveset(MoveId.AIR_SLASH) + .enemyMoveset(MoveId.TACKLE); }); it("Shield Dust", async () => { diff --git a/test/abilities/shields_down.test.ts b/test/abilities/shields_down.test.ts index 0a7270dff31..7b4803915f1 100644 --- a/test/abilities/shields_down.test.ts +++ b/test/abilities/shields_down.test.ts @@ -26,17 +26,17 @@ describe("Abilities - SHIELDS DOWN", () => { beforeEach(() => { game = new GameManager(phaserGame); const moveToUse = MoveId.SPLASH; - game.override.battleStyle("single"); - game.override.ability(AbilityId.SHIELDS_DOWN); - game.override.moveset([moveToUse]); - game.override.enemyMoveset([MoveId.TACKLE]); + game.override + .battleStyle("single") + .ability(AbilityId.SHIELDS_DOWN) + .moveset([moveToUse]) + .enemyMoveset([MoveId.TACKLE]); }); test("check if fainted pokemon switched to base form on arena reset", async () => { const meteorForm = 0, coreForm = 7; - game.override.startingWave(4); - game.override.starterForms({ + game.override.startingWave(4).starterForms({ [SpeciesId.MINIOR]: coreForm, }); @@ -70,8 +70,7 @@ describe("Abilities - SHIELDS DOWN", () => { }); test("should still ignore non-volatile status moves used by a pokemon with mold breaker", async () => { - game.override.enemyAbility(AbilityId.MOLD_BREAKER); - game.override.enemyMoveset([MoveId.SPORE]); + game.override.enemyAbility(AbilityId.MOLD_BREAKER).enemyMoveset([MoveId.SPORE]); await game.classicMode.startBattle([SpeciesId.MINIOR]); @@ -94,8 +93,7 @@ describe("Abilities - SHIELDS DOWN", () => { }); test("should ignore status moves even through mold breaker", async () => { - game.override.enemyMoveset([MoveId.SPORE]); - game.override.enemyAbility(AbilityId.MOLD_BREAKER); + game.override.enemyMoveset([MoveId.SPORE]).enemyAbility(AbilityId.MOLD_BREAKER); await game.classicMode.startBattle([SpeciesId.MINIOR]); @@ -108,8 +106,9 @@ describe("Abilities - SHIELDS DOWN", () => { // toxic spikes currently does not poison flying types when gravity is in effect test.todo("should become poisoned by toxic spikes when grounded", async () => { - game.override.enemyMoveset([MoveId.GRAVITY, MoveId.TOXIC_SPIKES, MoveId.SPLASH]); - game.override.moveset([MoveId.GRAVITY, MoveId.SPLASH]); + game.override + .enemyMoveset([MoveId.GRAVITY, MoveId.TOXIC_SPIKES, MoveId.SPLASH]) + .moveset([MoveId.GRAVITY, MoveId.SPLASH]); await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MINIOR]); @@ -155,9 +154,7 @@ describe("Abilities - SHIELDS DOWN", () => { // the `NoTransformAbilityAbAttr` attribute is not checked anywhere, so this test cannot pass. test.todo("ditto should not be immune to status after transforming", async () => { - game.override.enemySpecies(SpeciesId.DITTO); - game.override.enemyAbility(AbilityId.IMPOSTER); - game.override.moveset([MoveId.SPLASH, MoveId.SPORE]); + game.override.enemySpecies(SpeciesId.DITTO).enemyAbility(AbilityId.IMPOSTER).moveset([MoveId.SPLASH, MoveId.SPORE]); await game.classicMode.startBattle([SpeciesId.MINIOR]); @@ -169,11 +166,12 @@ describe("Abilities - SHIELDS DOWN", () => { }); test("should not prevent minior from receiving the fainted status effect in trainer battles", async () => { - game.override.enemyMoveset([MoveId.TACKLE]); - game.override.moveset([MoveId.THUNDERBOLT]); - game.override.startingLevel(100); - game.override.startingWave(5); - game.override.enemySpecies(SpeciesId.MINIOR); + game.override + .enemyMoveset([MoveId.TACKLE]) + .moveset([MoveId.THUNDERBOLT]) + .startingLevel(100) + .startingWave(5) + .enemySpecies(SpeciesId.MINIOR); await game.classicMode.startBattle([SpeciesId.REGIELEKI]); const minior = game.scene.getEnemyPokemon()!; diff --git a/test/abilities/steely_spirit.test.ts b/test/abilities/steely_spirit.test.ts index 481e037fb4b..7a2bd98b6b1 100644 --- a/test/abilities/steely_spirit.test.ts +++ b/test/abilities/steely_spirit.test.ts @@ -28,11 +28,12 @@ describe("Abilities - Steely Spirit", () => { beforeEach(() => { ironHeadPower = allMoves[moveToCheck].power; game = new GameManager(phaserGame); - game.override.battleStyle("double"); - game.override.enemySpecies(SpeciesId.SHUCKLE); - game.override.enemyAbility(AbilityId.BALL_FETCH); - game.override.moveset([MoveId.IRON_HEAD, MoveId.SPLASH]); - game.override.enemyMoveset(MoveId.SPLASH); + game.override + .battleStyle("double") + .enemySpecies(SpeciesId.SHUCKLE) + .enemyAbility(AbilityId.BALL_FETCH) + .moveset([MoveId.IRON_HEAD, MoveId.SPLASH]) + .enemyMoveset(MoveId.SPLASH); vi.spyOn(allMoves[moveToCheck], "calculateBattlePower"); }); diff --git a/test/abilities/sturdy.test.ts b/test/abilities/sturdy.test.ts index a50e2075fea..e7b2c05040d 100644 --- a/test/abilities/sturdy.test.ts +++ b/test/abilities/sturdy.test.ts @@ -24,15 +24,14 @@ describe("Abilities - Sturdy", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - - game.override.starterSpecies(SpeciesId.LUCARIO); - game.override.startingLevel(100); - game.override.moveset([MoveId.CLOSE_COMBAT, MoveId.FISSURE]); - - game.override.enemySpecies(SpeciesId.ARON); - game.override.enemyLevel(5); - game.override.enemyAbility(AbilityId.STURDY); + game.override + .battleStyle("single") + .starterSpecies(SpeciesId.LUCARIO) + .startingLevel(100) + .moveset([MoveId.CLOSE_COMBAT, MoveId.FISSURE]) + .enemySpecies(SpeciesId.ARON) + .enemyLevel(5) + .enemyAbility(AbilityId.STURDY); }); test("Sturdy activates when user is at full HP", async () => { diff --git a/test/abilities/sweet_veil.test.ts b/test/abilities/sweet_veil.test.ts index 8a31e676ec5..ed9cb20afcc 100644 --- a/test/abilities/sweet_veil.test.ts +++ b/test/abilities/sweet_veil.test.ts @@ -69,10 +69,7 @@ describe("Abilities - Sweet Veil", () => { }); it("prevents the user and its allies already drowsy due to Yawn from falling asleep.", async () => { - game.override.enemySpecies(SpeciesId.PIKACHU); - game.override.enemyLevel(5); - game.override.startingLevel(5); - game.override.enemyMoveset(MoveId.SPLASH); + game.override.enemySpecies(SpeciesId.PIKACHU).enemyLevel(5).startingLevel(5).enemyMoveset(MoveId.SPLASH); await game.classicMode.startBattle([SpeciesId.SHUCKLE, SpeciesId.SHUCKLE, SpeciesId.SWIRLIX]); diff --git a/test/abilities/unseen_fist.test.ts b/test/abilities/unseen_fist.test.ts index 56408c6cbc3..26de77d4643 100644 --- a/test/abilities/unseen_fist.test.ts +++ b/test/abilities/unseen_fist.test.ts @@ -51,8 +51,7 @@ describe("Abilities - Unseen Fist", () => { await testUnseenFistHitResult(game, MoveId.BULLDOZE, MoveId.WIDE_GUARD, false)); it("should cause a contact move to ignore Protect, but not Substitute", async () => { - game.override.enemyLevel(1); - game.override.moveset([MoveId.TACKLE]); + game.override.enemyLevel(1).moveset([MoveId.TACKLE]); await game.classicMode.startBattle(); diff --git a/test/abilities/volt_absorb.test.ts b/test/abilities/volt_absorb.test.ts index 34dbbbd4783..707a889f951 100644 --- a/test/abilities/volt_absorb.test.ts +++ b/test/abilities/volt_absorb.test.ts @@ -3,11 +3,11 @@ import { TurnEndPhase } from "#app/phases/turn-end-phase"; import { AbilityId } from "#enums/ability-id"; import { BattlerTagType } from "#enums/battler-tag-type"; import { MoveId } from "#enums/move-id"; -import { SpeciesId } from "#enums/species-id"; import GameManager from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { BattlerIndex } from "#enums/battler-index"; +import { SpeciesId } from "#enums/species-id"; // See also: TypeImmunityAbAttr describe("Abilities - Volt Absorb", () => { @@ -26,19 +26,19 @@ describe("Abilities - Volt Absorb", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - game.override.disableCrits(); + game.override.battleStyle("single").disableCrits(); }); it("does not activate when CHARGE is used", async () => { const moveToUse = MoveId.CHARGE; const ability = AbilityId.VOLT_ABSORB; - game.override.moveset([moveToUse]); - game.override.ability(ability); - game.override.enemyMoveset([MoveId.SPLASH, MoveId.NONE, MoveId.NONE, MoveId.NONE]); - game.override.enemySpecies(SpeciesId.DUSKULL); - game.override.enemyAbility(AbilityId.BALL_FETCH); + game.override + .moveset([moveToUse]) + .ability(ability) + .enemyMoveset([MoveId.SPLASH]) + .enemySpecies(SpeciesId.DUSKULL) + .enemyAbility(AbilityId.BALL_FETCH); await game.classicMode.startBattle(); @@ -54,10 +54,11 @@ describe("Abilities - Volt Absorb", () => { }); it("should activate regardless of accuracy checks", async () => { - game.override.moveset(MoveId.THUNDERBOLT); - game.override.enemyMoveset(MoveId.SPLASH); - game.override.enemySpecies(SpeciesId.MAGIKARP); - game.override.enemyAbility(AbilityId.VOLT_ABSORB); + game.override + .moveset(MoveId.THUNDERBOLT) + .enemyMoveset(MoveId.SPLASH) + .enemySpecies(SpeciesId.MAGIKARP) + .enemyAbility(AbilityId.VOLT_ABSORB); await game.classicMode.startBattle(); @@ -74,10 +75,11 @@ describe("Abilities - Volt Absorb", () => { }); it("regardless of accuracy should not trigger on pokemon in semi invulnerable state", async () => { - game.override.moveset(MoveId.THUNDERBOLT); - game.override.enemyMoveset(MoveId.DIVE); - game.override.enemySpecies(SpeciesId.MAGIKARP); - game.override.enemyAbility(AbilityId.VOLT_ABSORB); + game.override + .moveset(MoveId.THUNDERBOLT) + .enemyMoveset(MoveId.DIVE) + .enemySpecies(SpeciesId.MAGIKARP) + .enemyAbility(AbilityId.VOLT_ABSORB); await game.classicMode.startBattle(); diff --git a/test/abilities/wind_power.test.ts b/test/abilities/wind_power.test.ts index a7b4d525a56..8e657997008 100644 --- a/test/abilities/wind_power.test.ts +++ b/test/abilities/wind_power.test.ts @@ -23,14 +23,15 @@ describe("Abilities - Wind Power", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - game.override.enemySpecies(SpeciesId.SHIFTRY); - game.override.enemyAbility(AbilityId.WIND_POWER); - game.override.moveset([MoveId.TAILWIND, MoveId.SPLASH, MoveId.PETAL_BLIZZARD, MoveId.SANDSTORM]); - game.override.enemyMoveset(MoveId.SPLASH); + game.override + .battleStyle("single") + .enemySpecies(SpeciesId.SHIFTRY) + .enemyAbility(AbilityId.WIND_POWER) + .moveset([MoveId.TAILWIND, MoveId.SPLASH, MoveId.PETAL_BLIZZARD, MoveId.SANDSTORM]) + .enemyMoveset(MoveId.SPLASH); }); - it("it becomes charged when hit by wind moves", async () => { + it("becomes charged when hit by wind moves", async () => { await game.classicMode.startBattle([SpeciesId.MAGIKARP]); const shiftry = game.scene.getEnemyPokemon()!; @@ -42,9 +43,8 @@ describe("Abilities - Wind Power", () => { expect(shiftry.getTag(BattlerTagType.CHARGED)).toBeDefined(); }); - it("it becomes charged when Tailwind takes effect on its side", async () => { - game.override.ability(AbilityId.WIND_POWER); - game.override.enemySpecies(SpeciesId.MAGIKARP); + it("becomes charged when Tailwind takes effect on its side", async () => { + game.override.ability(AbilityId.WIND_POWER).enemySpecies(SpeciesId.MAGIKARP); await game.classicMode.startBattle([SpeciesId.SHIFTRY]); const shiftry = game.scene.getPlayerPokemon()!; @@ -58,8 +58,7 @@ describe("Abilities - Wind Power", () => { }); it("does not become charged when Tailwind takes effect on opposing side", async () => { - game.override.enemySpecies(SpeciesId.MAGIKARP); - game.override.ability(AbilityId.WIND_POWER); + game.override.enemySpecies(SpeciesId.MAGIKARP).ability(AbilityId.WIND_POWER); await game.classicMode.startBattle([SpeciesId.SHIFTRY]); const magikarp = game.scene.getEnemyPokemon()!; diff --git a/test/abilities/wonder_skin.test.ts b/test/abilities/wonder_skin.test.ts index 933d3653580..886882ab6fd 100644 --- a/test/abilities/wonder_skin.test.ts +++ b/test/abilities/wonder_skin.test.ts @@ -23,12 +23,13 @@ describe("Abilities - Wonder Skin", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - game.override.moveset([MoveId.TACKLE, MoveId.CHARM]); - game.override.ability(AbilityId.BALL_FETCH); - game.override.enemySpecies(SpeciesId.SHUCKLE); - game.override.enemyAbility(AbilityId.WONDER_SKIN); - game.override.enemyMoveset(MoveId.SPLASH); + game.override + .battleStyle("single") + .moveset([MoveId.TACKLE, MoveId.CHARM]) + .ability(AbilityId.BALL_FETCH) + .enemySpecies(SpeciesId.SHUCKLE) + .enemyAbility(AbilityId.WONDER_SKIN) + .enemyMoveset(MoveId.SPLASH); }); it("lowers accuracy of status moves to 50%", async () => { diff --git a/test/abilities/zen_mode.test.ts b/test/abilities/zen_mode.test.ts index 163df7b1853..70d2f564218 100644 --- a/test/abilities/zen_mode.test.ts +++ b/test/abilities/zen_mode.test.ts @@ -85,8 +85,7 @@ describe("Abilities - ZEN MODE", () => { }); it("should switch to base form on arena reset", async () => { - game.override.startingWave(4); - game.override.starterForms({ + game.override.startingWave(4).starterForms({ [SpeciesId.DARMANITAN]: zenForm, }); diff --git a/test/abilities/zero_to_hero.test.ts b/test/abilities/zero_to_hero.test.ts index 90e10c89ca1..7d0128a4dbc 100644 --- a/test/abilities/zero_to_hero.test.ts +++ b/test/abilities/zero_to_hero.test.ts @@ -34,8 +34,7 @@ describe("Abilities - ZERO TO HERO", () => { }); it("should swap to base form on arena reset", async () => { - game.override.startingWave(4); - game.override.starterForms({ + game.override.startingWave(4).starterForms({ [SpeciesId.PALAFIN]: heroForm, }); diff --git a/test/achievements/achievement.test.ts b/test/achievements/achievement.test.ts index 0b49c4d23ab..5a74c77fe6a 100644 --- a/test/achievements/achievement.test.ts +++ b/test/achievements/achievement.test.ts @@ -130,12 +130,6 @@ describe("RibbonAchv", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.moveset([]); - game.override.startingLevel(0); - game.override.starterSpecies(0); - game.override.enemyMoveset([]); - game.override.enemySpecies(0); - game.override.startingWave(0); scene = game.scene; }); diff --git a/test/arena/weather_fog.test.ts b/test/arena/weather_fog.test.ts index 24c07d26cba..e6984e13bd0 100644 --- a/test/arena/weather_fog.test.ts +++ b/test/arena/weather_fog.test.ts @@ -24,12 +24,14 @@ describe("Weather - Fog", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.weather(WeatherType.FOG).battleStyle("single"); - game.override.moveset([MoveId.TACKLE]); - game.override.ability(AbilityId.BALL_FETCH); - game.override.enemyAbility(AbilityId.BALL_FETCH); - game.override.enemySpecies(SpeciesId.MAGIKARP); - game.override.enemyMoveset([MoveId.SPLASH]); + game.override + .weather(WeatherType.FOG) + .battleStyle("single") + .moveset([MoveId.TACKLE]) + .ability(AbilityId.BALL_FETCH) + .enemyAbility(AbilityId.BALL_FETCH) + .enemySpecies(SpeciesId.MAGIKARP) + .enemyMoveset([MoveId.SPLASH]); }); it("move accuracy is multiplied by 90%", async () => { diff --git a/test/arena/weather_strong_winds.test.ts b/test/arena/weather_strong_winds.test.ts index 8b3c2562e6f..d0d256816eb 100644 --- a/test/arena/weather_strong_winds.test.ts +++ b/test/arena/weather_strong_winds.test.ts @@ -24,11 +24,12 @@ describe("Weather - Strong Winds", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - game.override.startingLevel(10); - game.override.enemySpecies(SpeciesId.TAILLOW); - game.override.enemyAbility(AbilityId.DELTA_STREAM); - game.override.moveset([MoveId.THUNDERBOLT, MoveId.ICE_BEAM, MoveId.ROCK_SLIDE]); + game.override + .battleStyle("single") + .startingLevel(10) + .enemySpecies(SpeciesId.TAILLOW) + .enemyAbility(AbilityId.DELTA_STREAM) + .moveset([MoveId.THUNDERBOLT, MoveId.ICE_BEAM, MoveId.ROCK_SLIDE]); }); it("electric type move is not very effective on Rayquaza", async () => { diff --git a/test/battle/battle-order.test.ts b/test/battle/battle-order.test.ts index c12760a7f30..c969e1767a3 100644 --- a/test/battle/battle-order.test.ts +++ b/test/battle/battle-order.test.ts @@ -24,11 +24,12 @@ describe("Battle order", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - game.override.enemySpecies(SpeciesId.MEWTWO); - game.override.enemyAbility(AbilityId.INSOMNIA); - game.override.ability(AbilityId.INSOMNIA); - game.override.moveset([MoveId.TACKLE]); + game.override + .battleStyle("single") + .enemySpecies(SpeciesId.MEWTWO) + .enemyAbility(AbilityId.INSOMNIA) + .ability(AbilityId.INSOMNIA) + .moveset([MoveId.TACKLE]); }); it("opponent faster than player 50 vs 150", async () => { diff --git a/test/battle/battle.test.ts b/test/battle/battle.test.ts index 3eab06e2f48..60e09607ffe 100644 --- a/test/battle/battle.test.ts +++ b/test/battle/battle.test.ts @@ -10,13 +10,11 @@ import { EnemyCommandPhase } from "#app/phases/enemy-command-phase"; import { LoginPhase } from "#app/phases/login-phase"; import { NextEncounterPhase } from "#app/phases/next-encounter-phase"; import { SelectGenderPhase } from "#app/phases/select-gender-phase"; -import { SelectModifierPhase } from "#app/phases/select-modifier-phase"; import { SelectStarterPhase } from "#app/phases/select-starter-phase"; import { SummonPhase } from "#app/phases/summon-phase"; import { SwitchPhase } from "#app/phases/switch-phase"; import { TitlePhase } from "#app/phases/title-phase"; import { TurnInitPhase } from "#app/phases/turn-init-phase"; -import { VictoryPhase } from "#app/phases/victory-phase"; import GameManager from "#test/testUtils/gameManager"; import { generateStarter } from "#test/testUtils/gameManagerUtils"; import { UiMode } from "#enums/ui-mode"; @@ -92,28 +90,22 @@ describe("Test Battle Phase", () => { }, 20000); it("do attack wave 3 - single battle - regular - OHKO", async () => { - game.override.starterSpecies(SpeciesId.MEWTWO); - game.override.enemySpecies(SpeciesId.RATTATA); - game.override.startingLevel(2000); - game.override.startingWave(3).battleStyle("single"); - game.override.moveset([MoveId.TACKLE]); - game.override.enemyAbility(AbilityId.HYDRATION); - game.override.enemyMoveset([MoveId.TACKLE, MoveId.TACKLE, MoveId.TACKLE, MoveId.TACKLE]); - await game.classicMode.startBattle(); - game.move.select(MoveId.TACKLE); - await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(SelectModifierPhase, false); + game.override.enemySpecies(SpeciesId.RATTATA).startingLevel(2000).battleStyle("single"); + await game.classicMode.startBattle([SpeciesId.MEWTWO]); + game.move.use(MoveId.TACKLE); + await game.phaseInterceptor.to("SelectModifierPhase"); }, 20000); it("do attack wave 3 - single battle - regular - NO OHKO with opponent using non damage attack", async () => { - game.override.starterSpecies(SpeciesId.MEWTWO); - game.override.enemySpecies(SpeciesId.RATTATA); - game.override.startingLevel(5); - game.override.startingWave(3); - game.override.moveset([MoveId.TACKLE]); - game.override.enemyAbility(AbilityId.HYDRATION); - game.override.enemyMoveset([MoveId.TAIL_WHIP, MoveId.TAIL_WHIP, MoveId.TAIL_WHIP, MoveId.TAIL_WHIP]); - game.override.battleStyle("single"); - await game.classicMode.startBattle(); + game.override + .enemySpecies(SpeciesId.RATTATA) + .startingLevel(5) + .startingWave(3) + .moveset([MoveId.TACKLE]) + .enemyAbility(AbilityId.HYDRATION) + .enemyMoveset([MoveId.TAIL_WHIP, MoveId.TAIL_WHIP, MoveId.TAIL_WHIP, MoveId.TAIL_WHIP]) + .battleStyle("single"); + await game.classicMode.startBattle([SpeciesId.MEWTWO]); game.move.select(MoveId.TACKLE); await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(TurnInitPhase, false); }, 20000); @@ -247,36 +239,37 @@ describe("Test Battle Phase", () => { it("kill opponent pokemon", async () => { const moveToUse = MoveId.SPLASH; - game.override.battleStyle("single"); - game.override.starterSpecies(SpeciesId.MEWTWO); - game.override.enemySpecies(SpeciesId.RATTATA); - game.override.enemyAbility(AbilityId.HYDRATION); - game.override.ability(AbilityId.ZEN_MODE); - game.override.startingLevel(2000); - game.override.startingWave(3); - game.override.moveset([moveToUse]); - game.override.enemyMoveset([MoveId.TACKLE, MoveId.TACKLE, MoveId.TACKLE, MoveId.TACKLE]); + game.override + .battleStyle("single") + .starterSpecies(SpeciesId.MEWTWO) + .enemySpecies(SpeciesId.RATTATA) + .enemyAbility(AbilityId.HYDRATION) + .ability(AbilityId.ZEN_MODE) + .startingLevel(2000) + .startingWave(3) + .moveset([moveToUse]) + .enemyMoveset([MoveId.TACKLE, MoveId.TACKLE, MoveId.TACKLE, MoveId.TACKLE]); await game.classicMode.startBattle([SpeciesId.DARMANITAN, SpeciesId.CHARIZARD]); game.move.select(moveToUse); await game.phaseInterceptor.to(DamageAnimPhase, false); await game.killPokemon(game.scene.currentBattle.enemyParty[0]); expect(game.scene.currentBattle.enemyParty[0].isFainted()).toBe(true); - await game.phaseInterceptor.to(VictoryPhase, false); - }, 200000); + await game.phaseInterceptor.to("VictoryPhase"); + }); it("to next turn", async () => { const moveToUse = MoveId.SPLASH; - game.override.battleStyle("single"); - game.override.starterSpecies(SpeciesId.MEWTWO); - game.override.enemySpecies(SpeciesId.RATTATA); - game.override.enemyAbility(AbilityId.HYDRATION); - game.override.ability(AbilityId.ZEN_MODE); - game.override.startingLevel(2000); - game.override.startingWave(3); - game.override.moveset([moveToUse]); - game.override.enemyMoveset([MoveId.TACKLE, MoveId.TACKLE, MoveId.TACKLE, MoveId.TACKLE]); - await game.classicMode.startBattle(); + game.override + .battleStyle("single") + .enemySpecies(SpeciesId.RATTATA) + .enemyAbility(AbilityId.HYDRATION) + .ability(AbilityId.ZEN_MODE) + .startingLevel(2000) + .startingWave(3) + .moveset([moveToUse]) + .enemyMoveset([MoveId.TACKLE, MoveId.TACKLE, MoveId.TACKLE, MoveId.TACKLE]); + await game.classicMode.startBattle([SpeciesId.MEWTWO]); const turn = game.scene.currentBattle.turn; game.move.select(moveToUse); await game.toNextTurn(); @@ -294,8 +287,8 @@ describe("Test Battle Phase", () => { .startingLevel(2000) .startingWave(3) .startingBiome(BiomeId.LAKE) - .moveset([moveToUse]); - game.override.enemyMoveset([MoveId.TACKLE, MoveId.TACKLE, MoveId.TACKLE, MoveId.TACKLE]); + .moveset([moveToUse]) + .enemyMoveset([MoveId.TACKLE, MoveId.TACKLE, MoveId.TACKLE, MoveId.TACKLE]); await game.classicMode.startBattle(); const waveIndex = game.scene.currentBattle.waveIndex; game.move.select(moveToUse); diff --git a/test/escape-calculations.test.ts b/test/escape-calculations.test.ts index ca51f40a509..8a81bf2c6b8 100644 --- a/test/escape-calculations.test.ts +++ b/test/escape-calculations.test.ts @@ -262,8 +262,7 @@ describe("Escape chance calculations", () => { }, 20000); it("double boss opponent", async () => { - game.override.battleStyle("double"); - game.override.startingWave(10); + game.override.battleStyle("double").startingWave(10); await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.ABOMASNOW]); const playerPokemon = game.scene.getPlayerField(); diff --git a/test/evolution.test.ts b/test/evolution.test.ts index b2e7a9243d0..c4bcca785c1 100644 --- a/test/evolution.test.ts +++ b/test/evolution.test.ts @@ -28,12 +28,11 @@ describe("Evolution", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - - game.override.enemySpecies(SpeciesId.MAGIKARP); - game.override.enemyAbility(AbilityId.BALL_FETCH); - - game.override.startingLevel(60); + game.override + .battleStyle("single") + .enemySpecies(SpeciesId.MAGIKARP) + .enemyAbility(AbilityId.BALL_FETCH) + .startingLevel(60); }); it("should keep hidden ability after evolving", async () => { diff --git a/test/field/pokemon.test.ts b/test/field/pokemon.test.ts index 74ad973b51d..774d46b18fe 100644 --- a/test/field/pokemon.test.ts +++ b/test/field/pokemon.test.ts @@ -88,9 +88,7 @@ describe("Spec - Pokemon", () => { let scene: BattleScene; beforeEach(async () => { - game.override.enemySpecies(SpeciesId.ZUBAT); - game.override.starterSpecies(SpeciesId.ABRA); - game.override.enableStarterFusion(); + game.override.enemySpecies(SpeciesId.ZUBAT).starterSpecies(SpeciesId.ABRA).enableStarterFusion(); scene = game.scene; }); @@ -146,8 +144,7 @@ describe("Spec - Pokemon", () => { }); it("Fusing mons with one and two types", async () => { - game.override.starterSpecies(SpeciesId.CHARMANDER); - game.override.starterFusionSpecies(SpeciesId.HOUNDOUR); + game.override.starterSpecies(SpeciesId.CHARMANDER).starterFusionSpecies(SpeciesId.HOUNDOUR); await game.classicMode.startBattle(); const pokemon = scene.getPlayerParty()[0]; @@ -157,8 +154,7 @@ describe("Spec - Pokemon", () => { }); it("Fusing mons with two and one types", async () => { - game.override.starterSpecies(SpeciesId.NUMEL); - game.override.starterFusionSpecies(SpeciesId.CHARMANDER); + game.override.starterSpecies(SpeciesId.NUMEL).starterFusionSpecies(SpeciesId.CHARMANDER); await game.classicMode.startBattle(); const pokemon = scene.getPlayerParty()[0]; @@ -168,8 +164,7 @@ describe("Spec - Pokemon", () => { }); it("Fusing two mons with two types", async () => { - game.override.starterSpecies(SpeciesId.NATU); - game.override.starterFusionSpecies(SpeciesId.HOUNDOUR); + game.override.starterSpecies(SpeciesId.NATU).starterFusionSpecies(SpeciesId.HOUNDOUR); await game.classicMode.startBattle(); const pokemon = scene.getPlayerParty()[0]; diff --git a/test/items/exp_booster.test.ts b/test/items/exp_booster.test.ts index f5273a78a55..96a8571785e 100644 --- a/test/items/exp_booster.test.ts +++ b/test/items/exp_booster.test.ts @@ -22,9 +22,7 @@ describe("EXP Modifier Items", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.enemyAbility(AbilityId.BALL_FETCH); - game.override.ability(AbilityId.BALL_FETCH); - game.override.battleStyle("single"); + game.override.enemyAbility(AbilityId.BALL_FETCH).ability(AbilityId.BALL_FETCH).battleStyle("single"); }); it("EXP booster items stack multiplicatively", async () => { diff --git a/test/moves/baneful_bunker.test.ts b/test/moves/baneful_bunker.test.ts index eddfa87ead4..c9cc2025a58 100644 --- a/test/moves/baneful_bunker.test.ts +++ b/test/moves/baneful_bunker.test.ts @@ -24,16 +24,14 @@ describe("Moves - Baneful Bunker", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - - game.override.moveset(MoveId.SLASH); - - game.override.enemySpecies(SpeciesId.SNORLAX); - game.override.enemyAbility(AbilityId.INSOMNIA); - game.override.enemyMoveset(MoveId.BANEFUL_BUNKER); - - game.override.startingLevel(100); - game.override.enemyLevel(100); + game.override + .battleStyle("single") + .moveset(MoveId.SLASH) + .enemySpecies(SpeciesId.SNORLAX) + .enemyAbility(AbilityId.INSOMNIA) + .enemyMoveset(MoveId.BANEFUL_BUNKER) + .startingLevel(100) + .enemyLevel(100); }); test("should protect the user and poison attackers that make contact", async () => { await game.classicMode.startBattle([SpeciesId.CHARIZARD]); diff --git a/test/moves/baton_pass.test.ts b/test/moves/baton_pass.test.ts index f6256e95ce8..42e46352a11 100644 --- a/test/moves/baton_pass.test.ts +++ b/test/moves/baton_pass.test.ts @@ -59,28 +59,23 @@ describe("Moves - Baton Pass", () => { it("passes stat stage buffs when AI uses it", async () => { // arrange - game.override.startingWave(5).enemyMoveset(new Array(4).fill([MoveId.NASTY_PLOT])); + game.override.startingWave(5).enemyMoveset([MoveId.NASTY_PLOT, MoveId.BATON_PASS]); await game.classicMode.startBattle([SpeciesId.RAICHU, SpeciesId.SHUCKLE]); // round 1 - ai buffs game.move.select(MoveId.SPLASH); + await game.move.forceEnemyMove(MoveId.NASTY_PLOT); await game.toNextTurn(); // round 2 - baton pass - game.scene.getEnemyPokemon()!.hp = 100; - game.override.enemyMoveset([MoveId.BATON_PASS]); - // Force moveset to update mid-battle - // TODO: replace with enemy ai control function when it's added - game.scene.getEnemyParty()[0].getMoveset(); game.move.select(MoveId.SPLASH); + await game.move.forceEnemyMove(MoveId.BATON_PASS); await game.phaseInterceptor.to("PostSummonPhase", false); - // assert // check buffs are still there - expect(game.scene.getEnemyPokemon()!.getStatStage(Stat.SPATK)).toEqual(2); + expect(game.scene.getEnemyPokemon()?.getStatStage(Stat.SPATK)).toEqual(2); // confirm that a switch actually happened. can't use species because I // can't find a way to override trainer parties with more than 1 pokemon species - expect(game.scene.getEnemyPokemon()!.hp).not.toEqual(100); expect(game.phaseInterceptor.log.slice(-4)).toEqual([ "MoveEffectPhase", "SwitchSummonPhase", diff --git a/test/moves/beak_blast.test.ts b/test/moves/beak_blast.test.ts index ad2959e5101..2cb9f9bdd6f 100644 --- a/test/moves/beak_blast.test.ts +++ b/test/moves/beak_blast.test.ts @@ -129,8 +129,7 @@ describe("Moves - Beak Blast", () => { }); it("should not burn a long reach enemy that hits the user with a contact move", async () => { - game.override.enemyAbility(AbilityId.LONG_REACH); - game.override.enemyMoveset([MoveId.FALSE_SWIPE]).enemyLevel(100); + game.override.enemyAbility(AbilityId.LONG_REACH).enemyMoveset([MoveId.FALSE_SWIPE]).enemyLevel(100); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); game.move.select(MoveId.BEAK_BLAST); await game.phaseInterceptor.to("BerryPhase", false); diff --git a/test/moves/beat_up.test.ts b/test/moves/beat_up.test.ts index 184204a91aa..7c4686ab4fa 100644 --- a/test/moves/beat_up.test.ts +++ b/test/moves/beat_up.test.ts @@ -23,15 +23,14 @@ describe("Moves - Beat Up", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - - game.override.enemySpecies(SpeciesId.SNORLAX); - game.override.enemyLevel(100); - game.override.enemyMoveset([MoveId.SPLASH]); - game.override.enemyAbility(AbilityId.INSOMNIA); - - game.override.startingLevel(100); - game.override.moveset([MoveId.BEAT_UP]); + game.override + .battleStyle("single") + .enemySpecies(SpeciesId.SNORLAX) + .enemyLevel(100) + .enemyMoveset([MoveId.SPLASH]) + .enemyAbility(AbilityId.INSOMNIA) + .startingLevel(100) + .moveset([MoveId.BEAT_UP]); }); it("should hit once for each healthy player Pokemon", async () => { diff --git a/test/moves/ceaseless_edge.test.ts b/test/moves/ceaseless_edge.test.ts index fcaddfb0d76..1dec98fe3a8 100644 --- a/test/moves/ceaseless_edge.test.ts +++ b/test/moves/ceaseless_edge.test.ts @@ -27,14 +27,15 @@ describe("Moves - Ceaseless Edge", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - game.override.enemySpecies(SpeciesId.RATTATA); - game.override.enemyAbility(AbilityId.RUN_AWAY); - game.override.enemyPassiveAbility(AbilityId.RUN_AWAY); - game.override.startingLevel(100); - game.override.enemyLevel(100); - game.override.moveset([MoveId.CEASELESS_EDGE, MoveId.SPLASH, MoveId.ROAR]); - game.override.enemyMoveset(MoveId.SPLASH); + game.override + .battleStyle("single") + .enemySpecies(SpeciesId.RATTATA) + .enemyAbility(AbilityId.RUN_AWAY) + .enemyPassiveAbility(AbilityId.RUN_AWAY) + .startingLevel(100) + .enemyLevel(100) + .moveset([MoveId.CEASELESS_EDGE, MoveId.SPLASH, MoveId.ROAR]) + .enemyMoveset(MoveId.SPLASH); vi.spyOn(allMoves[MoveId.CEASELESS_EDGE], "accuracy", "get").mockReturnValue(100); }); @@ -82,8 +83,7 @@ describe("Moves - Ceaseless Edge", () => { }); test("trainer - move should hit twice, apply two layers of spikes, force switch opponent - opponent takes damage", async () => { - game.override.startingHeldItems([{ name: "MULTI_LENS" }]); - game.override.startingWave(25); + game.override.startingHeldItems([{ name: "MULTI_LENS" }]).startingWave(25); await game.classicMode.startBattle([SpeciesId.ILLUMISE]); diff --git a/test/moves/clangorous_soul.test.ts b/test/moves/clangorous_soul.test.ts index 6f4c18852b0..f08503acdc6 100644 --- a/test/moves/clangorous_soul.test.ts +++ b/test/moves/clangorous_soul.test.ts @@ -27,12 +27,13 @@ describe("Moves - Clangorous Soul", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.starterSpecies(SpeciesId.MAGIKARP); - game.override.enemySpecies(SpeciesId.SNORLAX); - game.override.startingLevel(100); - game.override.enemyLevel(100); - game.override.moveset([MoveId.CLANGOROUS_SOUL]); - game.override.enemyMoveset(MoveId.SPLASH); + game.override + .starterSpecies(SpeciesId.MAGIKARP) + .enemySpecies(SpeciesId.SNORLAX) + .startingLevel(100) + .enemyLevel(100) + .moveset([MoveId.CLANGOROUS_SOUL]) + .enemyMoveset(MoveId.SPLASH); }); //Bulbapedia Reference: https://bulbapedia.bulbagarden.net/wiki/Clangorous_Soul_(move) diff --git a/test/moves/crafty_shield.test.ts b/test/moves/crafty_shield.test.ts index 01ab0416e5a..12a607a2a1b 100644 --- a/test/moves/crafty_shield.test.ts +++ b/test/moves/crafty_shield.test.ts @@ -26,16 +26,14 @@ describe("Moves - Crafty Shield", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("double"); - - game.override.moveset([MoveId.CRAFTY_SHIELD, MoveId.SPLASH, MoveId.SWORDS_DANCE]); - - game.override.enemySpecies(SpeciesId.SNORLAX); - game.override.enemyMoveset([MoveId.GROWL]); - game.override.enemyAbility(AbilityId.INSOMNIA); - - game.override.startingLevel(100); - game.override.enemyLevel(100); + game.override + .battleStyle("double") + .moveset([MoveId.CRAFTY_SHIELD, MoveId.SPLASH, MoveId.SWORDS_DANCE]) + .enemySpecies(SpeciesId.SNORLAX) + .enemyMoveset([MoveId.GROWL]) + .enemyAbility(AbilityId.INSOMNIA) + .startingLevel(100) + .enemyLevel(100); }); test("should protect the user and allies from status moves", async () => { @@ -73,8 +71,7 @@ describe("Moves - Crafty Shield", () => { }); test("should protect the user and allies from moves that ignore other protection", async () => { - game.override.enemySpecies(SpeciesId.DUSCLOPS); - game.override.enemyMoveset([MoveId.CURSE]); + game.override.enemySpecies(SpeciesId.DUSCLOPS).enemyMoveset([MoveId.CURSE]); await game.classicMode.startBattle([SpeciesId.CHARIZARD, SpeciesId.BLASTOISE]); diff --git a/test/moves/dragon_rage.test.ts b/test/moves/dragon_rage.test.ts index c2a0a1bc979..f0be6748c7f 100644 --- a/test/moves/dragon_rage.test.ts +++ b/test/moves/dragon_rage.test.ts @@ -1,6 +1,5 @@ import { Stat } from "#enums/stat"; import { PokemonType } from "#enums/pokemon-type"; -import { SpeciesId } from "#enums/species-id"; import type { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon"; import { TurnEndPhase } from "#app/phases/turn-end-phase"; import { AbilityId } from "#enums/ability-id"; @@ -9,6 +8,7 @@ import { MoveId } from "#enums/move-id"; import GameManager from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; +import { SpeciesId } from "#enums/species-id"; describe("Moves - Dragon Rage", () => { let phaserGame: Phaser.Game; @@ -31,19 +31,18 @@ describe("Moves - Dragon Rage", () => { beforeEach(async () => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - - game.override.starterSpecies(SpeciesId.SNORLAX); - game.override.moveset([MoveId.DRAGON_RAGE]); - game.override.ability(AbilityId.BALL_FETCH); - game.override.passiveAbility(AbilityId.BALL_FETCH); - game.override.startingLevel(100); - - game.override.enemySpecies(SpeciesId.SNORLAX); - game.override.enemyMoveset(MoveId.SPLASH); - game.override.enemyAbility(AbilityId.BALL_FETCH); - game.override.enemyPassiveAbility(AbilityId.BALL_FETCH); - game.override.enemyLevel(100); + game.override + .battleStyle("single") + .starterSpecies(SpeciesId.SNORLAX) + .moveset([MoveId.DRAGON_RAGE]) + .ability(AbilityId.BALL_FETCH) + .passiveAbility(AbilityId.BALL_FETCH) + .startingLevel(100) + .enemySpecies(SpeciesId.SNORLAX) + .enemyMoveset(MoveId.SPLASH) + .enemyAbility(AbilityId.BALL_FETCH) + .enemyPassiveAbility(AbilityId.BALL_FETCH) + .enemyLevel(100); await game.classicMode.startBattle(); @@ -101,8 +100,7 @@ describe("Moves - Dragon Rage", () => { }); it("ignores damage modification from abilities, for example ICE_SCALES", async () => { - game.override.disableCrits(); - game.override.enemyAbility(AbilityId.ICE_SCALES); + game.override.disableCrits().enemyAbility(AbilityId.ICE_SCALES); game.move.select(MoveId.DRAGON_RAGE); await game.phaseInterceptor.to(TurnEndPhase); diff --git a/test/moves/dynamax_cannon.test.ts b/test/moves/dynamax_cannon.test.ts index 2cdba48c0ea..c0b6d9e0b40 100644 --- a/test/moves/dynamax_cannon.test.ts +++ b/test/moves/dynamax_cannon.test.ts @@ -38,15 +38,7 @@ describe("Moves - Dynamax Cannon", () => { .enemySpecies(SpeciesId.MAGIKARP) .enemyMoveset(MoveId.SPLASH); - // Note that, for Waves 1-10, the level cap is 10 - game.override.startingWave(1); - game.override.battleStyle("single"); - game.override.disableCrits(); - - game.override.enemySpecies(SpeciesId.MAGIKARP); - game.override.enemyMoveset([MoveId.SPLASH, MoveId.SPLASH, MoveId.SPLASH, MoveId.SPLASH]); - - vi.spyOn(dynamaxCannon, "calculateBattlePower"); + vi.spyOn(allMoves[MoveId.DYNAMAX_CANNON], "calculateBattlePower"); }); it("should return 100 power against an enemy below level cap", async () => { diff --git a/test/moves/fillet_away.test.ts b/test/moves/fillet_away.test.ts index a24b5c4ae04..1e00f2ee02d 100644 --- a/test/moves/fillet_away.test.ts +++ b/test/moves/fillet_away.test.ts @@ -28,12 +28,13 @@ describe("Moves - FILLET AWAY", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.starterSpecies(SpeciesId.MAGIKARP); - game.override.enemySpecies(SpeciesId.SNORLAX); - game.override.startingLevel(100); - game.override.enemyLevel(100); - game.override.moveset([MoveId.FILLET_AWAY]); - game.override.enemyMoveset(MoveId.SPLASH); + game.override + .starterSpecies(SpeciesId.MAGIKARP) + .enemySpecies(SpeciesId.SNORLAX) + .startingLevel(100) + .enemyLevel(100) + .moveset([MoveId.FILLET_AWAY]) + .enemyMoveset(MoveId.SPLASH); }); //Bulbapedia Reference: https://bulbapedia.bulbagarden.net/wiki/fillet_away_(move) diff --git a/test/moves/fissure.test.ts b/test/moves/fissure.test.ts index 53327b505c4..231eab427e1 100644 --- a/test/moves/fissure.test.ts +++ b/test/moves/fissure.test.ts @@ -1,5 +1,4 @@ import { Stat } from "#enums/stat"; -import { SpeciesId } from "#enums/species-id"; import type { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon"; import { DamageAnimPhase } from "#app/phases/damage-anim-phase"; import { TurnEndPhase } from "#app/phases/turn-end-phase"; @@ -8,6 +7,7 @@ import { MoveId } from "#enums/move-id"; import GameManager from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; +import { SpeciesId } from "#enums/species-id"; describe("Moves - Fissure", () => { let phaserGame: Phaser.Game; @@ -28,18 +28,17 @@ describe("Moves - Fissure", () => { beforeEach(async () => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - game.override.disableCrits(); - - game.override.starterSpecies(SpeciesId.SNORLAX); - game.override.moveset([MoveId.FISSURE]); - game.override.passiveAbility(AbilityId.BALL_FETCH); - game.override.startingLevel(100); - - game.override.enemySpecies(SpeciesId.SNORLAX); - game.override.enemyMoveset(MoveId.SPLASH); - game.override.enemyPassiveAbility(AbilityId.BALL_FETCH); - game.override.enemyLevel(100); + game.override + .battleStyle("single") + .disableCrits() + .starterSpecies(SpeciesId.SNORLAX) + .moveset([MoveId.FISSURE]) + .passiveAbility(AbilityId.BALL_FETCH) + .startingLevel(100) + .enemySpecies(SpeciesId.SNORLAX) + .enemyMoveset(MoveId.SPLASH) + .enemyPassiveAbility(AbilityId.BALL_FETCH) + .enemyLevel(100); await game.classicMode.startBattle(); @@ -48,8 +47,7 @@ describe("Moves - Fissure", () => { }); it("ignores damage modification from abilities, for example FUR_COAT", async () => { - game.override.ability(AbilityId.NO_GUARD); - game.override.enemyAbility(AbilityId.FUR_COAT); + game.override.ability(AbilityId.NO_GUARD).enemyAbility(AbilityId.FUR_COAT); game.move.select(MoveId.FISSURE); await game.phaseInterceptor.to(DamageAnimPhase, true); diff --git a/test/moves/flame_burst.test.ts b/test/moves/flame_burst.test.ts index 1d61daaacb5..e994dc3e568 100644 --- a/test/moves/flame_burst.test.ts +++ b/test/moves/flame_burst.test.ts @@ -35,14 +35,15 @@ describe("Moves - Flame Burst", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("double"); - game.override.moveset([MoveId.FLAME_BURST, MoveId.SPLASH]); - game.override.disableCrits(); - game.override.ability(AbilityId.UNNERVE); - game.override.startingWave(4); - game.override.enemySpecies(SpeciesId.SHUCKLE); - game.override.enemyAbility(AbilityId.BALL_FETCH); - game.override.enemyMoveset([MoveId.SPLASH]); + game.override + .battleStyle("double") + .moveset([MoveId.FLAME_BURST, MoveId.SPLASH]) + .disableCrits() + .ability(AbilityId.UNNERVE) + .startingWave(4) + .enemySpecies(SpeciesId.SHUCKLE) + .enemyAbility(AbilityId.BALL_FETCH) + .enemyMoveset([MoveId.SPLASH]); }); it("inflicts damage to the target's ally equal to 1/16 of its max HP", async () => { diff --git a/test/moves/flower_shield.test.ts b/test/moves/flower_shield.test.ts index 3561d396ef9..c3c5e5cf870 100644 --- a/test/moves/flower_shield.test.ts +++ b/test/moves/flower_shield.test.ts @@ -26,11 +26,12 @@ describe("Moves - Flower Shield", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.ability(AbilityId.NONE); - game.override.enemyAbility(AbilityId.NONE); - game.override.battleStyle("single"); - game.override.moveset([MoveId.FLOWER_SHIELD, MoveId.SPLASH]); - game.override.enemyMoveset(MoveId.SPLASH); + game.override + .ability(AbilityId.NONE) + .enemyAbility(AbilityId.NONE) + .battleStyle("single") + .moveset([MoveId.FLOWER_SHIELD, MoveId.SPLASH]) + .enemyMoveset(MoveId.SPLASH); }); it("raises DEF stat stage by 1 for all Grass-type Pokemon on the field by one stage - single battle", async () => { diff --git a/test/moves/follow_me.test.ts b/test/moves/follow_me.test.ts index 8279e7b325a..a99ac0b6c00 100644 --- a/test/moves/follow_me.test.ts +++ b/test/moves/follow_me.test.ts @@ -24,14 +24,15 @@ describe("Moves - Follow Me", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("double"); - game.override.starterSpecies(SpeciesId.AMOONGUSS); - game.override.ability(AbilityId.BALL_FETCH); - game.override.enemySpecies(SpeciesId.SNORLAX); - game.override.startingLevel(100); - game.override.enemyLevel(100); - game.override.moveset([MoveId.FOLLOW_ME, MoveId.RAGE_POWDER, MoveId.SPOTLIGHT, MoveId.QUICK_ATTACK]); - game.override.enemyMoveset([MoveId.TACKLE, MoveId.FOLLOW_ME, MoveId.SPLASH]); + game.override + .battleStyle("double") + .starterSpecies(SpeciesId.AMOONGUSS) + .ability(AbilityId.BALL_FETCH) + .enemySpecies(SpeciesId.SNORLAX) + .startingLevel(100) + .enemyLevel(100) + .moveset([MoveId.FOLLOW_ME, MoveId.RAGE_POWDER, MoveId.SPOTLIGHT, MoveId.QUICK_ATTACK]) + .enemyMoveset([MoveId.TACKLE, MoveId.FOLLOW_ME, MoveId.SPLASH]); }); test("move should redirect enemy attacks to the user", async () => { @@ -73,8 +74,7 @@ describe("Moves - Follow Me", () => { }); test("move effect should be bypassed by Stalwart", async () => { - game.override.ability(AbilityId.STALWART); - game.override.moveset([MoveId.QUICK_ATTACK]); + game.override.ability(AbilityId.STALWART).moveset([MoveId.QUICK_ATTACK]); await game.classicMode.startBattle([SpeciesId.AMOONGUSS, SpeciesId.CHARIZARD]); diff --git a/test/moves/gastro_acid.test.ts b/test/moves/gastro_acid.test.ts index 28f2c8e8476..dbaa53dcb4f 100644 --- a/test/moves/gastro_acid.test.ts +++ b/test/moves/gastro_acid.test.ts @@ -22,14 +22,15 @@ describe("Moves - Gastro Acid", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("double"); - game.override.startingLevel(1); - game.override.enemyLevel(100); - game.override.ability(AbilityId.BALL_FETCH); - game.override.moveset([MoveId.GASTRO_ACID, MoveId.WATER_GUN, MoveId.SPLASH, MoveId.CORE_ENFORCER]); - game.override.enemySpecies(SpeciesId.BIDOOF); - game.override.enemyMoveset(MoveId.SPLASH); - game.override.enemyAbility(AbilityId.WATER_ABSORB); + game.override + .battleStyle("double") + .startingLevel(1) + .enemyLevel(100) + .ability(AbilityId.NONE) + .moveset([MoveId.GASTRO_ACID, MoveId.WATER_GUN, MoveId.SPLASH, MoveId.CORE_ENFORCER]) + .enemySpecies(SpeciesId.BIDOOF) + .enemyMoveset(MoveId.SPLASH) + .enemyAbility(AbilityId.WATER_ABSORB); }); it("suppresses effect of ability", async () => { diff --git a/test/moves/glaive_rush.test.ts b/test/moves/glaive_rush.test.ts index 768c4a691b0..2aead405fb6 100644 --- a/test/moves/glaive_rush.test.ts +++ b/test/moves/glaive_rush.test.ts @@ -28,13 +28,12 @@ describe("Moves - Glaive Rush", () => { .enemySpecies(SpeciesId.MAGIKARP) .enemyAbility(AbilityId.BALL_FETCH) .enemyMoveset([MoveId.GLAIVE_RUSH]) - .starterSpecies(SpeciesId.KLINK) .ability(AbilityId.BALL_FETCH) .moveset([MoveId.SHADOW_SNEAK, MoveId.AVALANCHE, MoveId.SPLASH, MoveId.GLAIVE_RUSH]); }); it("takes double damage from attacks", async () => { - await game.classicMode.startBattle(); + await game.classicMode.startBattle([SpeciesId.KLINK]); const enemy = game.scene.getEnemyPokemon()!; enemy.hp = 1000; @@ -49,7 +48,7 @@ describe("Moves - Glaive Rush", () => { }); it("always gets hit by attacks", async () => { - await game.classicMode.startBattle(); + await game.classicMode.startBattle([SpeciesId.KLINK]); const enemy = game.scene.getEnemyPokemon()!; enemy.hp = 1000; @@ -62,7 +61,7 @@ describe("Moves - Glaive Rush", () => { it("interacts properly with multi-lens", async () => { game.override.startingHeldItems([{ name: "MULTI_LENS", count: 2 }]).enemyMoveset([MoveId.AVALANCHE]); - await game.classicMode.startBattle(); + await game.classicMode.startBattle([SpeciesId.KLINK]); const player = game.scene.getPlayerPokemon()!; const enemy = game.scene.getEnemyPokemon()!; @@ -82,7 +81,7 @@ describe("Moves - Glaive Rush", () => { it("secondary effects only last until next move", async () => { game.override.enemyMoveset([MoveId.SHADOW_SNEAK]); - await game.classicMode.startBattle(); + await game.classicMode.startBattle([SpeciesId.KLINK]); const player = game.scene.getPlayerPokemon()!; const enemy = game.scene.getEnemyPokemon()!; @@ -106,7 +105,7 @@ describe("Moves - Glaive Rush", () => { }); it("secondary effects are removed upon switching", async () => { - game.override.enemyMoveset([MoveId.SHADOW_SNEAK]).starterSpecies(0); + game.override.enemyMoveset([MoveId.SHADOW_SNEAK]); await game.classicMode.startBattle([SpeciesId.KLINK, SpeciesId.FEEBAS]); const player = game.scene.getPlayerPokemon()!; @@ -127,8 +126,10 @@ describe("Moves - Glaive Rush", () => { }); it("secondary effects don't activate if move fails", async () => { - game.override.moveset([MoveId.SHADOW_SNEAK, MoveId.PROTECT, MoveId.SPLASH, MoveId.GLAIVE_RUSH]); - await game.classicMode.startBattle(); + game.override + .moveset([MoveId.SHADOW_SNEAK, MoveId.PROTECT, MoveId.SPLASH, MoveId.GLAIVE_RUSH]) + .enemyMoveset([MoveId.GLAIVE_RUSH, MoveId.SPLASH]); + await game.classicMode.startBattle([SpeciesId.KLINK]); const player = game.scene.getPlayerPokemon()!; const enemy = game.scene.getEnemyPokemon()!; @@ -137,15 +138,17 @@ describe("Moves - Glaive Rush", () => { player.hp = 1000; game.move.select(MoveId.PROTECT); + await game.move.forceEnemyMove(MoveId.GLAIVE_RUSH); await game.phaseInterceptor.to("TurnEndPhase"); game.move.select(MoveId.SHADOW_SNEAK); + await game.move.forceEnemyMove(MoveId.GLAIVE_RUSH); await game.phaseInterceptor.to("TurnEndPhase"); - game.override.enemyMoveset([MoveId.SPLASH]); const damagedHP1 = 1000 - enemy.hp; enemy.hp = 1000; game.move.select(MoveId.SHADOW_SNEAK); + await game.move.forceEnemyMove(MoveId.SPLASH); await game.phaseInterceptor.to("TurnEndPhase"); const damagedHP2 = 1000 - enemy.hp; diff --git a/test/moves/growth.test.ts b/test/moves/growth.test.ts index d468523aca7..a7078961e2a 100644 --- a/test/moves/growth.test.ts +++ b/test/moves/growth.test.ts @@ -24,11 +24,12 @@ describe("Moves - Growth", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - game.override.enemyAbility(AbilityId.MOXIE); - game.override.ability(AbilityId.INSOMNIA); - game.override.moveset([MoveId.GROWTH]); - game.override.enemyMoveset(MoveId.SPLASH); + game.override + .battleStyle("single") + .enemyAbility(AbilityId.MOXIE) + .ability(AbilityId.INSOMNIA) + .moveset([MoveId.GROWTH]) + .enemyMoveset(MoveId.SPLASH); }); it("should raise SPATK stat stage by 1", async () => { diff --git a/test/moves/hard_press.test.ts b/test/moves/hard_press.test.ts index 88a8c4a025b..e57c9af981f 100644 --- a/test/moves/hard_press.test.ts +++ b/test/moves/hard_press.test.ts @@ -27,12 +27,13 @@ describe("Moves - Hard Press", () => { beforeEach(() => { moveToCheck = allMoves[MoveId.HARD_PRESS]; game = new GameManager(phaserGame); - game.override.battleStyle("single"); - game.override.ability(AbilityId.BALL_FETCH); - game.override.enemySpecies(SpeciesId.MUNCHLAX); - game.override.enemyAbility(AbilityId.BALL_FETCH); - game.override.enemyMoveset(MoveId.SPLASH); - game.override.moveset([MoveId.HARD_PRESS]); + game.override + .battleStyle("single") + .ability(AbilityId.BALL_FETCH) + .enemySpecies(SpeciesId.MUNCHLAX) + .enemyAbility(AbilityId.BALL_FETCH) + .enemyMoveset(MoveId.SPLASH) + .moveset([MoveId.HARD_PRESS]); vi.spyOn(moveToCheck, "calculateBattlePower"); }); diff --git a/test/moves/haze.test.ts b/test/moves/haze.test.ts index e77542227b8..f3e3dafae0a 100644 --- a/test/moves/haze.test.ts +++ b/test/moves/haze.test.ts @@ -23,16 +23,15 @@ describe("Moves - Haze", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - - game.override.enemySpecies(SpeciesId.RATTATA); - game.override.enemyLevel(100); - game.override.enemyMoveset(MoveId.SPLASH); - game.override.enemyAbility(AbilityId.NONE); - - game.override.startingLevel(100); - game.override.moveset([MoveId.HAZE, MoveId.SWORDS_DANCE, MoveId.CHARM, MoveId.SPLASH]); - game.override.ability(AbilityId.NONE); + game.override + .battleStyle("single") + .enemySpecies(SpeciesId.RATTATA) + .enemyLevel(100) + .enemyMoveset(MoveId.SPLASH) + .enemyAbility(AbilityId.BALL_FETCH) + .startingLevel(100) + .moveset([MoveId.HAZE, MoveId.SWORDS_DANCE, MoveId.CHARM, MoveId.SPLASH]) + .ability(AbilityId.BALL_FETCH); }); it("should reset all stat changes of all Pokemon on field", async () => { diff --git a/test/moves/hyper_beam.test.ts b/test/moves/hyper_beam.test.ts index 083482d16ef..bca7cba4e9a 100644 --- a/test/moves/hyper_beam.test.ts +++ b/test/moves/hyper_beam.test.ts @@ -26,14 +26,14 @@ describe("Moves - Hyper Beam", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - game.override.ability(AbilityId.BALL_FETCH); - game.override.enemySpecies(SpeciesId.SNORLAX); - game.override.enemyAbility(AbilityId.BALL_FETCH); - game.override.enemyMoveset([MoveId.SPLASH]); - game.override.enemyLevel(100); - - game.override.moveset([MoveId.HYPER_BEAM, MoveId.TACKLE]); + game.override + .battleStyle("single") + .ability(AbilityId.BALL_FETCH) + .enemySpecies(SpeciesId.SNORLAX) + .enemyAbility(AbilityId.BALL_FETCH) + .enemyMoveset([MoveId.SPLASH]) + .enemyLevel(100) + .moveset([MoveId.HYPER_BEAM, MoveId.TACKLE]); vi.spyOn(allMoves[MoveId.HYPER_BEAM], "accuracy", "get").mockReturnValue(100); }); diff --git a/test/moves/lunar_blessing.test.ts b/test/moves/lunar_blessing.test.ts index 59d0c662859..2709ccbacf3 100644 --- a/test/moves/lunar_blessing.test.ts +++ b/test/moves/lunar_blessing.test.ts @@ -22,14 +22,13 @@ describe("Moves - Lunar Blessing", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("double"); - - game.override.enemySpecies(SpeciesId.SHUCKLE); - game.override.enemyMoveset(MoveId.SPLASH); - game.override.enemyAbility(AbilityId.BALL_FETCH); - - game.override.moveset([MoveId.LUNAR_BLESSING, MoveId.SPLASH]); - game.override.ability(AbilityId.BALL_FETCH); + game.override + .battleStyle("double") + .enemySpecies(SpeciesId.SHUCKLE) + .enemyMoveset(MoveId.SPLASH) + .enemyAbility(AbilityId.BALL_FETCH) + .moveset([MoveId.LUNAR_BLESSING, MoveId.SPLASH]) + .ability(AbilityId.BALL_FETCH); }); it("should restore 25% HP of the user and its ally", async () => { diff --git a/test/moves/magic_coat.test.ts b/test/moves/magic_coat.test.ts index a20aaf38043..7bbd4779da6 100644 --- a/test/moves/magic_coat.test.ts +++ b/test/moves/magic_coat.test.ts @@ -56,8 +56,7 @@ describe("Moves - Magic Coat", () => { }); it("should not reflect moves used on the next turn", async () => { - game.override.moveset([MoveId.GROWL, MoveId.SPLASH]); - game.override.enemyMoveset([MoveId.MAGIC_COAT, MoveId.SPLASH]); + game.override.moveset([MoveId.GROWL, MoveId.SPLASH]).enemyMoveset([MoveId.MAGIC_COAT, MoveId.SPLASH]); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); // turn 1 @@ -82,8 +81,7 @@ describe("Moves - Magic Coat", () => { }); it("should individually bounce back multi-target moves when used by both targets in doubles", async () => { - game.override.battleStyle("double"); - game.override.moveset([MoveId.GROWL, MoveId.SPLASH]); + game.override.battleStyle("double").moveset([MoveId.GROWL, MoveId.SPLASH]); await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MAGIKARP]); game.move.select(MoveId.GROWL, 0); @@ -95,9 +93,10 @@ describe("Moves - Magic Coat", () => { }); it("should bounce back a spread status move against both pokemon", async () => { - game.override.battleStyle("double"); - game.override.moveset([MoveId.GROWL, MoveId.SPLASH]); - game.override.enemyMoveset([MoveId.SPLASH, MoveId.MAGIC_COAT]); + game.override + .battleStyle("double") + .moveset([MoveId.GROWL, MoveId.SPLASH]) + .enemyMoveset([MoveId.SPLASH, MoveId.MAGIC_COAT]); await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MAGIKARP]); game.move.select(MoveId.GROWL, 0); @@ -121,10 +120,11 @@ describe("Moves - Magic Coat", () => { }); it("should not bounce back a move that was just bounced", async () => { - game.override.battleStyle("double"); - game.override.ability(AbilityId.MAGIC_BOUNCE); - game.override.moveset([MoveId.GROWL, MoveId.MAGIC_COAT]); - game.override.enemyMoveset([MoveId.SPLASH, MoveId.MAGIC_COAT]); + game.override + .battleStyle("double") + .ability(AbilityId.MAGIC_BOUNCE) + .moveset([MoveId.GROWL, MoveId.MAGIC_COAT]) + .enemyMoveset([MoveId.SPLASH, MoveId.MAGIC_COAT]); await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MAGIKARP]); game.move.select(MoveId.MAGIC_COAT, 0); @@ -147,8 +147,7 @@ describe("Moves - Magic Coat", () => { }); it("should still bounce back a move from a mold breaker user", async () => { - game.override.ability(AbilityId.MOLD_BREAKER); - game.override.moveset([MoveId.GROWL]); + game.override.ability(AbilityId.MOLD_BREAKER).moveset([MoveId.GROWL]); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); game.move.select(MoveId.GROWL); @@ -159,9 +158,8 @@ describe("Moves - Magic Coat", () => { }); it("should only bounce spikes back once when both targets use magic coat in doubles", async () => { - game.override.battleStyle("double"); + game.override.battleStyle("double").moveset([MoveId.SPIKES]); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); - game.override.moveset([MoveId.SPIKES]); game.move.select(MoveId.SPIKES); await game.phaseInterceptor.to("BerryPhase"); @@ -171,9 +169,8 @@ describe("Moves - Magic Coat", () => { }); it("should not bounce back curse", async () => { - game.override.starterSpecies(SpeciesId.GASTLY); - await game.classicMode.startBattle([SpeciesId.GASTLY]); game.override.moveset([MoveId.CURSE]); + await game.classicMode.startBattle([SpeciesId.GASTLY]); game.move.select(MoveId.CURSE); await game.phaseInterceptor.to("BerryPhase"); @@ -183,9 +180,10 @@ describe("Moves - Magic Coat", () => { // TODO: encore is failing if the last move was virtual. it.todo("should not cause the bounced move to count for encore", async () => { - game.override.moveset([MoveId.GROWL, MoveId.ENCORE]); - game.override.enemyMoveset([MoveId.MAGIC_COAT, MoveId.TACKLE]); - game.override.enemyAbility(AbilityId.MAGIC_BOUNCE); + game.override + .moveset([MoveId.GROWL, MoveId.ENCORE]) + .enemyMoveset([MoveId.MAGIC_COAT, MoveId.TACKLE]) + .enemyAbility(AbilityId.MAGIC_BOUNCE); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); const enemyPokemon = game.scene.getEnemyPokemon()!; @@ -206,9 +204,8 @@ describe("Moves - Magic Coat", () => { // TODO: stomping tantrum should consider moves that were bounced. it.todo("should cause stomping tantrum to double in power when the last move was bounced", async () => { - game.override.battleStyle("single"); + game.override.battleStyle("single").moveset([MoveId.STOMPING_TANTRUM, MoveId.CHARM]); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); - game.override.moveset([MoveId.STOMPING_TANTRUM, MoveId.CHARM]); const stomping_tantrum = allMoves[MoveId.STOMPING_TANTRUM]; vi.spyOn(stomping_tantrum, "calculateBattlePower"); @@ -249,8 +246,7 @@ describe("Moves - Magic Coat", () => { it("should respect immunities when bouncing a move", async () => { vi.spyOn(allMoves[MoveId.THUNDER_WAVE], "accuracy", "get").mockReturnValue(100); - game.override.moveset([MoveId.THUNDER_WAVE, MoveId.GROWL]); - game.override.ability(AbilityId.SOUNDPROOF); + game.override.moveset([MoveId.THUNDER_WAVE, MoveId.GROWL]).ability(AbilityId.SOUNDPROOF); await game.classicMode.startBattle([SpeciesId.PHANPY]); // Turn 1 - thunder wave immunity test diff --git a/test/moves/make_it_rain.test.ts b/test/moves/make_it_rain.test.ts index 0089dfb642d..13b8e8f1853 100644 --- a/test/moves/make_it_rain.test.ts +++ b/test/moves/make_it_rain.test.ts @@ -24,13 +24,14 @@ describe("Moves - Make It Rain", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("double"); - game.override.moveset([MoveId.MAKE_IT_RAIN, MoveId.SPLASH]); - game.override.enemySpecies(SpeciesId.SNORLAX); - game.override.enemyAbility(AbilityId.INSOMNIA); - game.override.enemyMoveset(MoveId.SPLASH); - game.override.startingLevel(100); - game.override.enemyLevel(100); + game.override + .battleStyle("double") + .moveset([MoveId.MAKE_IT_RAIN, MoveId.SPLASH]) + .enemySpecies(SpeciesId.SNORLAX) + .enemyAbility(AbilityId.INSOMNIA) + .enemyMoveset(MoveId.SPLASH) + .startingLevel(100) + .enemyLevel(100); }); it("should only lower SPATK stat stage by 1 once in a double battle", async () => { @@ -47,8 +48,9 @@ describe("Moves - Make It Rain", () => { }); it("should apply effects even if the target faints", async () => { - game.override.enemyLevel(1); // ensures the enemy will faint - game.override.battleStyle("single"); + game.override + .enemyLevel(1) // ensures the enemy will faint + .battleStyle("single"); await game.classicMode.startBattle([SpeciesId.CHARIZARD]); diff --git a/test/moves/mat_block.test.ts b/test/moves/mat_block.test.ts index c512503c9c4..d77f538a973 100644 --- a/test/moves/mat_block.test.ts +++ b/test/moves/mat_block.test.ts @@ -26,16 +26,14 @@ describe("Moves - Mat Block", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("double"); - - game.override.moveset([MoveId.MAT_BLOCK, MoveId.SPLASH]); - - game.override.enemySpecies(SpeciesId.SNORLAX); - game.override.enemyMoveset([MoveId.TACKLE]); - game.override.enemyAbility(AbilityId.INSOMNIA); - - game.override.startingLevel(100); - game.override.enemyLevel(100); + game.override + .battleStyle("double") + .moveset([MoveId.MAT_BLOCK, MoveId.SPLASH]) + .enemySpecies(SpeciesId.SNORLAX) + .enemyMoveset([MoveId.TACKLE]) + .enemyAbility(AbilityId.INSOMNIA) + .startingLevel(100) + .enemyLevel(100); }); test("should protect the user and allies from attack moves", async () => { diff --git a/test/moves/parting_shot.test.ts b/test/moves/parting_shot.test.ts index f7a1b86fb34..fdeab6bfc7c 100644 --- a/test/moves/parting_shot.test.ts +++ b/test/moves/parting_shot.test.ts @@ -26,11 +26,12 @@ describe("Moves - Parting Shot", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - game.override.moveset([MoveId.PARTING_SHOT, MoveId.SPLASH]); - game.override.enemyMoveset(MoveId.SPLASH); - game.override.startingLevel(5); - game.override.enemyLevel(5); + game.override + .battleStyle("single") + .moveset([MoveId.PARTING_SHOT, MoveId.SPLASH]) + .enemyMoveset(MoveId.SPLASH) + .startingLevel(5) + .enemyLevel(5); }); test("Parting Shot when buffed by prankster should fail against dark types", async () => { diff --git a/test/moves/powder.test.ts b/test/moves/powder.test.ts index 38e35d60335..889e660f167 100644 --- a/test/moves/powder.test.ts +++ b/test/moves/powder.test.ts @@ -28,9 +28,8 @@ describe("Moves - Powder", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - game.override + .battleStyle("single") .enemySpecies(SpeciesId.SNORLAX) .enemyLevel(100) .enemyMoveset(MoveId.EMBER) diff --git a/test/moves/protect.test.ts b/test/moves/protect.test.ts index 754a3433701..601afb43ec3 100644 --- a/test/moves/protect.test.ts +++ b/test/moves/protect.test.ts @@ -28,16 +28,14 @@ describe("Moves - Protect", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - - game.override.moveset([MoveId.PROTECT]); - game.override.enemySpecies(SpeciesId.SNORLAX); - - game.override.enemyAbility(AbilityId.INSOMNIA); - game.override.enemyMoveset([MoveId.TACKLE]); - - game.override.startingLevel(100); - game.override.enemyLevel(100); + game.override + .battleStyle("single") + .moveset([MoveId.PROTECT]) + .enemySpecies(SpeciesId.SNORLAX) + .enemyAbility(AbilityId.INSOMNIA) + .enemyMoveset([MoveId.TACKLE]) + .startingLevel(100) + .enemyLevel(100); }); test("should protect the user from attacks", async () => { diff --git a/test/moves/purify.test.ts b/test/moves/purify.test.ts index 0510260b755..2e8e312f23c 100644 --- a/test/moves/purify.test.ts +++ b/test/moves/purify.test.ts @@ -25,15 +25,14 @@ describe("Moves - Purify", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - - game.override.starterSpecies(SpeciesId.PYUKUMUKU); - game.override.startingLevel(10); - game.override.moveset([MoveId.PURIFY, MoveId.SIZZLY_SLIDE]); - - game.override.enemySpecies(SpeciesId.MAGIKARP); - game.override.enemyLevel(10); - game.override.enemyMoveset([MoveId.SPLASH, MoveId.NONE, MoveId.NONE, MoveId.NONE]); + game.override + .battleStyle("single") + .starterSpecies(SpeciesId.PYUKUMUKU) + .startingLevel(10) + .moveset([MoveId.PURIFY, MoveId.SIZZLY_SLIDE]) + .enemySpecies(SpeciesId.MAGIKARP) + .enemyLevel(10) + .enemyMoveset([MoveId.SPLASH]); }); test("Purify heals opponent status effect and restores user hp", async () => { diff --git a/test/moves/quick_guard.test.ts b/test/moves/quick_guard.test.ts index 49f501fb839..7146b804ffa 100644 --- a/test/moves/quick_guard.test.ts +++ b/test/moves/quick_guard.test.ts @@ -25,16 +25,14 @@ describe("Moves - Quick Guard", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("double"); - - game.override.moveset([MoveId.QUICK_GUARD, MoveId.SPLASH, MoveId.FOLLOW_ME]); - - game.override.enemySpecies(SpeciesId.SNORLAX); - game.override.enemyMoveset([MoveId.QUICK_ATTACK]); - game.override.enemyAbility(AbilityId.INSOMNIA); - - game.override.startingLevel(100); - game.override.enemyLevel(100); + game.override + .battleStyle("double") + .moveset([MoveId.QUICK_GUARD, MoveId.SPLASH, MoveId.FOLLOW_ME]) + .enemySpecies(SpeciesId.SNORLAX) + .enemyMoveset([MoveId.QUICK_ATTACK]) + .enemyAbility(AbilityId.INSOMNIA) + .startingLevel(100) + .enemyLevel(100); }); test("should protect the user and allies from priority moves", async () => { @@ -51,8 +49,7 @@ describe("Moves - Quick Guard", () => { }); test("should protect the user and allies from Prankster-boosted moves", async () => { - game.override.enemyAbility(AbilityId.PRANKSTER); - game.override.enemyMoveset([MoveId.GROWL]); + game.override.enemyAbility(AbilityId.PRANKSTER).enemyMoveset([MoveId.GROWL]); await game.classicMode.startBattle([SpeciesId.CHARIZARD, SpeciesId.BLASTOISE]); @@ -84,8 +81,7 @@ describe("Moves - Quick Guard", () => { }); test("should fail if the user is the last to move in the turn", async () => { - game.override.battleStyle("single"); - game.override.enemyMoveset([MoveId.QUICK_GUARD]); + game.override.battleStyle("single").enemyMoveset([MoveId.QUICK_GUARD]); await game.classicMode.startBattle([SpeciesId.CHARIZARD]); diff --git a/test/moves/rage_powder.test.ts b/test/moves/rage_powder.test.ts index 807000a0ff0..845bff33d04 100644 --- a/test/moves/rage_powder.test.ts +++ b/test/moves/rage_powder.test.ts @@ -22,12 +22,13 @@ describe("Moves - Rage Powder", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("double"); - game.override.enemySpecies(SpeciesId.SNORLAX); - game.override.startingLevel(100); - game.override.enemyLevel(100); - game.override.moveset([MoveId.FOLLOW_ME, MoveId.RAGE_POWDER, MoveId.SPOTLIGHT, MoveId.QUICK_ATTACK]); - game.override.enemyMoveset([MoveId.RAGE_POWDER, MoveId.TACKLE, MoveId.SPLASH]); + game.override + .battleStyle("double") + .enemySpecies(SpeciesId.SNORLAX) + .startingLevel(100) + .enemyLevel(100) + .moveset([MoveId.FOLLOW_ME, MoveId.RAGE_POWDER, MoveId.SPOTLIGHT, MoveId.QUICK_ATTACK]) + .enemyMoveset([MoveId.RAGE_POWDER, MoveId.TACKLE, MoveId.SPLASH]); }); test("move effect should be bypassed by Grass type", async () => { diff --git a/test/moves/rollout.test.ts b/test/moves/rollout.test.ts index de990a1a750..b9faf438ae5 100644 --- a/test/moves/rollout.test.ts +++ b/test/moves/rollout.test.ts @@ -23,18 +23,19 @@ describe("Moves - Rollout", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.disableCrits(); - game.override.battleStyle("single"); - game.override.starterSpecies(SpeciesId.RATTATA); - game.override.ability(AbilityId.BALL_FETCH); - game.override.enemySpecies(SpeciesId.BIDOOF); - game.override.enemyAbility(AbilityId.BALL_FETCH); - game.override.startingLevel(100); - game.override.enemyLevel(100); - game.override.enemyMoveset(MoveId.SPLASH); + game.override + .disableCrits() + .battleStyle("single") + .starterSpecies(SpeciesId.RATTATA) + .ability(AbilityId.BALL_FETCH) + .enemySpecies(SpeciesId.BIDOOF) + .enemyAbility(AbilityId.BALL_FETCH) + .startingLevel(100) + .enemyLevel(100) + .enemyMoveset(MoveId.SPLASH); }); - it("should double it's dmg on sequential uses but reset after 5", async () => { + it("should double its dmg on sequential uses but reset after 5", async () => { game.override.moveset([MoveId.ROLLOUT]); vi.spyOn(allMoves[MoveId.ROLLOUT], "accuracy", "get").mockReturnValue(100); //always hit diff --git a/test/moves/roost.test.ts b/test/moves/roost.test.ts index 1e588cb1e15..3707e0ead45 100644 --- a/test/moves/roost.test.ts +++ b/test/moves/roost.test.ts @@ -25,12 +25,13 @@ describe("Moves - Roost", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - game.override.enemySpecies(SpeciesId.RELICANTH); - game.override.startingLevel(100); - game.override.enemyLevel(100); - game.override.enemyMoveset(MoveId.EARTHQUAKE); - game.override.moveset([MoveId.ROOST, MoveId.BURN_UP, MoveId.DOUBLE_SHOCK]); + game.override + .battleStyle("single") + .enemySpecies(SpeciesId.RELICANTH) + .startingLevel(100) + .enemyLevel(100) + .enemyMoveset(MoveId.EARTHQUAKE) + .moveset([MoveId.ROOST, MoveId.BURN_UP, MoveId.DOUBLE_SHOCK]); }); /** diff --git a/test/moves/safeguard.test.ts b/test/moves/safeguard.test.ts index 6cd90bf8ac6..8d5303e3feb 100644 --- a/test/moves/safeguard.test.ts +++ b/test/moves/safeguard.test.ts @@ -1,12 +1,12 @@ import { BattlerIndex } from "#enums/battler-index"; import { allAbilities } from "#app/data/data-lists"; -import { AbilityId } from "#enums/ability-id"; import { StatusEffect } from "#app/enums/status-effect"; import GameManager from "#test/testUtils/gameManager"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; +import { AbilityId } from "#enums/ability-id"; describe("Moves - Safeguard", () => { let phaserGame: Phaser.Game; @@ -109,49 +109,50 @@ describe("Moves - Safeguard", () => { game.move.select(MoveId.SPLASH); await game.toNextTurn(); - expect(enemyPokemon.status?.effect).toEqual(StatusEffect.SLEEP); + expect(enemyPokemon.status?.effect).toBe(StatusEffect.SLEEP); }); - it("doesn't protect from self-inflicted via Rest or Flame Orb", async () => { + it("doesn't protect from self-inflicted status from Rest or Flame Orb", async () => { game.override.enemyHeldItems([{ name: "FLAME_ORB" }]); await game.classicMode.startBattle(); const enemyPokemon = game.scene.getEnemyPokemon()!; + enemyPokemon.hp = 1; game.move.select(MoveId.SPLASH); - await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]); + await game.move.forceEnemyMove(MoveId.SAFEGUARD); await game.toNextTurn(); - enemyPokemon.damageAndUpdate(1); - expect(enemyPokemon.status?.effect).toEqual(StatusEffect.BURN); + expect(enemyPokemon.status?.effect).toBe(StatusEffect.BURN); + + enemyPokemon.resetStatus(); - game.override.enemyMoveset([MoveId.REST]); - // Force the moveset to update mid-battle - // TODO: Remove after enemy AI rework is in - enemyPokemon.getMoveset(); game.move.select(MoveId.SPLASH); - enemyPokemon.damageAndUpdate(1); + await game.move.forceEnemyMove(MoveId.REST); await game.toNextTurn(); - expect(enemyPokemon.status?.effect).toEqual(StatusEffect.SLEEP); + expect(enemyPokemon.status?.effect).toBe(StatusEffect.SLEEP); }); it("protects from ability-inflicted status", async () => { - game.override.ability(AbilityId.STATIC); + await game.classicMode.startBattle(); + + const player = game.field.getPlayerPokemon(); + game.field.mockAbility(player, AbilityId.STATIC); vi.spyOn( allAbilities[AbilityId.STATIC].getAttrs("PostDefendContactApplyStatusEffectAbAttr")[0], "chance", "get", ).mockReturnValue(100); - await game.classicMode.startBattle(); - const enemyPokemon = game.scene.getEnemyPokemon()!; game.move.select(MoveId.SPLASH); - await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]); - await game.toNextTurn(); - game.override.enemyMoveset([MoveId.TACKLE]); - game.move.select(MoveId.SPLASH); + await game.move.forceEnemyMove(MoveId.SAFEGUARD); await game.toNextTurn(); + game.move.select(MoveId.SPLASH); + await game.move.forceEnemyMove(MoveId.TACKLE); + await game.toNextTurn(); + + const enemyPokemon = game.field.getEnemyPokemon(); expect(enemyPokemon.status).toBeUndefined(); }); }); diff --git a/test/moves/spikes.test.ts b/test/moves/spikes.test.ts index d847f296e59..a2d72054020 100644 --- a/test/moves/spikes.test.ts +++ b/test/moves/spikes.test.ts @@ -81,9 +81,7 @@ describe("Moves - Spikes", () => { }, 20000); it("should work when all targets fainted", async () => { - game.override.enemySpecies(SpeciesId.DIGLETT); - game.override.battleStyle("double"); - game.override.startingLevel(50); + game.override.enemySpecies(SpeciesId.DIGLETT).battleStyle("double").startingLevel(50); await game.classicMode.startBattle([SpeciesId.RAYQUAZA, SpeciesId.ROWLET]); game.move.select(MoveId.EARTHQUAKE); diff --git a/test/moves/spit_up.test.ts b/test/moves/spit_up.test.ts index 83549c28f40..fee58ef99f7 100644 --- a/test/moves/spit_up.test.ts +++ b/test/moves/spit_up.test.ts @@ -32,15 +32,14 @@ describe("Moves - Spit Up", () => { spitUp = allMoves[MoveId.SPIT_UP]; game = new GameManager(phaserGame); - game.override.battleStyle("single"); - - game.override.enemySpecies(SpeciesId.RATTATA); - game.override.enemyMoveset(MoveId.SPLASH); - game.override.enemyAbility(AbilityId.NONE); - game.override.enemyLevel(2000); - - game.override.moveset(new Array(4).fill(spitUp.id)); - game.override.ability(AbilityId.NONE); + game.override + .battleStyle("single") + .enemySpecies(SpeciesId.RATTATA) + .enemyMoveset(MoveId.SPLASH) + .enemyAbility(AbilityId.NONE) + .enemyLevel(2000) + .moveset(MoveId.SPIT_UP) + .ability(AbilityId.NONE); vi.spyOn(spitUp, "calculateBattlePower"); }); diff --git a/test/moves/spotlight.test.ts b/test/moves/spotlight.test.ts index 602cedcaec9..a9e8cd7e2b6 100644 --- a/test/moves/spotlight.test.ts +++ b/test/moves/spotlight.test.ts @@ -22,13 +22,14 @@ describe("Moves - Spotlight", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("double"); - game.override.starterSpecies(SpeciesId.AMOONGUSS); - game.override.enemySpecies(SpeciesId.SNORLAX); - game.override.startingLevel(100); - game.override.enemyLevel(100); - game.override.moveset([MoveId.FOLLOW_ME, MoveId.RAGE_POWDER, MoveId.SPOTLIGHT, MoveId.QUICK_ATTACK]); - game.override.enemyMoveset([MoveId.FOLLOW_ME, MoveId.SPLASH]); + game.override + .battleStyle("double") + .starterSpecies(SpeciesId.AMOONGUSS) + .enemySpecies(SpeciesId.SNORLAX) + .startingLevel(100) + .enemyLevel(100) + .moveset([MoveId.FOLLOW_ME, MoveId.RAGE_POWDER, MoveId.SPOTLIGHT, MoveId.QUICK_ATTACK]) + .enemyMoveset([MoveId.FOLLOW_ME, MoveId.SPLASH]); }); test("move should redirect attacks to the target", async () => { diff --git a/test/moves/stockpile.test.ts b/test/moves/stockpile.test.ts index 4baa7949bc6..342ca43c27f 100644 --- a/test/moves/stockpile.test.ts +++ b/test/moves/stockpile.test.ts @@ -27,15 +27,14 @@ describe("Moves - Stockpile", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - - game.override.enemySpecies(SpeciesId.RATTATA); - game.override.enemyMoveset(MoveId.SPLASH); - game.override.enemyAbility(AbilityId.NONE); - - game.override.startingLevel(2000); - game.override.moveset([MoveId.STOCKPILE, MoveId.SPLASH]); - game.override.ability(AbilityId.NONE); + game.override + .battleStyle("single") + .enemySpecies(SpeciesId.RATTATA) + .enemyMoveset(MoveId.SPLASH) + .enemyAbility(AbilityId.NONE) + .startingLevel(2000) + .moveset([MoveId.STOCKPILE, MoveId.SPLASH]) + .ability(AbilityId.NONE); }); it("gains a stockpile stack and raises user's DEF and SPDEF stat stages by 1 on each use, fails at max stacks (3)", async () => { diff --git a/test/moves/substitute.test.ts b/test/moves/substitute.test.ts index 857f20c7fa0..182fefb74d7 100644 --- a/test/moves/substitute.test.ts +++ b/test/moves/substitute.test.ts @@ -138,8 +138,7 @@ describe("Moves - Substitute", () => { }); it("should be bypassed by attackers with Infiltrator", async () => { - game.override.enemyMoveset(MoveId.TACKLE); - game.override.enemyAbility(AbilityId.INFILTRATOR); + game.override.enemyMoveset(MoveId.TACKLE).enemyAbility(AbilityId.INFILTRATOR); await game.classicMode.startBattle([SpeciesId.BLASTOISE]); @@ -230,8 +229,7 @@ describe("Moves - Substitute", () => { }); it("should protect the user from flinching", async () => { - game.override.enemyMoveset(MoveId.FAKE_OUT); - game.override.startingLevel(1); // Ensures the Substitute will break + game.override.enemyMoveset(MoveId.FAKE_OUT).startingLevel(1); // Ensures the Substitute will break await game.classicMode.startBattle([SpeciesId.BLASTOISE]); @@ -298,9 +296,8 @@ describe("Moves - Substitute", () => { }); it("should prevent the user's items from being stolen", async () => { - game.override.enemyMoveset(MoveId.THIEF); + game.override.enemyMoveset(MoveId.THIEF).startingHeldItems([{ name: "BERRY", type: BerryType.SITRUS }]); vi.spyOn(allMoves[MoveId.THIEF], "attrs", "get").mockReturnValue([new StealHeldItemChanceAttr(1.0)]); // give Thief 100% steal rate - game.override.startingHeldItems([{ name: "BERRY", type: BerryType.SITRUS }]); await game.classicMode.startBattle([SpeciesId.BLASTOISE]); @@ -316,8 +313,7 @@ describe("Moves - Substitute", () => { }); it("should prevent the user's items from being removed", async () => { - game.override.moveset([MoveId.KNOCK_OFF]); - game.override.enemyHeldItems([{ name: "BERRY", type: BerryType.SITRUS }]); + game.override.moveset([MoveId.KNOCK_OFF]).enemyHeldItems([{ name: "BERRY", type: BerryType.SITRUS }]); await game.classicMode.startBattle([SpeciesId.BLASTOISE]); @@ -334,8 +330,7 @@ describe("Moves - Substitute", () => { }); it("move effect should prevent the user's berries from being stolen and eaten", async () => { - game.override.enemyMoveset(MoveId.BUG_BITE); - game.override.startingHeldItems([{ name: "BERRY", type: BerryType.SITRUS }]); + game.override.enemyMoveset(MoveId.BUG_BITE).startingHeldItems([{ name: "BERRY", type: BerryType.SITRUS }]); await game.classicMode.startBattle([SpeciesId.BLASTOISE]); @@ -412,8 +407,7 @@ describe("Moves - Substitute", () => { }); it("should prevent the source's Rough Skin from activating when hit", async () => { - game.override.enemyMoveset(MoveId.TACKLE); - game.override.ability(AbilityId.ROUGH_SKIN); + game.override.enemyMoveset(MoveId.TACKLE).ability(AbilityId.ROUGH_SKIN); await game.classicMode.startBattle([SpeciesId.BLASTOISE]); @@ -427,8 +421,7 @@ describe("Moves - Substitute", () => { }); it("should prevent the source's Focus Punch from failing when hit", async () => { - game.override.enemyMoveset(MoveId.TACKLE); - game.override.moveset([MoveId.FOCUS_PUNCH]); + game.override.enemyMoveset(MoveId.TACKLE).moveset([MoveId.FOCUS_PUNCH]); // Make Focus Punch 40 power to avoid a KO vi.spyOn(allMoves[MoveId.FOCUS_PUNCH], "calculateBattlePower").mockReturnValue(40); @@ -449,8 +442,7 @@ describe("Moves - Substitute", () => { }); it("should not allow Shell Trap to activate when attacked", async () => { - game.override.enemyMoveset(MoveId.TACKLE); - game.override.moveset([MoveId.SHELL_TRAP]); + game.override.enemyMoveset(MoveId.TACKLE).moveset([MoveId.SHELL_TRAP]); await game.classicMode.startBattle([SpeciesId.BLASTOISE]); @@ -466,8 +458,7 @@ describe("Moves - Substitute", () => { }); it("should not allow Beak Blast to burn opponents when hit", async () => { - game.override.enemyMoveset(MoveId.TACKLE); - game.override.moveset([MoveId.BEAK_BLAST]); + game.override.enemyMoveset(MoveId.TACKLE).moveset([MoveId.BEAK_BLAST]); await game.classicMode.startBattle([SpeciesId.BLASTOISE]); @@ -484,8 +475,7 @@ describe("Moves - Substitute", () => { }); it("should cause incoming attacks to not activate Counter", async () => { - game.override.enemyMoveset(MoveId.TACKLE); - game.override.moveset([MoveId.COUNTER]); + game.override.enemyMoveset(MoveId.TACKLE).moveset([MoveId.COUNTER]); await game.classicMode.startBattle([SpeciesId.BLASTOISE]); diff --git a/test/moves/tackle.test.ts b/test/moves/tackle.test.ts index 83a267dc7e4..61780044f49 100644 --- a/test/moves/tackle.test.ts +++ b/test/moves/tackle.test.ts @@ -37,6 +37,7 @@ describe("Moves - Tackle", () => { it("TACKLE against ghost", async () => { const moveToUse = MoveId.TACKLE; game.override.enemySpecies(SpeciesId.GENGAR); + await game.classicMode.startBattle([SpeciesId.MIGHTYENA]); const hpOpponent = game.scene.currentBattle.enemyParty[0].hp; game.move.select(moveToUse); diff --git a/test/moves/tail_whip.test.ts b/test/moves/tail_whip.test.ts index 5118897a7cb..9c9ac736ece 100644 --- a/test/moves/tail_whip.test.ts +++ b/test/moves/tail_whip.test.ts @@ -25,13 +25,14 @@ describe("Moves - Tail whip", () => { beforeEach(() => { game = new GameManager(phaserGame); const moveToUse = MoveId.TAIL_WHIP; - game.override.battleStyle("single"); - game.override.enemySpecies(SpeciesId.RATTATA); - game.override.enemyAbility(AbilityId.INSOMNIA); - game.override.ability(AbilityId.INSOMNIA); - game.override.startingLevel(2000); - game.override.moveset([moveToUse]); - game.override.enemyMoveset(MoveId.SPLASH); + game.override + .battleStyle("single") + .enemySpecies(SpeciesId.RATTATA) + .enemyAbility(AbilityId.INSOMNIA) + .ability(AbilityId.INSOMNIA) + .startingLevel(2000) + .moveset([moveToUse]) + .enemyMoveset(MoveId.SPLASH); }); it("should lower DEF stat stage by 1", async () => { diff --git a/test/moves/thousand_arrows.test.ts b/test/moves/thousand_arrows.test.ts index 428e7c4fbe4..9ecdd94a94f 100644 --- a/test/moves/thousand_arrows.test.ts +++ b/test/moves/thousand_arrows.test.ts @@ -24,12 +24,13 @@ describe("Moves - Thousand Arrows", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - game.override.enemySpecies(SpeciesId.TOGETIC); - game.override.startingLevel(100); - game.override.enemyLevel(100); - game.override.moveset([MoveId.THOUSAND_ARROWS]); - game.override.enemyMoveset([MoveId.SPLASH, MoveId.SPLASH, MoveId.SPLASH, MoveId.SPLASH]); + game.override + .battleStyle("single") + .enemySpecies(SpeciesId.TOGETIC) + .startingLevel(100) + .enemyLevel(100) + .moveset([MoveId.THOUSAND_ARROWS]) + .enemyMoveset(MoveId.SPLASH); }); it("move should hit and ground Flying-type targets", async () => { @@ -50,8 +51,7 @@ describe("Moves - Thousand Arrows", () => { }); it("move should hit and ground targets with Levitate", async () => { - game.override.enemySpecies(SpeciesId.SNORLAX); - game.override.enemyAbility(AbilityId.LEVITATE); + game.override.enemySpecies(SpeciesId.SNORLAX).enemyAbility(AbilityId.LEVITATE); await game.classicMode.startBattle([SpeciesId.ILLUMISE]); diff --git a/test/moves/tidy_up.test.ts b/test/moves/tidy_up.test.ts index 8e79b6b130a..636946c2e6a 100644 --- a/test/moves/tidy_up.test.ts +++ b/test/moves/tidy_up.test.ts @@ -4,11 +4,11 @@ import { MoveEndPhase } from "#app/phases/move-end-phase"; import { TurnEndPhase } from "#app/phases/turn-end-phase"; import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; -import { SpeciesId } from "#enums/species-id"; import GameManager from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { SubstituteTag } from "#app/data/battler-tags"; +import { SpeciesId } from "#enums/species-id"; describe("Moves - Tidy Up", () => { let phaserGame: Phaser.Game; @@ -26,14 +26,15 @@ describe("Moves - Tidy Up", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - game.override.enemySpecies(SpeciesId.MAGIKARP); - game.override.enemyAbility(AbilityId.BALL_FETCH); - game.override.enemyMoveset(MoveId.SPLASH); - game.override.starterSpecies(SpeciesId.FEEBAS); - game.override.ability(AbilityId.BALL_FETCH); - game.override.moveset([MoveId.TIDY_UP]); - game.override.startingLevel(50); + game.override + .battleStyle("single") + .enemySpecies(SpeciesId.MAGIKARP) + .enemyAbility(AbilityId.BALL_FETCH) + .enemyMoveset(MoveId.SPLASH) + .starterSpecies(SpeciesId.FEEBAS) + .ability(AbilityId.BALL_FETCH) + .moveset([MoveId.TIDY_UP]) + .startingLevel(50); }); it("spikes are cleared", async () => { diff --git a/test/moves/toxic.test.ts b/test/moves/toxic.test.ts index eb23885b4b5..a7ba52eb963 100644 --- a/test/moves/toxic.test.ts +++ b/test/moves/toxic.test.ts @@ -75,8 +75,7 @@ describe("Moves - Toxic", () => { }); it("moves other than Toxic should not hit semi-invulnerable targets even if user is Poison-type", async () => { - game.override.moveset(MoveId.SWIFT); - game.override.enemyMoveset(MoveId.FLY); + game.override.moveset(MoveId.SWIFT).enemyMoveset(MoveId.FLY); await game.classicMode.startBattle([SpeciesId.TOXAPEX]); game.move.select(MoveId.SWIFT); diff --git a/test/moves/transform.test.ts b/test/moves/transform.test.ts index 8ee65802b37..4fbaf0136ab 100644 --- a/test/moves/transform.test.ts +++ b/test/moves/transform.test.ts @@ -154,8 +154,7 @@ describe("Moves - Transform", () => { }); it("should stay transformed with the correct form after reload", async () => { - game.override.enemyMoveset([]).moveset([]); - game.override.enemySpecies(SpeciesId.DARMANITAN); + game.override.enemyMoveset([]).moveset([]).enemySpecies(SpeciesId.DARMANITAN); await game.classicMode.startBattle([SpeciesId.DITTO]); diff --git a/test/moves/wide_guard.test.ts b/test/moves/wide_guard.test.ts index 65c3a0a805f..07c02158e94 100644 --- a/test/moves/wide_guard.test.ts +++ b/test/moves/wide_guard.test.ts @@ -25,16 +25,14 @@ describe("Moves - Wide Guard", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("double"); - - game.override.moveset([MoveId.WIDE_GUARD, MoveId.SPLASH, MoveId.SURF]); - - game.override.enemySpecies(SpeciesId.SNORLAX); - game.override.enemyMoveset([MoveId.SWIFT]); - game.override.enemyAbility(AbilityId.INSOMNIA); - - game.override.startingLevel(100); - game.override.enemyLevel(100); + game.override + .battleStyle("double") + .moveset([MoveId.WIDE_GUARD, MoveId.SPLASH, MoveId.SURF]) + .enemySpecies(SpeciesId.SNORLAX) + .enemyMoveset(MoveId.SWIFT) + .enemyAbility(AbilityId.INSOMNIA) + .startingLevel(100) + .enemyLevel(100); }); test("should protect the user and allies from multi-target attack moves", async () => { diff --git a/test/mystery-encounter/encounters/a-trainers-test-encounter.test.ts b/test/mystery-encounter/encounters/a-trainers-test-encounter.test.ts index d713db0aff8..e3368d339cd 100644 --- a/test/mystery-encounter/encounters/a-trainers-test-encounter.test.ts +++ b/test/mystery-encounter/encounters/a-trainers-test-encounter.test.ts @@ -38,10 +38,11 @@ describe("A Trainer's Test - Mystery Encounter", () => { beforeEach(async () => { game = new GameManager(phaserGame); scene = game.scene; - game.override.mysteryEncounterChance(100); - game.override.startingWave(defaultWave); - game.override.startingBiome(defaultBiome); - game.override.disableTrainerWaves(); + game.override + .mysteryEncounterChance(100) + .startingWave(defaultWave) + .startingBiome(defaultBiome) + .disableTrainerWaves(); const biomeMap = new Map([ [BiomeId.VOLCANO, [MysteryEncounterType.MYSTERIOUS_CHALLENGERS]], diff --git a/test/mystery-encounter/encounters/absolute-avarice-encounter.test.ts b/test/mystery-encounter/encounters/absolute-avarice-encounter.test.ts index f5bc1a62528..304ca87e0e6 100644 --- a/test/mystery-encounter/encounters/absolute-avarice-encounter.test.ts +++ b/test/mystery-encounter/encounters/absolute-avarice-encounter.test.ts @@ -38,10 +38,11 @@ describe("Absolute Avarice - Mystery Encounter", () => { beforeEach(async () => { game = new GameManager(phaserGame); scene = game.scene; - game.override.mysteryEncounterChance(100); - game.override.startingWave(defaultWave); - game.override.startingBiome(defaultBiome); - game.override.disableTrainerWaves(); + game.override + .mysteryEncounterChance(100) + .startingWave(defaultWave) + .startingBiome(defaultBiome) + .disableTrainerWaves(); vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue( new Map([ @@ -71,8 +72,7 @@ describe("Absolute Avarice - Mystery Encounter", () => { }); it("should not spawn outside of proper biomes", async () => { - game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT); - game.override.startingBiome(BiomeId.VOLCANO); + game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT).startingBiome(BiomeId.VOLCANO); await game.runToMysteryEncounter(); expect(game.scene.currentBattle.mysteryEncounter?.encounterType).not.toBe(MysteryEncounterType.ABSOLUTE_AVARICE); @@ -87,8 +87,7 @@ describe("Absolute Avarice - Mystery Encounter", () => { }); it("should spawn if player has enough berries", async () => { - game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT); - game.override.startingHeldItems([ + game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT).startingHeldItems([ { name: "BERRY", count: 2, type: BerryType.SITRUS }, { name: "BERRY", count: 3, type: BerryType.GANLON }, { name: "BERRY", count: 2, type: BerryType.APICOT }, @@ -139,7 +138,6 @@ describe("Absolute Avarice - Mystery Encounter", () => { expect(enemyField.length).toBe(1); expect(enemyField[0].species.speciesId).toBe(SpeciesId.GREEDENT); const moveset = enemyField[0].moveset.map(m => m.moveId); - expect(moveset?.length).toBe(4); expect(moveset).toEqual([MoveId.THRASH, MoveId.CRUNCH, MoveId.BODY_PRESS, MoveId.SLACK_OFF]); const movePhases = phaseSpy.mock.calls.filter(p => p[0] instanceof MovePhase).map(p => p[0]); diff --git a/test/mystery-encounter/encounters/an-offer-you-cant-refuse-encounter.test.ts b/test/mystery-encounter/encounters/an-offer-you-cant-refuse-encounter.test.ts index d208a859825..8e8253fd912 100644 --- a/test/mystery-encounter/encounters/an-offer-you-cant-refuse-encounter.test.ts +++ b/test/mystery-encounter/encounters/an-offer-you-cant-refuse-encounter.test.ts @@ -79,8 +79,7 @@ describe("An Offer You Can't Refuse - Mystery Encounter", () => { }); it("should not spawn outside of HUMAN_TRANSITABLE_BIOMES", async () => { - game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT); - game.override.startingBiome(BiomeId.VOLCANO); + game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT).startingBiome(BiomeId.VOLCANO); await game.runToMysteryEncounter(); expect(scene.currentBattle?.mysteryEncounter?.encounterType).not.toBe( diff --git a/test/mystery-encounter/encounters/bug-type-superfan-encounter.test.ts b/test/mystery-encounter/encounters/bug-type-superfan-encounter.test.ts index 8e58a0ca242..d5527d208fd 100644 --- a/test/mystery-encounter/encounters/bug-type-superfan-encounter.test.ts +++ b/test/mystery-encounter/encounters/bug-type-superfan-encounter.test.ts @@ -154,10 +154,11 @@ describe("Bug-Type Superfan - Mystery Encounter", () => { beforeEach(async () => { game = new GameManager(phaserGame); scene = game.scene; - game.override.mysteryEncounterChance(100); - game.override.startingWave(defaultWave); - game.override.startingBiome(defaultBiome); - game.override.disableTrainerWaves(); + game.override + .mysteryEncounterChance(100) + .startingWave(defaultWave) + .startingBiome(defaultBiome) + .disableTrainerWaves(); vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue( new Map([[BiomeId.CAVE, [MysteryEncounterType.BUG_TYPE_SUPERFAN]]]), diff --git a/test/mystery-encounter/encounters/clowning-around-encounter.test.ts b/test/mystery-encounter/encounters/clowning-around-encounter.test.ts index 526a3a0ab67..9965b90a981 100644 --- a/test/mystery-encounter/encounters/clowning-around-encounter.test.ts +++ b/test/mystery-encounter/encounters/clowning-around-encounter.test.ts @@ -55,10 +55,11 @@ describe("Clowning Around - Mystery Encounter", () => { beforeEach(async () => { game = new GameManager(phaserGame); scene = game.scene; - game.override.mysteryEncounterChance(100); - game.override.startingWave(defaultWave); - game.override.startingBiome(defaultBiome); - game.override.disableTrainerWaves(); + game.override + .mysteryEncounterChance(100) + .startingWave(defaultWave) + .startingBiome(defaultBiome) + .disableTrainerWaves(); vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue( new Map([[BiomeId.CAVE, [MysteryEncounterType.CLOWNING_AROUND]]]), diff --git a/test/mystery-encounter/encounters/dancing-lessons-encounter.test.ts b/test/mystery-encounter/encounters/dancing-lessons-encounter.test.ts index ee4aefd9904..f74100d7e35 100644 --- a/test/mystery-encounter/encounters/dancing-lessons-encounter.test.ts +++ b/test/mystery-encounter/encounters/dancing-lessons-encounter.test.ts @@ -41,10 +41,11 @@ describe("Dancing Lessons - Mystery Encounter", () => { beforeEach(async () => { game = new GameManager(phaserGame); scene = game.scene; - game.override.mysteryEncounterChance(100); - game.override.startingWave(defaultWave); - game.override.startingBiome(defaultBiome); - game.override.disableTrainerWaves(); + game.override + .mysteryEncounterChance(100) + .startingWave(defaultWave) + .startingBiome(defaultBiome) + .disableTrainerWaves(); vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue( new Map([ @@ -74,8 +75,7 @@ describe("Dancing Lessons - Mystery Encounter", () => { }); it("should not spawn outside of proper biomes", async () => { - game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT); - game.override.startingBiome(BiomeId.SPACE); + game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT).startingBiome(BiomeId.SPACE); await game.runToMysteryEncounter(); expect(game.scene.currentBattle.mysteryEncounter?.encounterType).not.toBe(MysteryEncounterType.DANCING_LESSONS); diff --git a/test/mystery-encounter/encounters/delibirdy-encounter.test.ts b/test/mystery-encounter/encounters/delibirdy-encounter.test.ts index e569c1d7789..0b6f7453522 100644 --- a/test/mystery-encounter/encounters/delibirdy-encounter.test.ts +++ b/test/mystery-encounter/encounters/delibirdy-encounter.test.ts @@ -46,10 +46,11 @@ describe("Delibird-y - Mystery Encounter", () => { beforeEach(async () => { game = new GameManager(phaserGame); scene = game.scene; - game.override.mysteryEncounterChance(100); - game.override.startingWave(defaultWave); - game.override.startingBiome(defaultBiome); - game.override.disableTrainerWaves(); + game.override + .mysteryEncounterChance(100) + .startingWave(defaultWave) + .startingBiome(defaultBiome) + .disableTrainerWaves(); vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue( new Map([[BiomeId.CAVE, [MysteryEncounterType.DELIBIRDY]]]), diff --git a/test/mystery-encounter/encounters/department-store-sale-encounter.test.ts b/test/mystery-encounter/encounters/department-store-sale-encounter.test.ts index 3feb44bbe91..470d41060fb 100644 --- a/test/mystery-encounter/encounters/department-store-sale-encounter.test.ts +++ b/test/mystery-encounter/encounters/department-store-sale-encounter.test.ts @@ -32,10 +32,11 @@ describe("Department Store Sale - Mystery Encounter", () => { beforeEach(async () => { game = new GameManager(phaserGame); scene = game.scene; - game.override.mysteryEncounterChance(100); - game.override.startingWave(defaultWave); - game.override.startingBiome(defaultBiome); - game.override.disableTrainerWaves(); + game.override + .mysteryEncounterChance(100) + .startingWave(defaultWave) + .startingBiome(defaultBiome) + .disableTrainerWaves(); const biomeMap = new Map([ [BiomeId.VOLCANO, [MysteryEncounterType.MYSTERIOUS_CHALLENGERS]], @@ -74,8 +75,7 @@ describe("Department Store Sale - Mystery Encounter", () => { }); it("should not spawn outside of CIVILIZATION_ENCOUNTER_BIOMES", async () => { - game.override.mysteryEncounterTier(MysteryEncounterTier.COMMON); - game.override.startingBiome(BiomeId.VOLCANO); + game.override.mysteryEncounterTier(MysteryEncounterTier.COMMON).startingBiome(BiomeId.VOLCANO); await game.runToMysteryEncounter(); expect(scene.currentBattle?.mysteryEncounter?.encounterType).not.toBe(MysteryEncounterType.DEPARTMENT_STORE_SALE); diff --git a/test/mystery-encounter/encounters/field-trip-encounter.test.ts b/test/mystery-encounter/encounters/field-trip-encounter.test.ts index f93de7dc955..e059827fa17 100644 --- a/test/mystery-encounter/encounters/field-trip-encounter.test.ts +++ b/test/mystery-encounter/encounters/field-trip-encounter.test.ts @@ -33,11 +33,12 @@ describe("Field Trip - Mystery Encounter", () => { beforeEach(async () => { game = new GameManager(phaserGame); scene = game.scene; - game.override.mysteryEncounterChance(100); - game.override.startingWave(defaultWave); - game.override.startingBiome(defaultBiome); - game.override.disableTrainerWaves(); - game.override.moveset([MoveId.TACKLE, MoveId.UPROAR, MoveId.SWORDS_DANCE]); + game.override + .mysteryEncounterChance(100) + .startingWave(defaultWave) + .startingBiome(defaultBiome) + .disableTrainerWaves() + .moveset([MoveId.TACKLE, MoveId.UPROAR, MoveId.SWORDS_DANCE]); vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue( new Map([[BiomeId.CAVE, [MysteryEncounterType.FIELD_TRIP]]]), diff --git a/test/mystery-encounter/encounters/fight-or-flight-encounter.test.ts b/test/mystery-encounter/encounters/fight-or-flight-encounter.test.ts index e0e8b3d90d6..bf5d58fdad3 100644 --- a/test/mystery-encounter/encounters/fight-or-flight-encounter.test.ts +++ b/test/mystery-encounter/encounters/fight-or-flight-encounter.test.ts @@ -40,10 +40,11 @@ describe("Fight or Flight - Mystery Encounter", () => { beforeEach(async () => { game = new GameManager(phaserGame); scene = game.scene; - game.override.mysteryEncounterChance(100); - game.override.startingWave(defaultWave); - game.override.startingBiome(defaultBiome); - game.override.disableTrainerWaves(); + game.override + .mysteryEncounterChance(100) + .startingWave(defaultWave) + .startingBiome(defaultBiome) + .disableTrainerWaves(); vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue( new Map([[BiomeId.CAVE, [MysteryEncounterType.FIGHT_OR_FLIGHT]]]), diff --git a/test/mystery-encounter/encounters/fun-and-games-encounter.test.ts b/test/mystery-encounter/encounters/fun-and-games-encounter.test.ts index e31a3a5cc3c..9f2057080f9 100644 --- a/test/mystery-encounter/encounters/fun-and-games-encounter.test.ts +++ b/test/mystery-encounter/encounters/fun-and-games-encounter.test.ts @@ -42,10 +42,11 @@ describe("Fun And Games! - Mystery Encounter", () => { beforeEach(async () => { game = new GameManager(phaserGame); scene = game.scene; - game.override.mysteryEncounterChance(100); - game.override.startingWave(defaultWave); - game.override.startingBiome(defaultBiome); - game.override.disableTrainerWaves(); + game.override + .mysteryEncounterChance(100) + .startingWave(defaultWave) + .startingBiome(defaultBiome) + .disableTrainerWaves(); const biomeMap = new Map([ [BiomeId.VOLCANO, [MysteryEncounterType.FIGHT_OR_FLIGHT]], @@ -81,8 +82,7 @@ describe("Fun And Games! - Mystery Encounter", () => { }); it("should not spawn outside of CIVILIZATIONN biomes", async () => { - game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT); - game.override.startingBiome(BiomeId.VOLCANO); + game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT).startingBiome(BiomeId.VOLCANO); await game.runToMysteryEncounter(); expect(scene.currentBattle?.mysteryEncounter?.encounterType).not.toBe(MysteryEncounterType.FUN_AND_GAMES); diff --git a/test/mystery-encounter/encounters/global-trade-system-encounter.test.ts b/test/mystery-encounter/encounters/global-trade-system-encounter.test.ts index 0aa1886b8e1..02ffc56fb2e 100644 --- a/test/mystery-encounter/encounters/global-trade-system-encounter.test.ts +++ b/test/mystery-encounter/encounters/global-trade-system-encounter.test.ts @@ -37,10 +37,11 @@ describe("Global Trade System - Mystery Encounter", () => { beforeEach(async () => { game = new GameManager(phaserGame); scene = game.scene; - game.override.mysteryEncounterChance(100); - game.override.startingWave(defaultWave); - game.override.startingBiome(defaultBiome); - game.override.disableTrainerWaves(); + game.override + .mysteryEncounterChance(100) + .startingWave(defaultWave) + .startingBiome(defaultBiome) + .disableTrainerWaves(); const biomeMap = new Map([ [BiomeId.VOLCANO, [MysteryEncounterType.MYSTERIOUS_CHALLENGERS]], @@ -85,8 +86,7 @@ describe("Global Trade System - Mystery Encounter", () => { }); it("should not spawn outside of CIVILIZATION_ENCOUNTER_BIOMES", async () => { - game.override.mysteryEncounterTier(MysteryEncounterTier.COMMON); - game.override.startingBiome(BiomeId.VOLCANO); + game.override.mysteryEncounterTier(MysteryEncounterTier.COMMON).startingBiome(BiomeId.VOLCANO); await game.runToMysteryEncounter(); expect(scene.currentBattle?.mysteryEncounter?.encounterType).not.toBe(MysteryEncounterType.GLOBAL_TRADE_SYSTEM); diff --git a/test/mystery-encounter/encounters/lost-at-sea-encounter.test.ts b/test/mystery-encounter/encounters/lost-at-sea-encounter.test.ts index 8f041a14002..971cd938925 100644 --- a/test/mystery-encounter/encounters/lost-at-sea-encounter.test.ts +++ b/test/mystery-encounter/encounters/lost-at-sea-encounter.test.ts @@ -34,10 +34,11 @@ describe("Lost at Sea - Mystery Encounter", () => { beforeEach(async () => { game = new GameManager(phaserGame); scene = game.scene; - game.override.mysteryEncounterChance(100); - game.override.startingWave(defaultWave); - game.override.startingBiome(defaultBiome); - game.override.disableTrainerWaves(); + game.override + .mysteryEncounterChance(100) + .startingWave(defaultWave) + .startingBiome(defaultBiome) + .disableTrainerWaves(); vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue( new Map([ @@ -67,8 +68,7 @@ describe("Lost at Sea - Mystery Encounter", () => { }); it("should not spawn outside of sea biome", async () => { - game.override.mysteryEncounterTier(MysteryEncounterTier.COMMON); - game.override.startingBiome(BiomeId.MOUNTAIN); + game.override.mysteryEncounterTier(MysteryEncounterTier.COMMON).startingBiome(BiomeId.MOUNTAIN); await game.runToMysteryEncounter(); expect(game.scene.currentBattle.mysteryEncounter?.encounterType).not.toBe(MysteryEncounterType.LOST_AT_SEA); diff --git a/test/mystery-encounter/encounters/mysterious-challengers-encounter.test.ts b/test/mystery-encounter/encounters/mysterious-challengers-encounter.test.ts index 9c5660cb25c..04b611e1143 100644 --- a/test/mystery-encounter/encounters/mysterious-challengers-encounter.test.ts +++ b/test/mystery-encounter/encounters/mysterious-challengers-encounter.test.ts @@ -43,10 +43,11 @@ describe("Mysterious Challengers - Mystery Encounter", () => { beforeEach(async () => { game = new GameManager(phaserGame); scene = game.scene; - game.override.mysteryEncounterChance(100); - game.override.startingWave(defaultWave); - game.override.startingBiome(defaultBiome); - game.override.disableTrainerWaves(); + game.override + .mysteryEncounterChance(100) + .startingWave(defaultWave) + .startingBiome(defaultBiome) + .disableTrainerWaves(); const biomeMap = new Map([ [BiomeId.VOLCANO, [MysteryEncounterType.FIGHT_OR_FLIGHT]], @@ -79,8 +80,7 @@ describe("Mysterious Challengers - Mystery Encounter", () => { }); it("should not spawn outside of HUMAN_TRANSITABLE_BIOMES", async () => { - game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT); - game.override.startingBiome(BiomeId.VOLCANO); + game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT).startingBiome(BiomeId.VOLCANO); await game.runToMysteryEncounter(); expect(scene.currentBattle?.mysteryEncounter?.encounterType).not.toBe(MysteryEncounterType.MYSTERIOUS_CHALLENGERS); diff --git a/test/mystery-encounter/encounters/part-timer-encounter.test.ts b/test/mystery-encounter/encounters/part-timer-encounter.test.ts index be985ea0593..4436f2e19fe 100644 --- a/test/mystery-encounter/encounters/part-timer-encounter.test.ts +++ b/test/mystery-encounter/encounters/part-timer-encounter.test.ts @@ -36,10 +36,11 @@ describe("Part-Timer - Mystery Encounter", () => { beforeEach(async () => { game = new GameManager(phaserGame); scene = game.scene; - game.override.mysteryEncounterChance(100); - game.override.startingWave(defaultWave); - game.override.startingBiome(defaultBiome); - game.override.disableTrainerWaves(); + game.override + .mysteryEncounterChance(100) + .startingWave(defaultWave) + .startingBiome(defaultBiome) + .disableTrainerWaves(); const biomeMap = new Map([ [BiomeId.VOLCANO, [MysteryEncounterType.MYSTERIOUS_CHALLENGERS]], @@ -76,8 +77,7 @@ describe("Part-Timer - Mystery Encounter", () => { }); it("should not spawn outside of CIVILIZATION_ENCOUNTER_BIOMES", async () => { - game.override.mysteryEncounterTier(MysteryEncounterTier.COMMON); - game.override.startingBiome(BiomeId.VOLCANO); + game.override.mysteryEncounterTier(MysteryEncounterTier.COMMON).startingBiome(BiomeId.VOLCANO); await game.runToMysteryEncounter(); expect(scene.currentBattle?.mysteryEncounter?.encounterType).not.toBe(MysteryEncounterType.PART_TIMER); diff --git a/test/mystery-encounter/encounters/safari-zone.test.ts b/test/mystery-encounter/encounters/safari-zone.test.ts index dcaf25dd512..a086272c721 100644 --- a/test/mystery-encounter/encounters/safari-zone.test.ts +++ b/test/mystery-encounter/encounters/safari-zone.test.ts @@ -38,10 +38,11 @@ describe("Safari Zone - Mystery Encounter", () => { beforeEach(async () => { game = new GameManager(phaserGame); scene = game.scene; - game.override.mysteryEncounterChance(100); - game.override.startingWave(defaultWave); - game.override.startingBiome(defaultBiome); - game.override.disableTrainerWaves(); + game.override + .mysteryEncounterChance(100) + .startingWave(defaultWave) + .startingBiome(defaultBiome) + .disableTrainerWaves(); const biomeMap = new Map([ [BiomeId.VOLCANO, [MysteryEncounterType.FIGHT_OR_FLIGHT]], @@ -72,8 +73,7 @@ describe("Safari Zone - Mystery Encounter", () => { }); it("should not spawn outside of the forest, swamp, or jungle biomes", async () => { - game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT); - game.override.startingBiome(BiomeId.VOLCANO); + game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT).startingBiome(BiomeId.VOLCANO); await game.runToMysteryEncounter(); expect(scene.currentBattle?.mysteryEncounter?.encounterType).not.toBe(MysteryEncounterType.SAFARI_ZONE); diff --git a/test/mystery-encounter/encounters/teleporting-hijinks-encounter.test.ts b/test/mystery-encounter/encounters/teleporting-hijinks-encounter.test.ts index 6c8daed998c..12398049abd 100644 --- a/test/mystery-encounter/encounters/teleporting-hijinks-encounter.test.ts +++ b/test/mystery-encounter/encounters/teleporting-hijinks-encounter.test.ts @@ -82,8 +82,7 @@ describe("Teleporting Hijinks - Mystery Encounter", () => { }); it("should run in waves that are X1", async () => { - game.override.startingWave(11); - game.override.mysteryEncounterTier(MysteryEncounterTier.COMMON); + game.override.startingWave(11).mysteryEncounterTier(MysteryEncounterTier.COMMON); await game.runToMysteryEncounter(); @@ -91,8 +90,7 @@ describe("Teleporting Hijinks - Mystery Encounter", () => { }); it("should run in waves that are X2", async () => { - game.override.startingWave(32); - game.override.mysteryEncounterTier(MysteryEncounterTier.COMMON); + game.override.startingWave(32).mysteryEncounterTier(MysteryEncounterTier.COMMON); await game.runToMysteryEncounter(); @@ -100,8 +98,7 @@ describe("Teleporting Hijinks - Mystery Encounter", () => { }); it("should run in waves that are X3", async () => { - game.override.startingWave(23); - game.override.mysteryEncounterTier(MysteryEncounterTier.COMMON); + game.override.startingWave(23).mysteryEncounterTier(MysteryEncounterTier.COMMON); await game.runToMysteryEncounter(); diff --git a/test/mystery-encounter/encounters/the-expert-breeder-encounter.test.ts b/test/mystery-encounter/encounters/the-expert-breeder-encounter.test.ts index 0d5f67b8815..ed6d1c5bc4f 100644 --- a/test/mystery-encounter/encounters/the-expert-breeder-encounter.test.ts +++ b/test/mystery-encounter/encounters/the-expert-breeder-encounter.test.ts @@ -40,10 +40,11 @@ describe("The Expert Pokémon Breeder - Mystery Encounter", () => { beforeEach(async () => { game = new GameManager(phaserGame); scene = game.scene; - game.override.mysteryEncounterChance(100); - game.override.startingWave(defaultWave); - game.override.startingBiome(defaultBiome); - game.override.disableTrainerWaves(); + game.override + .mysteryEncounterChance(100) + .startingWave(defaultWave) + .startingBiome(defaultBiome) + .disableTrainerWaves(); const biomeMap = new Map([ [BiomeId.VOLCANO, [MysteryEncounterType.FIGHT_OR_FLIGHT]], @@ -84,8 +85,7 @@ describe("The Expert Pokémon Breeder - Mystery Encounter", () => { }); it("should not spawn outside of HUMAN_TRANSITABLE_BIOMES", async () => { - game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT); - game.override.startingBiome(BiomeId.VOLCANO); + game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT).startingBiome(BiomeId.VOLCANO); await game.runToMysteryEncounter(); expect(scene.currentBattle?.mysteryEncounter?.encounterType).not.toBe( diff --git a/test/mystery-encounter/encounters/the-pokemon-salesman-encounter.test.ts b/test/mystery-encounter/encounters/the-pokemon-salesman-encounter.test.ts index 13d7c2502a6..ee2d7d8039b 100644 --- a/test/mystery-encounter/encounters/the-pokemon-salesman-encounter.test.ts +++ b/test/mystery-encounter/encounters/the-pokemon-salesman-encounter.test.ts @@ -38,10 +38,11 @@ describe("The Pokemon Salesman - Mystery Encounter", () => { beforeEach(async () => { game = new GameManager(phaserGame); scene = game.scene; - game.override.mysteryEncounterChance(100); - game.override.startingWave(defaultWave); - game.override.startingBiome(defaultBiome); - game.override.disableTrainerWaves(); + game.override + .mysteryEncounterChance(100) + .startingWave(defaultWave) + .startingBiome(defaultBiome) + .disableTrainerWaves(); const biomeMap = new Map([ [BiomeId.VOLCANO, [MysteryEncounterType.MYSTERIOUS_CHALLENGERS]], @@ -78,8 +79,7 @@ describe("The Pokemon Salesman - Mystery Encounter", () => { }); it("should not spawn outside of HUMAN_TRANSITABLE_BIOMES", async () => { - game.override.mysteryEncounterTier(MysteryEncounterTier.ULTRA); - game.override.startingBiome(BiomeId.VOLCANO); + game.override.mysteryEncounterTier(MysteryEncounterTier.ULTRA).startingBiome(BiomeId.VOLCANO); await game.runToMysteryEncounter(); expect(scene.currentBattle?.mysteryEncounter?.encounterType).not.toBe(MysteryEncounterType.THE_POKEMON_SALESMAN); diff --git a/test/mystery-encounter/encounters/the-strong-stuff-encounter.test.ts b/test/mystery-encounter/encounters/the-strong-stuff-encounter.test.ts index 5926c1ed2e7..5f7c0f5a0fd 100644 --- a/test/mystery-encounter/encounters/the-strong-stuff-encounter.test.ts +++ b/test/mystery-encounter/encounters/the-strong-stuff-encounter.test.ts @@ -83,8 +83,7 @@ describe("The Strong Stuff - Mystery Encounter", () => { }); it("should not spawn outside of CAVE biome", async () => { - game.override.mysteryEncounterTier(MysteryEncounterTier.COMMON); - game.override.startingBiome(BiomeId.MOUNTAIN); + game.override.mysteryEncounterTier(MysteryEncounterTier.COMMON).startingBiome(BiomeId.MOUNTAIN); await game.runToMysteryEncounter(); expect(scene.currentBattle?.mysteryEncounter?.encounterType).not.toBe(MysteryEncounterType.THE_STRONG_STUFF); diff --git a/test/mystery-encounter/encounters/the-winstrate-challenge-encounter.test.ts b/test/mystery-encounter/encounters/the-winstrate-challenge-encounter.test.ts index 87a3852615d..72f76358398 100644 --- a/test/mystery-encounter/encounters/the-winstrate-challenge-encounter.test.ts +++ b/test/mystery-encounter/encounters/the-winstrate-challenge-encounter.test.ts @@ -44,10 +44,11 @@ describe("The Winstrate Challenge - Mystery Encounter", () => { beforeEach(async () => { game = new GameManager(phaserGame); scene = game.scene; - game.override.mysteryEncounterChance(100); - game.override.startingWave(defaultWave); - game.override.startingBiome(defaultBiome); - game.override.disableTrainerWaves(); + game.override + .mysteryEncounterChance(100) + .startingWave(defaultWave) + .startingBiome(defaultBiome) + .disableTrainerWaves(); const biomeMap = new Map([ [BiomeId.VOLCANO, [MysteryEncounterType.FIGHT_OR_FLIGHT]], @@ -86,8 +87,7 @@ describe("The Winstrate Challenge - Mystery Encounter", () => { }); it("should not spawn outside of HUMAN_TRANSITABLE_BIOMES", async () => { - game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT); - game.override.startingBiome(BiomeId.VOLCANO); + game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT).startingBiome(BiomeId.VOLCANO); await game.runToMysteryEncounter(); expect(scene.currentBattle?.mysteryEncounter?.encounterType).not.toBe(MysteryEncounterType.THE_WINSTRATE_CHALLENGE); diff --git a/test/mystery-encounter/encounters/trash-to-treasure-encounter.test.ts b/test/mystery-encounter/encounters/trash-to-treasure-encounter.test.ts index 2014cb215a4..6e2da14dffc 100644 --- a/test/mystery-encounter/encounters/trash-to-treasure-encounter.test.ts +++ b/test/mystery-encounter/encounters/trash-to-treasure-encounter.test.ts @@ -51,10 +51,11 @@ describe("Trash to Treasure - Mystery Encounter", () => { beforeEach(async () => { game = new GameManager(phaserGame); scene = game.scene; - game.override.mysteryEncounterChance(100); - game.override.startingWave(defaultWave); - game.override.startingBiome(defaultBiome); - game.override.disableTrainerWaves(); + game.override + .mysteryEncounterChance(100) + .startingWave(defaultWave) + .startingBiome(defaultBiome) + .disableTrainerWaves(); vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue( new Map([[BiomeId.CAVE, [MysteryEncounterType.TRASH_TO_TREASURE]]]), diff --git a/test/mystery-encounter/encounters/weird-dream-encounter.test.ts b/test/mystery-encounter/encounters/weird-dream-encounter.test.ts index dc5c53a75e7..27d41ec66cb 100644 --- a/test/mystery-encounter/encounters/weird-dream-encounter.test.ts +++ b/test/mystery-encounter/encounters/weird-dream-encounter.test.ts @@ -38,10 +38,11 @@ describe("Weird Dream - Mystery Encounter", () => { beforeEach(async () => { game = new GameManager(phaserGame); scene = game.scene; - game.override.mysteryEncounterChance(100); - game.override.startingWave(defaultWave); - game.override.startingBiome(defaultBiome); - game.override.disableTrainerWaves(); + game.override + .mysteryEncounterChance(100) + .startingWave(defaultWave) + .startingBiome(defaultBiome) + .disableTrainerWaves(); vi.spyOn(EncounterTransformationSequence, "doPokemonTransformationSequence").mockImplementation( () => new Promise(resolve => resolve()), ); diff --git a/test/mystery-encounter/mystery-encounter-utils.test.ts b/test/mystery-encounter/mystery-encounter-utils.test.ts index 80e2fb77f2b..f327d8f9e9c 100644 --- a/test/mystery-encounter/mystery-encounter-utils.test.ts +++ b/test/mystery-encounter/mystery-encounter-utils.test.ts @@ -250,6 +250,7 @@ describe("Mystery Encounter Utils", () => { it("gets species of specified types", () => { // Only 9 tiers are: Kyogre, Groudon, Rayquaza, Arceus, Zacian, Koraidon, Miraidon, Terapagos + // TODO: This has to be changed const result = getRandomSpeciesByStarterCost(9, undefined, [PokemonType.GROUND]); const pokeSpecies = getPokemonSpecies(result); expect(pokeSpecies.speciesId).toBe(SpeciesId.GROUDON); diff --git a/test/mystery-encounter/mystery-encounter.test.ts b/test/mystery-encounter/mystery-encounter.test.ts index 1f1d0f5826e..be1f153f8b1 100644 --- a/test/mystery-encounter/mystery-encounter.test.ts +++ b/test/mystery-encounter/mystery-encounter.test.ts @@ -24,8 +24,7 @@ describe("Mystery Encounters", () => { beforeEach(() => { game = new GameManager(phaserGame); scene = game.scene; - game.override.startingWave(11); - game.override.mysteryEncounterChance(100); + game.override.startingWave(11).mysteryEncounterChance(100); }); it("Spawns a mystery encounter", async () => { diff --git a/test/phases/mystery-encounter-phase.test.ts b/test/phases/mystery-encounter-phase.test.ts index d078c2398b4..b17682d6c74 100644 --- a/test/phases/mystery-encounter-phase.test.ts +++ b/test/phases/mystery-encounter-phase.test.ts @@ -27,10 +27,7 @@ describe("Mystery Encounter Phases", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.startingWave(11); - game.override.mysteryEncounterChance(100); - // Seed guarantees wild encounter to be replaced by ME - game.override.seed("test"); + game.override.startingWave(11).mysteryEncounterChance(100).seed("test"); // Seed guarantees wild encounter to be replaced by ME }); describe("MysteryEncounterPhase", () => { diff --git a/test/testUtils/helpers/moveHelper.ts b/test/testUtils/helpers/moveHelper.ts index 0f87fa9a4c1..d8c79c3bca8 100644 --- a/test/testUtils/helpers/moveHelper.ts +++ b/test/testUtils/helpers/moveHelper.ts @@ -21,6 +21,7 @@ export class MoveHelper extends GameManagerHelper { /** * Intercepts {@linkcode MoveEffectPhase} and mocks the phase's move's * accuracy to -1, guaranteeing a hit. + * @returns A promise that resolves once the next MoveEffectPhase has been reached (not run). */ public async forceHit(): Promise { await this.game.phaseInterceptor.to(MoveEffectPhase, false); @@ -31,7 +32,8 @@ export class MoveHelper extends GameManagerHelper { /** * Intercepts {@linkcode MoveEffectPhase} and mocks the phase's move's accuracy * to 0, guaranteeing a miss. - * @param firstTargetOnly - Whether the move should force miss on the first target only, in the case of multi-target moves. + * @param firstTargetOnly - Whether to only force a miss on the first target hit; default `false`. + * @returns A promise that resolves once the next MoveEffectPhase has been reached (not run). */ public async forceMiss(firstTargetOnly = false): Promise { await this.game.phaseInterceptor.to(MoveEffectPhase, false); diff --git a/test/ui/pokedex.test.ts b/test/ui/pokedex.test.ts index 573ce3fef89..53ebe04a4ed 100644 --- a/test/ui/pokedex.test.ts +++ b/test/ui/pokedex.test.ts @@ -502,13 +502,13 @@ describe("UI - Pokedex", () => { // Nab the pokemon that is selected for comparison later. // @ts-expect-error - `lastSpecies` is private - const selectedPokemon = pokedexHandler.lastSpecies.speciesId; + const selectedPokemon = pokedexHandler.lastSpeciesId.speciesId; for (let i = 0; i < 11; i++) { pokedexHandler.processInput(Button.DOWN); } // @ts-expect-error `lastSpecies` is private - expect(selectedPokemon).toEqual(pokedexHandler.lastSpecies.speciesId); + expect(selectedPokemon).toEqual(pokedexHandler.lastSpeciesId.speciesId); }, ); diff --git a/test/ui/transfer-item.test.ts b/test/ui/transfer-item.test.ts index b08c9823dcd..ef0fe502c6e 100644 --- a/test/ui/transfer-item.test.ts +++ b/test/ui/transfer-item.test.ts @@ -26,17 +26,18 @@ describe("UI - Transfer Items", () => { beforeEach(async () => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - game.override.startingLevel(100); - game.override.startingWave(1); - game.override.startingHeldItems([ - { name: "BERRY", count: 1, type: BerryType.SITRUS }, - { name: "BERRY", count: 2, type: BerryType.APICOT }, - { name: "BERRY", count: 2, type: BerryType.LUM }, - ]); - game.override.moveset([MoveId.DRAGON_CLAW]); - game.override.enemySpecies(SpeciesId.MAGIKARP); - game.override.enemyMoveset([MoveId.SPLASH]); + game.override + .battleStyle("single") + .startingLevel(100) + .startingWave(1) + .startingHeldItems([ + { name: "BERRY", count: 1, type: BerryType.SITRUS }, + { name: "BERRY", count: 2, type: BerryType.APICOT }, + { name: "BERRY", count: 2, type: BerryType.LUM }, + ]) + .moveset([MoveId.DRAGON_CLAW]) + .enemySpecies(SpeciesId.MAGIKARP) + .enemyMoveset([MoveId.SPLASH]); await game.classicMode.startBattle([SpeciesId.RAYQUAZA, SpeciesId.RAYQUAZA, SpeciesId.RAYQUAZA]);