Minor revisions

This commit is contained in:
Michael Li 2024-09-01 10:57:12 -04:00
parent 7f587868e7
commit 427de53ae6
3 changed files with 16 additions and 13 deletions

View File

@ -1,11 +1,10 @@
import { Species } from "#app/enums/species.js";
import { GameModes, getGameMode } from "#app/game-mode.js";
import { Species } from "#app/enums/species";
import { GameModes } from "#app/game-mode";
import GameManager from "#test/utils/gameManager";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { SPLASH_ONLY } from "./utils/testUtils";
import { Moves } from "#app/enums/moves.js";
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase.js";
import { DamagePhase } from "#app/phases/damage-phase.js";
import { Moves } from "#app/enums/moves";
import { Biome } from "#app/enums/biome";
describe("Reload", () => {
let phaserGame: Phaser.Game;
@ -39,21 +38,22 @@ describe("Reload", () => {
it("should not have RNG inconsistencies after a biome switch", async () => {
game.override
.startingWave(15)
.startingWave(10)
.startingBiome(Biome.CAVE) // Will lead to biomes with randomly generated weather
.battleType("single")
.startingLevel(100)
.enemyLevel(1000)
.disableTrainerWaves()
.moveset([Moves.KOWTOW_CLEAVE])
.enemyMoveset(SPLASH_ONLY);
await game.classicMode.startBattle();
game.scene.gameMode = getGameMode(GameModes.ENDLESS);
await game.dailyMode.startBattle();
// Transition from Wave 15 to Wave 16 in order to trigger biome switch
// Transition from Daily Run Wave 10 to Wave 11 in order to trigger biome switch
game.move.select(Moves.KOWTOW_CLEAVE);
await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(DamagePhase);
await game.phaseInterceptor.to("DamagePhase");
await game.doKillOpponents();
await game.toNextWave();
expect(game.phaseInterceptor.log).toContain("NewBiomeEncounterPhase");
const preReloadRngState = Phaser.Math.RND.state();

View File

@ -45,6 +45,7 @@ import { MoveHelper } from "./helpers/moveHelper";
import { OverridesHelper } from "./helpers/overridesHelper";
import { SettingsHelper } from "./helpers/settingsHelper";
import { ReloadHelper } from "./helpers/reloadHelper";
import { CheckSwitchPhase } from "#app/phases/check-switch-phase";
/**
* Class to manage the game state and transitions between phases.
@ -235,12 +236,12 @@ export default class GameManager {
this.onNextPrompt("SelectModifierPhase", Mode.MODIFIER_SELECT, () => {
const handler = this.scene.ui.getHandler() as ModifierSelectUiHandler;
handler.processInput(Button.CANCEL);
}, () => this.isCurrentPhase(CommandPhase) || this.isCurrentPhase(NewBattlePhase), true);
}, () => this.isCurrentPhase(CommandPhase) || this.isCurrentPhase(NewBattlePhase) || this.isCurrentPhase(CheckSwitchPhase), true);
this.onNextPrompt("SelectModifierPhase", Mode.CONFIRM, () => {
const handler = this.scene.ui.getHandler() as ModifierSelectUiHandler;
handler.processInput(Button.ACTION);
}, () => this.isCurrentPhase(CommandPhase) || this.isCurrentPhase(NewBattlePhase));
}, () => this.isCurrentPhase(CommandPhase) || this.isCurrentPhase(NewBattlePhase) || this.isCurrentPhase(CheckSwitchPhase));
}
forceOpponentToSwitch() {

View File

@ -10,13 +10,14 @@ import { EndEvolutionPhase } from "#app/phases/end-evolution-phase";
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase";
import { EvolutionPhase } from "#app/phases/evolution-phase";
import { FaintPhase } from "#app/phases/faint-phase";
import { LevelCapPhase } from "#app/phases/level-cap-phase";
import { LoginPhase } from "#app/phases/login-phase";
import { MessagePhase } from "#app/phases/message-phase";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { MoveEndPhase } from "#app/phases/move-end-phase";
import { MovePhase } from "#app/phases/move-phase";
import { NewBattlePhase } from "#app/phases/new-battle-phase";
import { NewBiomeEncounterPhase } from "#app/phases/new-biome-encounter-phase.js";
import { NewBiomeEncounterPhase } from "#app/phases/new-biome-encounter-phase";
import { NextEncounterPhase } from "#app/phases/next-encounter-phase";
import { PartyHealPhase } from "#app/phases/party-heal-phase";
import { PostSummonPhase } from "#app/phases/post-summon-phase";
@ -98,6 +99,7 @@ export default class PhaseInterceptor {
[PartyHealPhase, this.startPhase],
[EvolutionPhase, this.startPhase],
[EndEvolutionPhase, this.startPhase],
[LevelCapPhase, this.startPhase],
];
private endBySetMode = [