[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>
This commit is contained in:
PrabbyDD 2024-09-29 19:00:29 -07:00 committed by GitHub
parent 4c327e9e63
commit d99dbf4955
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View File

@ -3981,7 +3981,8 @@ export class PlayerPokemon extends Pokemon {
let compatible = false; let compatible = false;
for (const p of tmSpecies[tm]) { for (const p of tmSpecies[tm]) {
if (Array.isArray(p)) { 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; compatible = true;
break; break;
} }

View File

@ -3,6 +3,7 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import GameManager from "../utils/gameManager"; import GameManager from "../utils/gameManager";
import { PokeballType } from "#app/enums/pokeball"; import { PokeballType } from "#app/enums/pokeball";
import BattleScene from "#app/battle-scene"; import BattleScene from "#app/battle-scene";
import { Moves } from "#app/enums/moves";
describe("Spec - Pokemon", () => { describe("Spec - Pokemon", () => {
let phaserGame: Phaser.Game; 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);
});
}); });