mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-29 11:42:21 +02:00
Displaying form changing items; now using pokemonFormChanges to only show reachable forms
This commit is contained in:
parent
9e5ebb6285
commit
918fa7ea65
@ -12,7 +12,8 @@ import { GrowthRate, getGrowthRateColor } from "#app/data/exp";
|
|||||||
import { Gender, getGenderColor, getGenderSymbol } from "#app/data/gender";
|
import { Gender, getGenderColor, getGenderSymbol } from "#app/data/gender";
|
||||||
import { allMoves } from "#app/data/move";
|
import { allMoves } from "#app/data/move";
|
||||||
import { getNatureName } from "#app/data/nature";
|
import { getNatureName } from "#app/data/nature";
|
||||||
import { pokemonFormChanges } from "#app/data/pokemon-forms";
|
import type { SpeciesFormChange } from "#app/data/pokemon-forms";
|
||||||
|
import { FormChangeItem, pokemonFormChanges, SpeciesFormChangeItemTrigger } from "#app/data/pokemon-forms";
|
||||||
import type { LevelMoves } from "#app/data/balance/pokemon-level-moves";
|
import type { LevelMoves } from "#app/data/balance/pokemon-level-moves";
|
||||||
import { pokemonFormLevelMoves, pokemonSpeciesLevelMoves } from "#app/data/balance/pokemon-level-moves";
|
import { pokemonFormLevelMoves, pokemonSpeciesLevelMoves } from "#app/data/balance/pokemon-level-moves";
|
||||||
import type { PokemonForm } from "#app/data/pokemon-species";
|
import type { PokemonForm } from "#app/data/pokemon-species";
|
||||||
@ -214,7 +215,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
private baseStats: number[];
|
private baseStats: number[];
|
||||||
private baseTotal: number;
|
private baseTotal: number;
|
||||||
private evolutions: SpeciesFormEvolution[];
|
private evolutions: SpeciesFormEvolution[];
|
||||||
private battleForms: PokemonForm[];
|
private battleForms: SpeciesFormChange[];
|
||||||
private prevolutions: SpeciesFormEvolution[];
|
private prevolutions: SpeciesFormEvolution[];
|
||||||
|
|
||||||
private speciesStarterDexEntry: DexEntry | null;
|
private speciesStarterDexEntry: DexEntry | null;
|
||||||
@ -648,7 +649,8 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
this.getStarterSpeciesId(species.speciesId));
|
this.getStarterSpeciesId(species.speciesId));
|
||||||
this.biomes = this.sanitizeBiomes(allBiomes, species.speciesId);
|
this.biomes = this.sanitizeBiomes(allBiomes, species.speciesId);
|
||||||
|
|
||||||
this.battleForms = species.forms.filter(f => !f.isStarterSelectable);
|
const allFormChanges = pokemonFormChanges.hasOwnProperty(species.speciesId) ? pokemonFormChanges[species.speciesId] : [];
|
||||||
|
this.battleForms = allFormChanges.filter(f => (f.preFormKey === this.lastSpecies.forms[this.lastFormIndex].formKey));
|
||||||
|
|
||||||
const preSpecies = pokemonPrevolutions.hasOwnProperty(this.lastSpecies.speciesId) ? allSpecies.find(sp => sp.speciesId === pokemonPrevolutions[this.lastSpecies.speciesId]) : null;
|
const preSpecies = pokemonPrevolutions.hasOwnProperty(this.lastSpecies.speciesId) ? allSpecies.find(sp => sp.speciesId === pokemonPrevolutions[this.lastSpecies.speciesId]) : null;
|
||||||
if (preSpecies) {
|
if (preSpecies) {
|
||||||
@ -656,14 +658,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
this.prevolutions = preEvolutions.filter(
|
this.prevolutions = preEvolutions.filter(
|
||||||
e => e.speciesId === species.speciesId && ((e.evoFormKey === "" || e.evoFormKey === null) || e.evoFormKey === species.forms[formIndex]?.formKey));
|
e => e.speciesId === species.speciesId && ((e.evoFormKey === "" || e.evoFormKey === null) || e.evoFormKey === species.forms[formIndex]?.formKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.battleForms.find(bf => bf.formIndex === this.lastFormIndex)) {
|
|
||||||
const indexToRemove = this.battleForms.findIndex(form => form.formIndex === this.lastFormIndex);
|
|
||||||
if (indexToRemove !== -1) {
|
|
||||||
this.battleForms.splice(indexToRemove, 1);
|
|
||||||
}
|
|
||||||
this.battleForms.unshift(this.lastSpecies.forms[0]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to ensure that forms appear in the appropriate biome and tod
|
// Function to ensure that forms appear in the appropriate biome and tod
|
||||||
@ -1410,21 +1404,32 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
handler: () => false
|
handler: () => false
|
||||||
});
|
});
|
||||||
this.battleForms.map(bf => {
|
this.battleForms.map(bf => {
|
||||||
|
let conditionText:string = "";
|
||||||
|
if (bf.trigger instanceof SpeciesFormChangeItemTrigger) {
|
||||||
|
const item = bf.trigger.item;
|
||||||
|
conditionText = i18next.t("pokedexUiHandler:evolveUsing") + i18next.t(`modifierType:FormChangeItem.${FormChangeItem[item].toUpperCase()}`) +
|
||||||
|
" (" + (item > 100 ? "Ultra" : "Rogue") + ")";
|
||||||
|
} else if (bf.trigger) {
|
||||||
|
conditionText = i18next.t("pokedexUiHandler:evolveGeneric");
|
||||||
|
} else {
|
||||||
|
conditionText = "";
|
||||||
|
}
|
||||||
let label: string = this.getFormString(bf.formKey, this.lastSpecies);
|
let label: string = this.getFormString(bf.formKey, this.lastSpecies);
|
||||||
if (!label && bf.formIndex === 0) {
|
if (label === "") {
|
||||||
label = this.lastSpecies.name;
|
label = this.lastSpecies.name;
|
||||||
}
|
}
|
||||||
options.push({
|
options.push({
|
||||||
label: label,
|
label: label,
|
||||||
handler: () => {
|
handler: () => {
|
||||||
const newSpecies = this.lastSpecies;
|
const newSpecies = this.lastSpecies;
|
||||||
const newFormIndex = bf.formIndex;
|
const newFormIndex = this.lastSpecies.forms.find(f => f.formKey === bf.formKey)?.formIndex;
|
||||||
this.starterAttributes.form = newFormIndex;
|
this.starterAttributes.form = newFormIndex;
|
||||||
this.moveInfoOverlay.clear();
|
this.moveInfoOverlay.clear();
|
||||||
this.clearText();
|
this.clearText();
|
||||||
ui.setMode(Mode.POKEDEX_PAGE, newSpecies, newFormIndex, this.starterAttributes);
|
ui.setMode(Mode.POKEDEX_PAGE, newSpecies, newFormIndex, this.starterAttributes);
|
||||||
return true;
|
return true;
|
||||||
}
|
},
|
||||||
|
onHover: () => this.showText(conditionText)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1723,7 +1728,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(success, error);
|
|
||||||
if (success) {
|
if (success) {
|
||||||
ui.playSelect();
|
ui.playSelect();
|
||||||
} else if (error) {
|
} else if (error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user