add: ExpGainsSpeed enum

This commit is contained in:
flx-sta 2024-09-13 16:21:48 -07:00
parent c346653127
commit 836e4d54dc
4 changed files with 28 additions and 3 deletions

View File

@ -86,6 +86,7 @@ import { TitlePhase } from "./phases/title-phase";
import { ToggleDoublePositionPhase } from "./phases/toggle-double-position-phase"; import { ToggleDoublePositionPhase } from "./phases/toggle-double-position-phase";
import { TurnInitPhase } from "./phases/turn-init-phase"; import { TurnInitPhase } from "./phases/turn-init-phase";
import { ShopCursorTarget } from "./enums/shop-cursor-target"; import { ShopCursorTarget } from "./enums/shop-cursor-target";
import { ExpGainsSpeed } from "./enums/exp-gains-speed";
export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1"; export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1";
@ -161,7 +162,7 @@ export default class BattleScene extends SceneBase {
public experimentalSprites: boolean = false; public experimentalSprites: boolean = false;
public musicPreference: integer = 0; public musicPreference: integer = 0;
public moveAnimations: boolean = true; public moveAnimations: boolean = true;
public expGainsSpeed: integer = 0; public expGainsSpeed: ExpGainsSpeed = ExpGainsSpeed.DEFAULT;
public skipSeenDialogues: boolean = false; public skipSeenDialogues: boolean = false;
/** /**
* Determines if the egg hatching animation should be skipped * Determines if the egg hatching animation should be skipped

View File

@ -0,0 +1,22 @@
/**
* Defines the speed of gaining experience.
*
* @remarks
* The `expGainSpeed` can have several modes:
* - `0` - Default: The normal speed.
* - `1` - Fast: Fast speed.
* - `2` - Faster: Faster speed.
* - `3` - Skip: Skip gaining exp animation.
*
* @default 0 - Uses the default normal speed.
*/
export enum ExpGainsSpeed {
/** The normal speed. */
DEFAULT,
/** Fast speed. */
FAST,
/** Faster speed. */
FASTER,
/** Skip gaining exp animation. */
SKIP
}

View File

@ -1,4 +1,5 @@
import BattleScene from "#app/battle-scene"; import BattleScene from "#app/battle-scene";
import { ExpGainsSpeed } from "#app/enums/exp-gains-speed";
import { ExpNotification } from "#app/enums/exp-notification"; import { ExpNotification } from "#app/enums/exp-notification";
import { ExpBoosterModifier } from "#app/modifier/modifier"; import { ExpBoosterModifier } from "#app/modifier/modifier";
import * as Utils from "#app/utils"; import * as Utils from "#app/utils";
@ -44,7 +45,7 @@ export class ShowPartyExpBarPhase extends PlayerPartyMemberPokemonPhase {
} else { } else {
this.end(); this.end();
} }
} else if (this.scene.expGainsSpeed < 3) { } else if (this.scene.expGainsSpeed < ExpGainsSpeed.SKIP) {
this.scene.partyExpBar.showPokemonExp(pokemon, exp.value, false, newLevel).then(() => { this.scene.partyExpBar.showPokemonExp(pokemon, exp.value, false, newLevel).then(() => {
setTimeout(() => this.end(), 500 / Math.pow(2, this.scene.expGainsSpeed)); setTimeout(() => this.end(), 500 / Math.pow(2, this.scene.expGainsSpeed));
}); });

View File

@ -49,6 +49,7 @@ import { OverridesHelper } from "./helpers/overridesHelper";
import { SettingsHelper } from "./helpers/settingsHelper"; import { SettingsHelper } from "./helpers/settingsHelper";
import { ReloadHelper } from "./helpers/reloadHelper"; import { ReloadHelper } from "./helpers/reloadHelper";
import { CheckSwitchPhase } from "#app/phases/check-switch-phase"; import { CheckSwitchPhase } from "#app/phases/check-switch-phase";
import { ExpGainsSpeed } from "#app/enums/exp-gains-speed";
/** /**
* Class to manage the game state and transitions between phases. * Class to manage the game state and transitions between phases.
@ -140,7 +141,7 @@ export default class GameManager {
this.scene.gameSpeed = 5; this.scene.gameSpeed = 5;
this.scene.moveAnimations = false; this.scene.moveAnimations = false;
this.scene.showLevelUpStats = false; this.scene.showLevelUpStats = false;
this.scene.expGainsSpeed = 3; this.scene.expGainsSpeed = ExpGainsSpeed.SKIP;
this.scene.expParty = ExpNotification.SKIP; this.scene.expParty = ExpNotification.SKIP;
this.scene.hpBarSpeed = 3; this.scene.hpBarSpeed = 3;
this.scene.enableTutorials = false; this.scene.enableTutorials = false;