mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 09:02:47 +02:00
* Refactor evo conditions and descriptions * Fix test * Fix Shedinja * Simplify Gimmighoul evolution * Primeape and Stantler evolve by using their move 10 times * Basculin white stripe evolves by taking 294 recoil damage * Primeape and Stantler use modifiers for tracking * Basculin uses modifier too * Remove evo count from pokemon data * No more evo counter data, Gallade/Froslass * Fix allmoves import * Clamperl * Struggle shouldn't count for Basc recoil * Change to nicer type * Apply Benjie's suggestions Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> * Address formatting * Undo new evolution changes * Remove unused imports * Fix speciesid * Fixed up descriptions a little * Change a key name * Fix Gimmighoul * Apply Biome * Apply Biome unsafe fixes * Review suggestions - Convert `EvoCondKey` enum to `const` object - Use early returns in `SpeciesEvolutionCondition#description` and `SpeciesFormEvolution#description` - Replace `!!x.find` with `x.some` and `y.indexOf() > -1` with `y.includes()` - Implement `coerceArray` - Fix Shelmet evolution condition checking for Shelmet and not Karrablast - Remove unnecessary type casting in `battle-scene.ts` * Remove leftover enforce func loop * Fix circular imports issue - `getPokemonSpecies` moved to `src/utils/pokemon-utils.ts` - `allSpecies` moved to `src/data/data-lists.ts` --------- Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
32 lines
1.2 KiB
TypeScript
32 lines
1.2 KiB
TypeScript
import type { SystemSaveMigrator } from "#app/@types/SystemSaveMigrator";
|
|
import { getPokemonSpecies } from "#app/utils/pokemon-utils";
|
|
import type { SystemSaveData } from "#app/system/game-data";
|
|
import { DexAttr } from "#enums/dex-attr";
|
|
import { SpeciesId } from "#enums/species-id";
|
|
|
|
/**
|
|
* If a starter is caught, but the only forms registered as caught are not starterSelectable,
|
|
* unlock the default form.
|
|
* @param data - {@linkcode SystemSaveData}
|
|
*/
|
|
const migratePichuForms: SystemSaveMigrator = {
|
|
version: "1.8.3",
|
|
migrate: (data: SystemSaveData): void => {
|
|
if (data.starterData && data.dexData) {
|
|
// This is Pichu's Pokédex number
|
|
const sd = 172;
|
|
const caughtAttr = data.dexData[sd]?.caughtAttr;
|
|
const species = getPokemonSpecies(sd);
|
|
// An extra check because you never know
|
|
if (species.speciesId === SpeciesId.PICHU && caughtAttr) {
|
|
// Ensuring that only existing forms are unlocked
|
|
data.dexData[sd].caughtAttr &= species.getFullUnlocksData();
|
|
// If no forms are unlocked now, since Pichu is caught, we unlock form 0
|
|
data.dexData[sd].caughtAttr |= DexAttr.DEFAULT_FORM;
|
|
}
|
|
}
|
|
},
|
|
};
|
|
|
|
export const systemMigrators: Readonly<SystemSaveMigrator[]> = [migratePichuForms] as const;
|