[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:
parent
4c327e9e63
commit
d99dbf4955
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue