From a4bff58a99f6d689385e5ea692f10f0c9ace2d0d Mon Sep 17 00:00:00 2001 From: TaylorLeLievre Date: Sun, 25 Aug 2024 12:22:19 -0400 Subject: [PATCH 1/3] Fix merge conflicts --- src/phases/return-phase.ts | 3 +++ src/phases/switch-summon-phase.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/phases/return-phase.ts b/src/phases/return-phase.ts index 19c73816b36..a85017fbedd 100644 --- a/src/phases/return-phase.ts +++ b/src/phases/return-phase.ts @@ -1,4 +1,5 @@ import BattleScene from "#app/battle-scene"; +import { applyPreSwitchOutAbAttrs, PreSwitchOutAbAttr } from "#app/data/ability.js"; import { SpeciesFormChangeActiveTrigger } from "#app/data/pokemon-forms"; import { SwitchSummonPhase } from "./switch-summon-phase"; @@ -8,6 +9,8 @@ export class ReturnPhase extends SwitchSummonPhase { } switchAndSummon(): void { + this.lastPokemon = this.getPokemon(); + applyPreSwitchOutAbAttrs(PreSwitchOutAbAttr, this.lastPokemon); this.end(); } diff --git a/src/phases/switch-summon-phase.ts b/src/phases/switch-summon-phase.ts index 525f74e896f..5b3d2f560d8 100644 --- a/src/phases/switch-summon-phase.ts +++ b/src/phases/switch-summon-phase.ts @@ -18,7 +18,7 @@ export class SwitchSummonPhase extends SummonPhase { private doReturn: boolean; private batonPass: boolean; - private lastPokemon: Pokemon; + protected lastPokemon: Pokemon; /** * Constructor for creating a new SwitchSummonPhase From 1fc34d862f6fed7093b166cdb034249e0e8c6b11 Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Sun, 25 Aug 2024 11:08:15 -0700 Subject: [PATCH 2/3] Remove `.js` from import --- src/phases/return-phase.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phases/return-phase.ts b/src/phases/return-phase.ts index a85017fbedd..d126f4f5d6b 100644 --- a/src/phases/return-phase.ts +++ b/src/phases/return-phase.ts @@ -1,5 +1,5 @@ import BattleScene from "#app/battle-scene"; -import { applyPreSwitchOutAbAttrs, PreSwitchOutAbAttr } from "#app/data/ability.js"; +import { applyPreSwitchOutAbAttrs, PreSwitchOutAbAttr } from "#app/data/ability"; import { SpeciesFormChangeActiveTrigger } from "#app/data/pokemon-forms"; import { SwitchSummonPhase } from "./switch-summon-phase"; From c9cda53724f990cffac7b1f0c49fe91dd93c5d9a Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Sun, 25 Aug 2024 11:35:57 -0700 Subject: [PATCH 3/3] Add regression test --- src/test/abilities/delta_stream.test.ts | 50 +++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/test/abilities/delta_stream.test.ts diff --git a/src/test/abilities/delta_stream.test.ts b/src/test/abilities/delta_stream.test.ts new file mode 100644 index 00000000000..0482d7f7b37 --- /dev/null +++ b/src/test/abilities/delta_stream.test.ts @@ -0,0 +1,50 @@ +import { Moves } from "#app/enums/moves"; +import { Species } from "#app/enums/species"; +import { WeatherType } from "#app/enums/weather-type"; +import { Abilities } from "#enums/abilities"; +import GameManager from "#test/utils/gameManager"; +import { SPLASH_ONLY } from "#test/utils/testUtils"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; + +describe("Abilities - Delta Stream", () => { + let phaserGame: Phaser.Game; + let game: GameManager; + + beforeAll(() => { + phaserGame = new Phaser.Game({ + type: Phaser.HEADLESS, + }); + }); + + afterEach(() => { + game.phaseInterceptor.restoreOg(); + }); + + beforeEach(() => { + game = new GameManager(phaserGame); + game.override + .battleType("double") + .enemyAbility(Abilities.BALL_FETCH) + .enemyMoveset(SPLASH_ONLY) + .enemySpecies(Species.MAGIKARP) + .moveset([Moves.SPLASH]) + .starterForms({ + [Species.RAYQUAZA]: 1 + }); + }); + + it("no longer applies after transition from double to single battle", async () => { + await game.startBattle([Species.FEEBAS, Species.RAYQUAZA]); + + expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.STRONG_WINDS); + + game.move.select(Moves.SPLASH); + game.move.select(Moves.SPLASH, 1); + await game.doKillOpponents(); + game.override.battleType("single"); + await game.toNextWave(); + + expect(game.scene.arena.weather?.weatherType).toBeUndefined(); + }); +});