diff --git a/src/account.ts b/src/account.ts index a59879f0cc5..3416fa6ed5e 100644 --- a/src/account.ts +++ b/src/account.ts @@ -1,6 +1,6 @@ import { pokerogueApi } from "#app/plugins/api/pokerogue-api"; import type { UserInfo } from "#app/@types/UserInfo"; -import { bypassLogin } from "#app/battle-scene"; +import { bypassLogin } from "./global-vars/bypass-login"; import { randomString } from "#app/utils/common"; export let loggedInUser: UserInfo | null = null; diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 2d8bf83161f..ecaffc5ed07 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -185,8 +185,8 @@ import { HideAbilityPhase } from "#app/phases/hide-ability-phase"; import { expSpriteKeys } from "./sprites/sprite-keys"; import { hasExpSprite } from "./sprites/sprite-utils"; import { timedEventManager } from "./global-event-manager"; - -export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1"; +import { starterColors } from "./global-vars/starter-colors"; +import { startingWave } from "./starting-wave"; const DEBUG_RNG = false; @@ -194,13 +194,6 @@ const OPP_IVS_OVERRIDE_VALIDATED: number[] = ( Array.isArray(Overrides.OPP_IVS_OVERRIDE) ? Overrides.OPP_IVS_OVERRIDE : new Array(6).fill(Overrides.OPP_IVS_OVERRIDE) ).map(iv => (Number.isNaN(iv) || iv === null || iv > 31 ? -1 : iv)); -export const startingWave = Overrides.STARTING_WAVE_OVERRIDE || 1; - -export let starterColors: StarterColors; -interface StarterColors { - [key: string]: [string, string]; -} - export interface PokeballCounts { [pb: string]: number; } @@ -810,11 +803,11 @@ export default class BattleScene extends SceneBase { } async initStarterColors(): Promise { - if (starterColors) { + if (Object.keys(starterColors).length > 0) { + // already initialized return; } const sc = await this.cachedFetch("./starter-colors.json").then(res => res.json()); - starterColors = {}; for (const key of Object.keys(sc)) { starterColors[key] = sc[key]; } diff --git a/src/data/trainers/TrainerPartyTemplate.ts b/src/data/trainers/TrainerPartyTemplate.ts index adbaacc6b55..5d02ffdc6af 100644 --- a/src/data/trainers/TrainerPartyTemplate.ts +++ b/src/data/trainers/TrainerPartyTemplate.ts @@ -1,4 +1,4 @@ -import { startingWave } from "#app/battle-scene"; +import { startingWave } from "#app/starting-wave"; import { globalScene } from "#app/global-scene"; import { PartyMemberStrength } from "#enums/party-member-strength"; diff --git a/src/global-vars/bypass-login.ts b/src/global-vars/bypass-login.ts new file mode 100644 index 00000000000..3595a076101 --- /dev/null +++ b/src/global-vars/bypass-login.ts @@ -0,0 +1 @@ +export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1"; diff --git a/src/global-vars/starter-colors.ts b/src/global-vars/starter-colors.ts new file mode 100644 index 00000000000..6abe028be99 --- /dev/null +++ b/src/global-vars/starter-colors.ts @@ -0,0 +1,4 @@ +export const starterColors: StarterColors = {}; +interface StarterColors { + [key: string]: [string, string]; +} diff --git a/src/phases/login-phase.ts b/src/phases/login-phase.ts index 1c6a9733718..673b94b1148 100644 --- a/src/phases/login-phase.ts +++ b/src/phases/login-phase.ts @@ -1,5 +1,5 @@ import { updateUserInfo } from "#app/account"; -import { bypassLogin } from "#app/battle-scene"; +import { bypassLogin } from "#app/global-vars/bypass-login"; import { globalScene } from "#app/global-scene"; import { Phase } from "#app/phase"; import { handleTutorial, Tutorial } from "#app/tutorial"; diff --git a/src/starter-colors.ts b/src/starter-colors.ts new file mode 100644 index 00000000000..6abe028be99 --- /dev/null +++ b/src/starter-colors.ts @@ -0,0 +1,4 @@ +export const starterColors: StarterColors = {}; +interface StarterColors { + [key: string]: [string, string]; +} diff --git a/src/starting-wave.ts b/src/starting-wave.ts new file mode 100644 index 00000000000..3d36dabe652 --- /dev/null +++ b/src/starting-wave.ts @@ -0,0 +1,3 @@ +import Overrides from "./overrides"; + +export const startingWave = Overrides.STARTING_WAVE_OVERRIDE || 1; diff --git a/src/system/game-data.ts b/src/system/game-data.ts index caf01ad4222..8b7987556ee 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -1,6 +1,6 @@ import i18next from "i18next"; import type { PokeballCounts } from "#app/battle-scene"; -import { bypassLogin } from "#app/battle-scene"; +import { bypassLogin } from "#app/global-vars/bypass-login"; import { globalScene } from "#app/global-scene"; import type { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon"; import type Pokemon from "#app/field/pokemon"; diff --git a/src/ui/candy-bar.ts b/src/ui/candy-bar.ts index 46cee4bee43..f7a01b83093 100644 --- a/src/ui/candy-bar.ts +++ b/src/ui/candy-bar.ts @@ -1,4 +1,4 @@ -import { starterColors } from "#app/battle-scene"; +import { starterColors } from "#app/global-vars/starter-colors"; import { globalScene } from "#app/global-scene"; import { TextStyle, addTextObject } from "./text"; import { argbFromRgba } from "@material/material-color-utilities"; diff --git a/src/ui/menu-ui-handler.ts b/src/ui/menu-ui-handler.ts index 55524b380ea..7f0cd4d6a78 100644 --- a/src/ui/menu-ui-handler.ts +++ b/src/ui/menu-ui-handler.ts @@ -1,4 +1,4 @@ -import { bypassLogin } from "#app/battle-scene"; +import { bypassLogin } from "#app/global-vars/bypass-login"; import { globalScene } from "#app/global-scene"; import { TextStyle, addTextObject, getTextStyleOptions } from "./text"; import { UiMode } from "#enums/ui-mode"; diff --git a/src/ui/pokedex-page-ui-handler.ts b/src/ui/pokedex-page-ui-handler.ts index e945295a7b2..d0b85544494 100644 --- a/src/ui/pokedex-page-ui-handler.ts +++ b/src/ui/pokedex-page-ui-handler.ts @@ -4,7 +4,7 @@ import type { Variant } from "#app/sprites/variant"; import { getVariantTint, getVariantIcon } from "#app/sprites/variant"; import { argbFromRgba } from "@material/material-color-utilities"; import i18next from "i18next"; -import { starterColors } from "#app/battle-scene"; +import { starterColors } from "#app/global-vars/starter-colors"; import { allAbilities } from "#app/data/data-lists"; import { speciesEggMoves } from "#app/data/balance/egg-moves"; import { GrowthRate, getGrowthRateColor } from "#app/data/exp"; diff --git a/src/ui/pokedex-ui-handler.ts b/src/ui/pokedex-ui-handler.ts index 13bc02413a4..e9726031bf5 100644 --- a/src/ui/pokedex-ui-handler.ts +++ b/src/ui/pokedex-ui-handler.ts @@ -2,7 +2,7 @@ import type { Variant } from "#app/sprites/variant"; import { getVariantTint, getVariantIcon } from "#app/sprites/variant"; import { argbFromRgba } from "@material/material-color-utilities"; import i18next from "i18next"; -import { starterColors } from "#app/battle-scene"; +import { starterColors } from "#app/global-vars/starter-colors"; import { speciesEggMoves } from "#app/data/balance/egg-moves"; import { pokemonFormLevelMoves, pokemonSpeciesLevelMoves } from "#app/data/balance/pokemon-level-moves"; import type { PokemonForm } from "#app/data/pokemon-species"; diff --git a/src/ui/pokemon-hatch-info-container.ts b/src/ui/pokemon-hatch-info-container.ts index b2e95c37337..f3095cb48bf 100644 --- a/src/ui/pokemon-hatch-info-container.ts +++ b/src/ui/pokemon-hatch-info-container.ts @@ -7,7 +7,7 @@ import { speciesEggMoves } from "#app/data/balance/egg-moves"; import { allMoves } from "#app/data/moves/move"; import { Species } from "#enums/species"; import { getEggTierForSpecies } from "#app/data/egg"; -import { starterColors } from "#app/battle-scene"; +import { starterColors } from "#app/global-vars/starter-colors"; import { globalScene } from "#app/global-scene"; import { argbFromRgba } from "@material/material-color-utilities"; import type { EggHatchData } from "#app/data/egg-hatch-data"; diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index 8434c3489fb..1902c691715 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -6,7 +6,7 @@ import { getVariantTint, getVariantIcon } from "#app/sprites/variant"; import { argbFromRgba } from "@material/material-color-utilities"; import i18next from "i18next"; import type BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext"; -import { starterColors } from "#app/battle-scene"; +import { starterColors } from "#app/global-vars/starter-colors"; import { globalScene } from "#app/global-scene"; import type { Ability } from "#app/data/abilities/ability-class"; import { allAbilities } from "#app/data/data-lists"; diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index 4110715d7d2..877c342651f 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -1,4 +1,4 @@ -import { starterColors } from "#app/battle-scene"; +import { starterColors } from "#app/global-vars/starter-colors"; import { globalScene } from "#app/global-scene"; import { UiMode } from "#enums/ui-mode"; import UiHandler from "#app/ui/ui-handler";