From d99dbf495568ede0eb440742c918b7aa759444c2 Mon Sep 17 00:00:00 2001 From: PrabbyDD <147005742+PrabbyDD@users.noreply.github.com> Date: Sun, 29 Sep 2024 19:00:29 -0700 Subject: [PATCH] [P2] Fix for Pokemon Forms have Access to Other Forms' TM Movepools (#4398) * fixing form issues generating tms pokemon shouldnt have * cleaning up some code * fixing tests and allowing rotom unique moves to be learned as tms for that rotom form * Update src/test/field/pokemon.test.ts Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * making tests simpler --------- Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> --- src/field/pokemon.ts | 3 ++- src/test/field/pokemon.test.ts | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index d47cbedbade..58396c59fa6 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -3981,7 +3981,8 @@ export class PlayerPokemon extends Pokemon { let compatible = false; for (const p of tmSpecies[tm]) { if (Array.isArray(p)) { - if (p[0] === this.species.speciesId || (this.fusionSpecies && p[0] === this.fusionSpecies.speciesId) && p.slice(1).indexOf(this.species.forms[this.formIndex]) > -1) { + const [pkm, form] = p; + if ((pkm === this.species.speciesId || this.fusionSpecies && pkm === this.fusionSpecies.speciesId) && form === this.getFormKey()) { compatible = true; break; } diff --git a/src/test/field/pokemon.test.ts b/src/test/field/pokemon.test.ts index f7c1cf8bc3d..225f302ff0c 100644 --- a/src/test/field/pokemon.test.ts +++ b/src/test/field/pokemon.test.ts @@ -3,6 +3,7 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import GameManager from "../utils/gameManager"; import { PokeballType } from "#app/enums/pokeball"; import BattleScene from "#app/battle-scene"; +import { Moves } from "#app/enums/moves"; describe("Spec - Pokemon", () => { let phaserGame: Phaser.Game; @@ -63,4 +64,15 @@ describe("Spec - Pokemon", () => { }); }); }); + + it("should not share tms between different forms", async () => { + game.override.starterForms({ [Species.ROTOM]: 4 }); + + await game.classicMode.startBattle([Species.ROTOM]); + + const fanRotom = game.scene.getPlayerPokemon()!; + + expect(fanRotom.compatibleTms).not.toContain(Moves.BLIZZARD); + expect(fanRotom.compatibleTms).toContain(Moves.AIR_SLASH); + }); });