mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-10 18:32:16 +02:00
Remove starterColors and bypassLogin from battle-scene
Reduces cyclical dependencies from 765 to 623
This commit is contained in:
parent
ae57a3ec15
commit
1df7a1dd72
@ -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;
|
||||
|
@ -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<void> {
|
||||
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];
|
||||
}
|
||||
|
@ -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";
|
||||
|
||||
|
1
src/global-vars/bypass-login.ts
Normal file
1
src/global-vars/bypass-login.ts
Normal file
@ -0,0 +1 @@
|
||||
export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1";
|
4
src/global-vars/starter-colors.ts
Normal file
4
src/global-vars/starter-colors.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export const starterColors: StarterColors = {};
|
||||
interface StarterColors {
|
||||
[key: string]: [string, string];
|
||||
}
|
@ -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";
|
||||
|
4
src/starter-colors.ts
Normal file
4
src/starter-colors.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export const starterColors: StarterColors = {};
|
||||
interface StarterColors {
|
||||
[key: string]: [string, string];
|
||||
}
|
3
src/starting-wave.ts
Normal file
3
src/starting-wave.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import Overrides from "./overrides";
|
||||
|
||||
export const startingWave = Overrides.STARTING_WAVE_OVERRIDE || 1;
|
@ -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";
|
||||
|
@ -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";
|
||||
|
@ -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";
|
||||
|
@ -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";
|
||||
|
@ -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";
|
||||
|
@ -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";
|
||||
|
@ -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";
|
||||
|
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user