mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-06 00:12:16 +02:00
Some updates
This commit is contained in:
parent
6bb9db535d
commit
37de57e73c
@ -16,7 +16,6 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||||||
|
|
||||||
constructor(scene: BattleScene, partyMemberIndex: integer, moveId: Moves) {
|
constructor(scene: BattleScene, partyMemberIndex: integer, moveId: Moves) {
|
||||||
super(scene, partyMemberIndex);
|
super(scene, partyMemberIndex);
|
||||||
|
|
||||||
this.moveId = moveId;
|
this.moveId = moveId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
49
src/test/phases/learn-move-phase.test.ts
Normal file
49
src/test/phases/learn-move-phase.test.ts
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
|
import Phaser from "phaser";
|
||||||
|
import GameManager from "#test/utils/gameManager";
|
||||||
|
import { Species } from "#enums/species";
|
||||||
|
import * as Utils from "#app/utils";
|
||||||
|
import { Moves } from "#enums/moves";
|
||||||
|
import BattleScene from "#app/battle-scene";
|
||||||
|
import { LearnMovePhase } from "#app/phases/learn-move-phase";
|
||||||
|
import Overrides from "#app/overrides";
|
||||||
|
//import { allMoves } from "#app/data/move";
|
||||||
|
|
||||||
|
describe("Learn Move Phase", () => {
|
||||||
|
let phaserGame: Phaser.Game;
|
||||||
|
let game: GameManager;
|
||||||
|
let scene: BattleScene;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
phaserGame = new Phaser.Game({
|
||||||
|
type: Phaser.HEADLESS,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
game.phaseInterceptor.restoreOg();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
game = new GameManager(phaserGame);
|
||||||
|
scene = game.scene;
|
||||||
|
Overrides.XP_MULTIPLIER_OVERRIDE = 50;
|
||||||
|
game.override.startingLevel(5);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("If Pokemon has less than 4 moves, its newest move will be added to the lowest empty index", async () => {
|
||||||
|
game.override.moveset([Moves.SPLASH]);
|
||||||
|
await game.startBattle([Species.BULBASAUR]);
|
||||||
|
const pokemon = game.scene.getPlayerPokemon()!;
|
||||||
|
const newMovePos = pokemon?.getMoveset().length;
|
||||||
|
game.move.select(Moves.SPLASH);
|
||||||
|
await game.doKillOpponents();
|
||||||
|
await game.phaseInterceptor.to(LearnMovePhase);
|
||||||
|
const newMove = pokemon.getMoveset()[newMovePos];
|
||||||
|
const levelMove = pokemon.getLevelMoves(5)[0];
|
||||||
|
const levelReq = levelMove[0];
|
||||||
|
const levelMoveId = levelMove[1];
|
||||||
|
expect(pokemon.level).toBeGreaterThanOrEqual(levelReq);
|
||||||
|
expect(newMove?.moveId).toBe(levelMoveId);
|
||||||
|
});
|
||||||
|
});
|
@ -1,52 +0,0 @@
|
|||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
|
||||||
import Phaser from "phaser";
|
|
||||||
import GameManager from "#test/utils/gameManager";
|
|
||||||
import { Species } from "#enums/species";
|
|
||||||
import * as Utils from "#app/utils";
|
|
||||||
import { Moves } from "#enums/moves";
|
|
||||||
import { allMoves } from "#app/data/move";
|
|
||||||
import { SPLASH_ONLY } from "#test/utils/testUtils";
|
|
||||||
import { LearnMovePhase } from "#app/phases/learn-move-phase";
|
|
||||||
import { TurnEndPhase } from "#app/phases/turn-end-phase";
|
|
||||||
|
|
||||||
describe("Learn Move Phase", () => {
|
|
||||||
let phaserGame: Phaser.Game;
|
|
||||||
let game: GameManager;
|
|
||||||
let scene: BattleScene;
|
|
||||||
|
|
||||||
beforeAll(() => {
|
|
||||||
phaserGame = new Phaser.Game({
|
|
||||||
type: Phaser.HEADLESS,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
game.phaseInterceptor.restoreOg();
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
game = new GameManager(phaserGame);
|
|
||||||
scene = game.scene;
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("If Pokemon has less than 4 moves, its newest move will be added to the lowest empty index", () => {
|
|
||||||
it("new move should be found at index 1", async () => {
|
|
||||||
game.override.moveset([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]);
|
|
||||||
await game.startBattle([Species.BULBASAUR]);
|
|
||||||
const pokemon = game.scene.getPlayerPokemon()!;
|
|
||||||
const prevLength = pokemon?.getMoveset().length;
|
|
||||||
game.move.select(Moves.SPLASH);
|
|
||||||
await game.doKillOpponents();
|
|
||||||
await game.phaseInterceptor.to(ExpPhase, false);
|
|
||||||
const expPhase = game.scene.getCurrentPhase() as ExpPhase;
|
|
||||||
expPhase.expValue = 1500;
|
|
||||||
console.log(pokemon?.level);
|
|
||||||
await game.phaseInterceptor.to(LearnMovePhase, false);
|
|
||||||
const phase = game.scene.getCurrentPhase() as MoveLearnPhase;
|
|
||||||
const newMove = phase.moveId;
|
|
||||||
const messageMode = phase.messageMode;
|
|
||||||
|
|
||||||
console.log(allMoves[newMove]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
@ -8,6 +8,7 @@ import { EggLapsePhase } from "#app/phases/egg-lapse-phase";
|
|||||||
import { EncounterPhase } from "#app/phases/encounter-phase";
|
import { EncounterPhase } from "#app/phases/encounter-phase";
|
||||||
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase";
|
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase";
|
||||||
import { FaintPhase } from "#app/phases/faint-phase";
|
import { FaintPhase } from "#app/phases/faint-phase";
|
||||||
|
import { LearnMovePhase } from "#app/phases/learn-move-phase";
|
||||||
import { LoginPhase } from "#app/phases/login-phase";
|
import { LoginPhase } from "#app/phases/login-phase";
|
||||||
import { MessagePhase } from "#app/phases/message-phase";
|
import { MessagePhase } from "#app/phases/message-phase";
|
||||||
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
|
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
|
||||||
@ -83,6 +84,7 @@ export default class PhaseInterceptor {
|
|||||||
[NextEncounterPhase, this.startPhase],
|
[NextEncounterPhase, this.startPhase],
|
||||||
[NewBattlePhase, this.startPhase],
|
[NewBattlePhase, this.startPhase],
|
||||||
[VictoryPhase, this.startPhase],
|
[VictoryPhase, this.startPhase],
|
||||||
|
[LearnMovePhase, this.startPhase],
|
||||||
[MoveEndPhase, this.startPhase],
|
[MoveEndPhase, this.startPhase],
|
||||||
[StatChangePhase, this.startPhase],
|
[StatChangePhase, this.startPhase],
|
||||||
[ShinySparklePhase, this.startPhase],
|
[ShinySparklePhase, this.startPhase],
|
||||||
|
Loading…
Reference in New Issue
Block a user