Some updates

This commit is contained in:
frutescens 2024-08-22 22:54:13 -07:00
parent 6bb9db535d
commit 37de57e73c
4 changed files with 51 additions and 53 deletions

View File

@ -16,7 +16,6 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
constructor(scene: BattleScene, partyMemberIndex: integer, moveId: Moves) {
super(scene, partyMemberIndex);
this.moveId = moveId;
}

View 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);
});
});

View File

@ -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]);
});
});
});

View File

@ -8,6 +8,7 @@ import { EggLapsePhase } from "#app/phases/egg-lapse-phase";
import { EncounterPhase } from "#app/phases/encounter-phase";
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase";
import { FaintPhase } from "#app/phases/faint-phase";
import { LearnMovePhase } from "#app/phases/learn-move-phase";
import { LoginPhase } from "#app/phases/login-phase";
import { MessagePhase } from "#app/phases/message-phase";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
@ -83,6 +84,7 @@ export default class PhaseInterceptor {
[NextEncounterPhase, this.startPhase],
[NewBattlePhase, this.startPhase],
[VictoryPhase, this.startPhase],
[LearnMovePhase, this.startPhase],
[MoveEndPhase, this.startPhase],
[StatChangePhase, this.startPhase],
[ShinySparklePhase, this.startPhase],