Feature: Displaying all starters based on environment parameters.

This commit is contained in:
Raphaël Pinto 2024-05-06 18:32:51 +02:00
parent bf1233d7ad
commit daaf2ef532
5 changed files with 41 additions and 25 deletions

View File

@ -2,4 +2,7 @@
VITE_ENVIRONMENT="local" VITE_ENVIRONMENT="local"
VITE_API_BASE_URL="http://localhost:8001" VITE_API_BASE_URL="http://localhost:8001"
VITE_BYPASS_LOGIN=true VITE_BYPASS_LOGIN=true
VITE_BYPASS_TUTORIAL=false VITE_BYPASS_TUTORIAL=false
# Debug
VITE_ACTIVATE_ALL_POKEMON_STARTERS=false

View File

@ -1093,4 +1093,14 @@ export const defaultStarterSpecies: Species[] = [
Species.ROWLET, Species.LITTEN, Species.POPPLIO, Species.ROWLET, Species.LITTEN, Species.POPPLIO,
Species.GROOKEY, Species.SCORBUNNY, Species.SOBBLE, Species.GROOKEY, Species.SCORBUNNY, Species.SOBBLE,
Species.SPRIGATITO, Species.FUECOCO, Species.QUAXLY Species.SPRIGATITO, Species.FUECOCO, Species.QUAXLY
]; ];
if(Boolean(import.meta.env.VITE_ACTIVATE_ALL_POKEMON_STARTERS)){
console.log('je suis passé')
defaultStarterSpecies.length = 0;
for (const value in Species) {
if (isNaN(Number(value))) {
defaultStarterSpecies.push(Species[value as keyof typeof Species]);
}
}
}

View File

@ -166,7 +166,7 @@ export interface StarterMoveData {
} }
export interface StarterDataEntry { export interface StarterDataEntry {
moveset: StarterMoveset | StarterFormMoveData; moveset: StarterMoveset | StarterFormMoveData;
eggMoves: integer; eggMoves: integer;
candyCount: integer; candyCount: integer;
friendship: integer; friendship: integer;
@ -204,7 +204,7 @@ export class GameData {
public secretId: integer; public secretId: integer;
public gender: PlayerGender; public gender: PlayerGender;
public dexData: DexData; public dexData: DexData;
private defaultDexData: DexData; private defaultDexData: DexData;
@ -315,7 +315,7 @@ export class GameData {
console.debug(systemData); console.debug(systemData);
/*const versions = [ this.scene.game.config.gameVersion, data.gameVersion || '0.0.0' ]; /*const versions = [ this.scene.game.config.gameVersion, data.gameVersion || '0.0.0' ];
if (versions[0] !== versions[1]) { if (versions[0] !== versions[1]) {
const [ versionNumbers, oldVersionNumbers ] = versions.map(ver => ver.split('.').map(v => parseInt(v))); const [ versionNumbers, oldVersionNumbers ] = versions.map(ver => ver.split('.').map(v => parseInt(v)));
}*/ }*/
@ -372,7 +372,7 @@ export class GameData {
for (let a of Object.keys(systemData.achvUnlocks)) { for (let a of Object.keys(systemData.achvUnlocks)) {
if (achvs.hasOwnProperty(a)) if (achvs.hasOwnProperty(a))
this.achvUnlocks[a] = systemData.achvUnlocks[a]; this.achvUnlocks[a] = systemData.achvUnlocks[a];
} }
} }
if (systemData.voucherUnlocks) { if (systemData.voucherUnlocks) {
@ -856,7 +856,7 @@ export class GameData {
let saveFile: any = document.getElementById('saveFile'); let saveFile: any = document.getElementById('saveFile');
if (saveFile) if (saveFile)
saveFile.remove(); saveFile.remove();
saveFile = document.createElement('input'); saveFile = document.createElement('input');
saveFile.id = 'saveFile'; saveFile.id = 'saveFile';
saveFile.type = 'file'; saveFile.type = 'file';
@ -1034,7 +1034,7 @@ export class GameData {
: AbilityAttr.ABILITY_HIDDEN; : AbilityAttr.ABILITY_HIDDEN;
} }
dexEntry.natureAttr |= Math.pow(2, pokemon.nature + 1); dexEntry.natureAttr |= Math.pow(2, pokemon.nature + 1);
const hasPrevolution = pokemonPrevolutions.hasOwnProperty(species.speciesId); const hasPrevolution = pokemonPrevolutions.hasOwnProperty(species.speciesId);
const newCatch = !caughtAttr; const newCatch = !caughtAttr;
const hasNewAttr = (caughtAttr & dexAttr) !== dexAttr; const hasNewAttr = (caughtAttr & dexAttr) !== dexAttr;
@ -1063,7 +1063,7 @@ export class GameData {
if (!hasPrevolution && (!pokemon.scene.gameMode.isDaily || hasNewAttr || fromEgg)) if (!hasPrevolution && (!pokemon.scene.gameMode.isDaily || hasNewAttr || fromEgg))
this.addStarterCandy(species, (1 * (pokemon.isShiny() ? 5 * Math.pow(2, pokemon.variant || 0) : 1)) * (fromEgg || pokemon.isBoss() ? 2 : 1)); this.addStarterCandy(species, (1 * (pokemon.isShiny() ? 5 * Math.pow(2, pokemon.variant || 0) : 1)) * (fromEgg || pokemon.isBoss() ? 2 : 1));
} }
const checkPrevolution = () => { const checkPrevolution = () => {
if (hasPrevolution) { if (hasPrevolution) {
const prevolutionSpecies = pokemonPrevolutions[species.speciesId]; const prevolutionSpecies = pokemonPrevolutions[species.speciesId];
@ -1235,7 +1235,7 @@ export class GameData {
getFormAttr(formIndex: integer): bigint { getFormAttr(formIndex: integer): bigint {
return BigInt(Math.pow(2, 7 + formIndex)); return BigInt(Math.pow(2, 7 + formIndex));
} }
consolidateDexData(dexData: DexData): void { consolidateDexData(dexData: DexData): void {
for (let k of Object.keys(dexData)) { for (let k of Object.keys(dexData)) {
const entry = dexData[k] as DexEntry; const entry = dexData[k] as DexEntry;
@ -1308,7 +1308,9 @@ export class GameData {
} }
fixStarterData(systemData: SystemSaveData): void { fixStarterData(systemData: SystemSaveData): void {
for (let starterId of defaultStarterSpecies) if(!Boolean(import.meta.env.VITE_ACTIVATE_ALL_POKEMON_STARTERS)){
systemData.starterData[starterId].abilityAttr |= AbilityAttr.ABILITY_1; for (let starterId of defaultStarterSpecies)
} systemData.starterData[starterId].abilityAttr |= AbilityAttr.ABILITY_1;
}
}
} }

13
src/vite-env.d.ts vendored Normal file
View File

@ -0,0 +1,13 @@
/// <reference types="vite/client" />
interface ImportMetaEnv {
readonly VITE_ENVIRONMENT: string
readonly VITE_API_BASE_URL: string
readonly VITE_BYPASS_LOGIN: boolean
readonly VITE_BYPASS_TUTORIAL: boolean
readonly VITE_ACTIVATE_ALL_POKEMON_STARTERS: boolean
}
interface ImportMeta {
readonly env: ImportMetaEnv
}

12
vite.env.d.ts vendored
View File

@ -1,12 +0,0 @@
/// <reference types="vite/client" />
interface ImportMetaEnv {
readonly VITE_ENVIRONMENT: string;
readonly VITE_API_BASE_URL: string;
readonly VITE_BYPASS_LOGIN: boolean;
readonly VITE_BYPASS_TUTORIAL: boolean;
}
interface ImportMeta {
readonly env: ImportMetaEnv;
}