mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-26 01:09:29 +02:00
fixing tests and allowing rotom unique moves to be learned as tms for that rotom form
This commit is contained in:
parent
0b4acc23b8
commit
6691e0234f
@ -3972,8 +3972,8 @@ export class PlayerPokemon extends Pokemon {
|
||||
let compatible = false;
|
||||
for (const p of tmSpecies[tm]) {
|
||||
if (Array.isArray(p)) {
|
||||
const [pkm, ...forms] = p;
|
||||
if ((pkm === this.species.speciesId || this.fusionSpecies && pkm === this.fusionSpecies.speciesId) && forms.some(form => form === this.species.forms[this.formIndex])) {
|
||||
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 { tmSpecies } from "#app/data/tms";
|
||||
|
||||
describe("Spec - Pokemon", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
@ -63,4 +64,32 @@ describe("Spec - Pokemon", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
it("pokemon that have form changes and different tms per form should not share tms between forms", async () => {
|
||||
game.override.starterForms({ [Species.ROTOM]: 4 });
|
||||
await game.classicMode.startBattle([Species.ROTOM]);
|
||||
const playerPokemon = game.scene.getPlayerPokemon()!;
|
||||
|
||||
// 59 is blizzard, fan rotom should not be in that array
|
||||
const compatible1 = tmSpecies[59].some(p => {
|
||||
if (Array.isArray(p)) {
|
||||
const [pkm, form] = p;
|
||||
return pkm === playerPokemon.species.speciesId && playerPokemon.getFormKey() === form;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// Air slash is 403, fan rotom should be in it
|
||||
const compatible2 = tmSpecies[403].some(p => {
|
||||
if (Array.isArray(p)) {
|
||||
const [pkm, form] = p;
|
||||
return pkm === playerPokemon.species.speciesId && playerPokemon.getFormKey() === form;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
expect(playerPokemon.compatibleTms.includes(59)).toBeFalsy();
|
||||
expect(playerPokemon.compatibleTms.includes(403)).toBeTruthy();
|
||||
expect(compatible1).toBeFalsy();
|
||||
expect(compatible2).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user