mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-04 15:32:18 +02:00
cleanup overrides and imports
This commit is contained in:
parent
7f0362e124
commit
17af5110ce
@ -59,7 +59,7 @@ import { SceneBase } from './scene-base';
|
||||
import CandyBar from './ui/candy-bar';
|
||||
import { Variant, variantData } from './data/variant';
|
||||
import { Localizable } from './plugins/i18n';
|
||||
import { STARTING_WAVE_OVERRIDE, OPP_SPECIES_OVERRIDE, SEED_OVERRIDE, STARTING_BIOME_OVERRIDE, DOUBLE_BATTLE_OVERRIDE } from './overrides';
|
||||
import * as Overrides from './overrides';
|
||||
import {InputsController} from "./inputs-controller";
|
||||
import {UiInputs} from "./ui-inputs";
|
||||
|
||||
@ -67,7 +67,7 @@ export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1";
|
||||
|
||||
const DEBUG_RNG = false;
|
||||
|
||||
export const startingWave = STARTING_WAVE_OVERRIDE || 1;
|
||||
export const startingWave = Overrides.STARTING_WAVE_OVERRIDE || 1;
|
||||
|
||||
const expSpriteKeys: string[] = [];
|
||||
|
||||
@ -612,8 +612,8 @@ export default class BattleScene extends SceneBase {
|
||||
}
|
||||
|
||||
addEnemyPokemon(species: PokemonSpecies, level: integer, trainerSlot: TrainerSlot, boss: boolean = false, dataSource?: PokemonData, postProcess?: (enemyPokemon: EnemyPokemon) => void): EnemyPokemon {
|
||||
if (OPP_SPECIES_OVERRIDE)
|
||||
species = getPokemonSpecies(OPP_SPECIES_OVERRIDE);
|
||||
if (Overrides.OPP_SPECIES_OVERRIDE)
|
||||
species = getPokemonSpecies(Overrides.OPP_SPECIES_OVERRIDE);
|
||||
const pokemon = new EnemyPokemon(this, species, level, trainerSlot, boss, dataSource);
|
||||
if (boss && !dataSource) {
|
||||
const secondaryIvs = Utils.getIvsFromId(Utils.randSeedInt(4294967295));
|
||||
@ -705,7 +705,7 @@ export default class BattleScene extends SceneBase {
|
||||
|
||||
this.gameMode = gameModes[GameModes.CLASSIC];
|
||||
|
||||
this.setSeed(SEED_OVERRIDE || Utils.randomString(24));
|
||||
this.setSeed(Overrides.SEED_OVERRIDE || Utils.randomString(24));
|
||||
console.log('Seed:', this.seed);
|
||||
|
||||
this.disableMenu = false;
|
||||
@ -742,7 +742,7 @@ export default class BattleScene extends SceneBase {
|
||||
|
||||
[ this.luckLabelText, this.luckText ].map(t => t.setVisible(false));
|
||||
|
||||
this.newArena(STARTING_BIOME_OVERRIDE || Biome.TOWN);
|
||||
this.newArena(Overrides.STARTING_BIOME_OVERRIDE || Biome.TOWN);
|
||||
|
||||
this.arenaBgTransition.setPosition(0, 0);
|
||||
this.arenaPlayer.setPosition(300, 0);
|
||||
@ -842,7 +842,7 @@ export default class BattleScene extends SceneBase {
|
||||
} else if (!battleConfig)
|
||||
newDouble = !!double;
|
||||
|
||||
if (DOUBLE_BATTLE_OVERRIDE)
|
||||
if (Overrides.DOUBLE_BATTLE_OVERRIDE)
|
||||
newDouble = true;
|
||||
|
||||
const lastBattle = this.currentBattle;
|
||||
|
@ -18,7 +18,7 @@ import { TimeOfDay } from "../data/enums/time-of-day";
|
||||
import { Terrain, TerrainType } from "../data/terrain";
|
||||
import { PostTerrainChangeAbAttr, PostWeatherChangeAbAttr, applyPostTerrainChangeAbAttrs, applyPostWeatherChangeAbAttrs } from "../data/ability";
|
||||
import Pokemon from "./pokemon";
|
||||
import { WEATHER_OVERRIDE } from '../overrides';
|
||||
import * as Overrides from '../overrides';
|
||||
|
||||
export class Arena {
|
||||
public scene: BattleScene;
|
||||
@ -282,8 +282,8 @@ export class Arena {
|
||||
|
||||
trySetWeather(weather: WeatherType, hasPokemonSource: boolean): boolean {
|
||||
// override hook for debugging
|
||||
if (WEATHER_OVERRIDE)
|
||||
return this.trySetWeatherOverride(WEATHER_OVERRIDE);
|
||||
if (Overrides.WEATHER_OVERRIDE)
|
||||
return this.trySetWeatherOverride(Overrides.WEATHER_OVERRIDE);
|
||||
|
||||
if (this.weather?.weatherType === (weather || undefined))
|
||||
return false;
|
||||
|
@ -43,7 +43,7 @@ import { Nature, getNatureStatMultiplier } from '../data/nature';
|
||||
import { SpeciesFormChange, SpeciesFormChangeActiveTrigger, SpeciesFormChangeMoveLearnedTrigger, SpeciesFormChangePostMoveTrigger, SpeciesFormChangeStatusEffectTrigger } from '../data/pokemon-forms';
|
||||
import { TerrainType } from '../data/terrain';
|
||||
import { TrainerSlot } from '../data/trainer-config';
|
||||
import { ABILITY_OVERRIDE, MOVE_OVERRIDE, MOVE_OVERRIDE_2, OPP_ABILITY_OVERRIDE, OPP_MOVE_OVERRIDE, OPP_MOVE_OVERRIDE_2, OPP_PASSIVE_ABILITY_OVERRIDE, OPP_SHINY_OVERRIDE, OPP_VARIANT_OVERRIDE, PASSIVE_ABILITY_OVERRIDE } from '../overrides';
|
||||
import * as Overrides from '../overrides';
|
||||
import { BerryType } from '../data/berry';
|
||||
import i18next from '../plugins/i18n';
|
||||
|
||||
@ -725,15 +725,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
? this.summonData.moveset
|
||||
: this.moveset;
|
||||
|
||||
if (MOVE_OVERRIDE && this.isPlayer())
|
||||
this.moveset[0] = new PokemonMove(MOVE_OVERRIDE, Math.min(this.moveset[0].ppUsed, allMoves[MOVE_OVERRIDE].pp));
|
||||
else if (OPP_MOVE_OVERRIDE && !this.isPlayer())
|
||||
this.moveset[0] = new PokemonMove(OPP_MOVE_OVERRIDE, Math.min(this.moveset[0].ppUsed, allMoves[OPP_MOVE_OVERRIDE].pp));
|
||||
if (MOVE_OVERRIDE_2 && this.isPlayer())
|
||||
this.moveset[1] = new PokemonMove(MOVE_OVERRIDE_2, Math.min(this.moveset[1].ppUsed, allMoves[MOVE_OVERRIDE_2].pp));
|
||||
else if (OPP_MOVE_OVERRIDE_2 && !this.isPlayer())
|
||||
this.moveset[1] = new PokemonMove(OPP_MOVE_OVERRIDE_2, Math.min(this.moveset[1].ppUsed, allMoves[OPP_MOVE_OVERRIDE_2].pp));
|
||||
|
||||
const overideArray: Array<Moves> = this.isPlayer() ? Overrides.MOVESET_OVERRIDE : Overrides.OPP_MOVESET_OVERRIDE;
|
||||
if (overideArray.length > 0) {
|
||||
overideArray.forEach((move: Moves, index: number) => {
|
||||
this.moveset[index] = new PokemonMove(move, Math.min(this.moveset[index].ppUsed, allMoves[move].pp))
|
||||
});
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -798,10 +795,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
getAbility(ignoreOverride?: boolean): Ability {
|
||||
if (!ignoreOverride && this.summonData?.ability)
|
||||
return allAbilities[this.summonData.ability];
|
||||
if (ABILITY_OVERRIDE && this.isPlayer())
|
||||
return allAbilities[ABILITY_OVERRIDE];
|
||||
if (OPP_ABILITY_OVERRIDE && !this.isPlayer())
|
||||
return allAbilities[OPP_ABILITY_OVERRIDE];
|
||||
if (Overrides.ABILITY_OVERRIDE && this.isPlayer())
|
||||
return allAbilities[Overrides.ABILITY_OVERRIDE];
|
||||
if (Overrides.OPP_ABILITY_OVERRIDE && !this.isPlayer())
|
||||
return allAbilities[Overrides.OPP_ABILITY_OVERRIDE];
|
||||
if (this.isFusion())
|
||||
return allAbilities[this.getFusionSpeciesForm(ignoreOverride).getAbility(this.fusionAbilityIndex)];
|
||||
let abilityId = this.getSpeciesForm(ignoreOverride).getAbility(this.abilityIndex);
|
||||
@ -811,10 +808,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
}
|
||||
|
||||
getPassiveAbility(): Ability {
|
||||
if (PASSIVE_ABILITY_OVERRIDE && this.isPlayer())
|
||||
return allAbilities[PASSIVE_ABILITY_OVERRIDE];
|
||||
if (OPP_PASSIVE_ABILITY_OVERRIDE && !this.isPlayer())
|
||||
return allAbilities[OPP_PASSIVE_ABILITY_OVERRIDE];
|
||||
if (Overrides.PASSIVE_ABILITY_OVERRIDE && this.isPlayer())
|
||||
return allAbilities[Overrides.PASSIVE_ABILITY_OVERRIDE];
|
||||
if (Overrides.OPP_PASSIVE_ABILITY_OVERRIDE && !this.isPlayer())
|
||||
return allAbilities[Overrides.OPP_PASSIVE_ABILITY_OVERRIDE];
|
||||
|
||||
let starterSpeciesId = this.species.speciesId;
|
||||
while (pokemonPrevolutions.hasOwnProperty(starterSpeciesId))
|
||||
@ -823,7 +820,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
}
|
||||
|
||||
hasPassive(): boolean {
|
||||
if ((PASSIVE_ABILITY_OVERRIDE !== Abilities.NONE && this.isPlayer()) || (OPP_PASSIVE_ABILITY_OVERRIDE !== Abilities.NONE && !this.isPlayer()))
|
||||
if ((Overrides.PASSIVE_ABILITY_OVERRIDE !== Abilities.NONE && this.isPlayer()) || (Overrides.OPP_PASSIVE_ABILITY_OVERRIDE !== Abilities.NONE && !this.isPlayer()))
|
||||
return true;
|
||||
return this.passive || this.isBoss();
|
||||
}
|
||||
@ -2692,14 +2689,14 @@ export class EnemyPokemon extends Pokemon {
|
||||
this.generateAndPopulateMoveset();
|
||||
|
||||
this.trySetShiny();
|
||||
if (OPP_SHINY_OVERRIDE) {
|
||||
if (Overrides.OPP_SHINY_OVERRIDE) {
|
||||
this.shiny = true;
|
||||
this.initShinySparkle();
|
||||
}
|
||||
if (this.shiny) {
|
||||
this.variant = this.generateVariant();
|
||||
if (OPP_VARIANT_OVERRIDE)
|
||||
this.variant = OPP_VARIANT_OVERRIDE;
|
||||
if (Overrides.OPP_VARIANT_OVERRIDE)
|
||||
this.variant = Overrides.OPP_VARIANT_OVERRIDE;
|
||||
}
|
||||
|
||||
this.luck = (this.shiny ? this.variant + 1 : 0) + (this.fusionShiny ? this.fusionVariant + 1 : 0);
|
||||
|
@ -5,7 +5,7 @@ import { Species } from "./data/enums/species";
|
||||
import PokemonSpecies, { allSpecies } from "./data/pokemon-species";
|
||||
import { Arena } from "./field/arena";
|
||||
import * as Utils from "./utils";
|
||||
import { STARTING_BIOME_OVERRIDE, STARTING_LEVEL_OVERRIDE, STARTING_MONEY_OVERRIDE } from './overrides';
|
||||
import * as Overrides from './overrides';
|
||||
|
||||
export enum GameModes {
|
||||
CLASSIC,
|
||||
@ -46,8 +46,8 @@ export class GameMode implements GameModeConfig {
|
||||
}
|
||||
|
||||
getStartingLevel(): integer {
|
||||
if (STARTING_LEVEL_OVERRIDE)
|
||||
return STARTING_LEVEL_OVERRIDE;
|
||||
if (Overrides.STARTING_LEVEL_OVERRIDE)
|
||||
return Overrides.STARTING_LEVEL_OVERRIDE;
|
||||
switch (this.modeId) {
|
||||
case GameModes.DAILY:
|
||||
return 20;
|
||||
@ -57,7 +57,7 @@ export class GameMode implements GameModeConfig {
|
||||
}
|
||||
|
||||
getStartingMoney(): integer {
|
||||
return STARTING_MONEY_OVERRIDE || 1000;
|
||||
return Overrides.STARTING_MONEY_OVERRIDE || 1000;
|
||||
}
|
||||
|
||||
getStartingBiome(scene: BattleScene): Biome {
|
||||
@ -65,7 +65,7 @@ export class GameMode implements GameModeConfig {
|
||||
case GameModes.DAILY:
|
||||
return scene.generateRandomBiome(this.getWaveForDifficulty(1));
|
||||
default:
|
||||
return STARTING_BIOME_OVERRIDE || Biome.TOWN;
|
||||
return Overrides.STARTING_BIOME_OVERRIDE || Biome.TOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,26 +3,32 @@ import { Abilities } from "./data/enums/abilities";
|
||||
import { Biome } from "./data/enums/biome";
|
||||
import { Moves } from "./data/enums/moves";
|
||||
import { WeatherType } from "./data/weather";
|
||||
import { Variant } from './data/variant';
|
||||
|
||||
export const SEED_OVERRIDE = '';
|
||||
export const STARTER_SPECIES_OVERRIDE = 0;
|
||||
export const STARTER_FORM_OVERRIDE = 0;
|
||||
export const STARTING_LEVEL_OVERRIDE = 0;
|
||||
export const STARTING_WAVE_OVERRIDE = 0;
|
||||
export const STARTING_BIOME_OVERRIDE = Biome.TOWN;
|
||||
export const STARTING_MONEY_OVERRIDE = 0;
|
||||
export const WEATHER_OVERRIDE = WeatherType.NONE;
|
||||
export const DOUBLE_BATTLE_OVERRIDE = false;
|
||||
/*
|
||||
* Overrides for testing different in game situations
|
||||
*/
|
||||
|
||||
export const ABILITY_OVERRIDE = Abilities.NONE;
|
||||
export const PASSIVE_ABILITY_OVERRIDE = Abilities.NONE;
|
||||
export const MOVE_OVERRIDE = Moves.NONE;
|
||||
export const MOVE_OVERRIDE_2 = Moves.NONE;
|
||||
export const OPP_SPECIES_OVERRIDE = 0;
|
||||
export const OPP_ABILITY_OVERRIDE = Abilities.NONE;
|
||||
// overall overrides
|
||||
export const SEED_OVERRIDE: string = '';
|
||||
export const WEATHER_OVERRIDE: WeatherType = WeatherType.NONE;
|
||||
export const DOUBLE_BATTLE_OVERRIDE: boolean = false;
|
||||
export const STARTING_WAVE_OVERRIDE: integer = 0;
|
||||
export const STARTING_BIOME_OVERRIDE: Biome = Biome.TOWN;
|
||||
export const STARTING_MONEY_OVERRIDE: integer = 0;
|
||||
|
||||
// player overrides
|
||||
export const STARTER_SPECIES_OVERRIDE: Species | 0 = 0;
|
||||
export const STARTER_FORM_OVERRIDE: integer = 0;
|
||||
export const STARTING_LEVEL_OVERRIDE: integer = 0;
|
||||
export const ABILITY_OVERRIDE: Abilities = Abilities.NONE;
|
||||
export const PASSIVE_ABILITY_OVERRIDE: Abilities = Abilities.NONE;
|
||||
export const MOVESET_OVERRIDE: Array<Moves> = [];
|
||||
|
||||
// opponent overrides
|
||||
export const OPP_SPECIES_OVERRIDE: Species | 0 = 0;
|
||||
export const OPP_ABILITY_OVERRIDE: Abilities = Abilities.NONE;
|
||||
export const OPP_PASSIVE_ABILITY_OVERRIDE = Abilities.NONE;
|
||||
export const OPP_MOVE_OVERRIDE = Moves.NONE;
|
||||
export const OPP_MOVE_OVERRIDE_2 = Moves.NONE;
|
||||
|
||||
export const OPP_SHINY_OVERRIDE = false;
|
||||
export const OPP_VARIANT_OVERRIDE = 0;
|
||||
export const OPP_MOVESET_OVERRIDE: Array<Moves> = [];
|
||||
export const OPP_SHINY_OVERRIDE: boolean = false;
|
||||
export const OPP_VARIANT_OVERRIDE: Variant = 0;
|
||||
|
@ -58,7 +58,7 @@ import { GameModes, gameModes } from "./game-mode";
|
||||
import PokemonSpecies, { getPokemonSpecies, getPokemonSpeciesForm, speciesStarters } from "./data/pokemon-species";
|
||||
import i18next from './plugins/i18n';
|
||||
import { Abilities } from "./data/enums/abilities";
|
||||
import { STARTER_FORM_OVERRIDE, STARTER_SPECIES_OVERRIDE } from './overrides';
|
||||
import * as Overrides from './overrides';
|
||||
|
||||
export class LoginPhase extends Phase {
|
||||
private showText: boolean;
|
||||
@ -487,12 +487,12 @@ export class SelectStarterPhase extends Phase {
|
||||
const party = this.scene.getParty();
|
||||
const loadPokemonAssets: Promise<void>[] = [];
|
||||
starters.forEach((starter: Starter, i: integer) => {
|
||||
if (!i && STARTER_SPECIES_OVERRIDE)
|
||||
starter.species = getPokemonSpecies(STARTER_SPECIES_OVERRIDE as Species);
|
||||
if (!i && Overrides.STARTER_SPECIES_OVERRIDE)
|
||||
starter.species = getPokemonSpecies(Overrides.STARTER_SPECIES_OVERRIDE as Species);
|
||||
const starterProps = this.scene.gameData.getSpeciesDexAttrProps(starter.species, starter.dexAttr);
|
||||
let starterFormIndex = Math.min(starterProps.formIndex, Math.max(starter.species.forms.length - 1, 0));
|
||||
if (!i && STARTER_SPECIES_OVERRIDE)
|
||||
starterFormIndex = STARTER_FORM_OVERRIDE;
|
||||
if (!i && Overrides.STARTER_SPECIES_OVERRIDE)
|
||||
starterFormIndex = Overrides.STARTER_FORM_OVERRIDE;
|
||||
const starterGender = starter.species.malePercent !== null
|
||||
? !starterProps.female ? Gender.MALE : Gender.FEMALE
|
||||
: Gender.GENDERLESS;
|
||||
|
Loading…
Reference in New Issue
Block a user