Add a long-term goal

pull/45/head
Flashfyre 2024-04-05 22:58:40 -04:00
parent 9a9f093f5c
commit 5ebc351e4f
4 changed files with 53 additions and 32 deletions

View File

@ -3030,6 +3030,21 @@ export const speciesStarters = {
[Species.BLOODMOON_URSALUNA]: 7,
};
export const noStarterFormKeys: string[] = [
SpeciesFormKey.MEGA,
SpeciesFormKey.MEGA_X,
SpeciesFormKey.MEGA_Y,
SpeciesFormKey.PRIMAL,
SpeciesFormKey.ORIGIN,
SpeciesFormKey.THERIAN,
SpeciesFormKey.GIGANTAMAX,
SpeciesFormKey.GIGANTAMAX_RAPID,
SpeciesFormKey.GIGANTAMAX_SINGLE,
SpeciesFormKey.ETERNAMAX
].map(k => k.toString());
console.log(noStarterFormKeys)
// TODO: Remove
{
//setTimeout(() => {

View File

@ -55,7 +55,7 @@ import { OptionSelectConfig, OptionSelectItem } from "./ui/abstact-option-select
import { SaveSlotUiMode } from "./ui/save-slot-select-ui-handler";
import { fetchDailyRunSeed, getDailyRunStarters } from "./data/daily-run";
import { GameModes, gameModes } from "./game-mode";
import { getPokemonSpecies } from "./data/pokemon-species";
import { getPokemonSpecies, speciesStarters } from "./data/pokemon-species";
export class LoginPhase extends Phase {
private showText: boolean;
@ -1512,7 +1512,7 @@ export class CommandPhase extends FieldPhase {
}
break;
case Command.BALL:
if (this.scene.arena.biomeType === Biome.END) {
if (this.scene.arena.biomeType === Biome.END && (!this.scene.gameMode.isClassic || this.scene.gameData.getStarterCount(d => !!d.caughtAttr) < Object.keys(speciesStarters).length - 1)) {
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
this.scene.ui.setMode(Mode.MESSAGE);
this.scene.ui.showText(`An unseen force\nprevents using Poké Balls.`, null, () => {

View File

@ -1,7 +1,7 @@
import BattleScene, { PokeballCounts, bypassLogin } from "../battle-scene";
import Pokemon, { EnemyPokemon, PlayerPokemon } from "../field/pokemon";
import { pokemonPrevolutions } from "../data/pokemon-evolutions";
import PokemonSpecies, { allSpecies, getPokemonSpecies, speciesStarters } from "../data/pokemon-species";
import PokemonSpecies, { SpeciesFormKey, allSpecies, getPokemonSpecies, noStarterFormKeys, speciesStarters } from "../data/pokemon-species";
import { Species } from "../data/enums/species";
import * as Utils from "../utils";
import PokemonData from "./pokemon-data";
@ -936,7 +936,12 @@ export class GameData {
return new Promise<void>(resolve => {
const dexEntry = this.dexData[species.speciesId];
const caughtAttr = dexEntry.caughtAttr;
dexEntry.caughtAttr |= pokemon.getDexAttr();
const formIndex = pokemon.formIndex;
if (noStarterFormKeys.includes(pokemon.getFormKey()))
pokemon.formIndex = 0;
const dexAttr = pokemon.getDexAttr();
pokemon.formIndex = formIndex;
dexEntry.caughtAttr |= dexAttr;
dexEntry.natureAttr |= Math.pow(2, pokemon.nature + 1);
if (incrementCount) {
if (!fromEgg) {
@ -1018,6 +1023,27 @@ export class GameData {
} while (pokemonPrevolutions.hasOwnProperty(speciesId) && (speciesId = pokemonPrevolutions[speciesId]));
}
getSpeciesCount(dexEntryPredicate: (entry: DexEntry) => boolean): integer {
const dexKeys = Object.keys(this.dexData);
let speciesCount = 0;
for (let s of dexKeys) {
if (dexEntryPredicate(this.dexData[s]))
speciesCount++;
}
return speciesCount;
}
getStarterCount(dexEntryPredicate: (entry: DexEntry) => boolean): integer {
const starterKeys = Object.keys(speciesStarters);
let starterCount = 0;
for (let s of starterKeys) {
const starterDexEntry = this.dexData[s];
if (dexEntryPredicate(starterDexEntry))
starterCount++;
}
return starterCount;
}
getSpeciesDefaultDexAttr(species: PokemonSpecies, forSeen: boolean = false): bigint {
let ret = 0n;
const dexEntry = this.dexData[species.speciesId];

View File

@ -25,49 +25,29 @@ const displayStats: DisplayStats = {
startersUnlocked: {
label: 'Starters',
sourceFunc: gameData => {
const starterKeys = Object.keys(speciesStarters);
let starterCount = 0;
for (let s of starterKeys) {
if (gameData.dexData[s].caughtAttr)
starterCount++;
}
return `${starterCount} (${Math.floor((starterCount / starterKeys.length) * 1000) / 10}%)`;
const starterCount = gameData.getStarterCount(d => !!d.caughtAttr);
return `${starterCount} (${Math.floor((starterCount / Object.keys(speciesStarters).length) * 1000) / 10}%)`;
}
},
shinyStartersUnlocked: {
label: 'Shiny Starters',
sourceFunc: gameData => {
const starterKeys = Object.keys(speciesStarters);
let starterCount = 0;
for (let s of starterKeys) {
if (gameData.dexData[s].caughtAttr & DexAttr.SHINY)
starterCount++;
}
return `${starterCount} (${Math.floor((starterCount / starterKeys.length) * 1000) / 10}%)`;
const starterCount = gameData.getStarterCount(d => !!(d.caughtAttr & DexAttr.SHINY));
return `${starterCount} (${Math.floor((starterCount / Object.keys(speciesStarters).length) * 1000) / 10}%)`;
}
},
dexSeen: {
label: 'Species Seen',
sourceFunc: gameData => {
const dexKeys = Object.keys(gameData.dexData);
let seenCount = 0;
for (let s of dexKeys) {
if (gameData.dexData[s].seenAttr)
seenCount++;
}
return `${seenCount} (${Math.floor((seenCount / dexKeys.length) * 1000) / 10}%)`;
const seenCount = gameData.getSpeciesCount(d => !!d.seenAttr);
return `${seenCount} (${Math.floor((seenCount / Object.keys(gameData.dexData).length) * 1000) / 10}%)`;
}
},
dexCaught: {
label: 'Species Caught',
sourceFunc: gameData => {
const dexKeys = Object.keys(gameData.dexData);
let caughtCount = 0;
for (let s of dexKeys) {
if (gameData.dexData[s].caughtAttr)
caughtCount++;
}
return `${caughtCount} (${Math.floor((caughtCount / dexKeys.length) * 1000) / 10}%)`;
const caughtCount = gameData.getSpeciesCount(d => !!d.caughtAttr);
return `${caughtCount} (${Math.floor((caughtCount / Object.keys(gameData.dexData).length) * 1000) / 10}%)`;
}
},
classicSessionsPlayed: 'Classic Runs',