mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-28 11:12:24 +02:00
Moving evolution condition description logic entirely to the SpeciesEvolution class
This commit is contained in:
parent
ec0343960b
commit
2777cff246
@ -92,6 +92,7 @@ export class SpeciesFormEvolution {
|
||||
public item: EvolutionItem | null;
|
||||
public condition: SpeciesEvolutionCondition | null;
|
||||
public wildDelay: SpeciesWildEvolutionDelay;
|
||||
public description: string = "";
|
||||
|
||||
constructor(speciesId: Species, preFormKey: string | null, evoFormKey: string | null, level: integer, item: EvolutionItem | null, condition: SpeciesEvolutionCondition | null, wildDelay?: SpeciesWildEvolutionDelay) {
|
||||
this.speciesId = speciesId;
|
||||
@ -101,6 +102,23 @@ export class SpeciesFormEvolution {
|
||||
this.item = item || EvolutionItem.NONE;
|
||||
this.condition = condition;
|
||||
this.wildDelay = wildDelay ?? SpeciesWildEvolutionDelay.NONE;
|
||||
|
||||
const strings: string[] = [];
|
||||
if (this.level > 1) {
|
||||
strings.push(i18next.t("pokemonEvolutions:level") + ` ${this.level}`);
|
||||
}
|
||||
if (this.item) {
|
||||
const itemDescription = i18next.t(`modifierType:EvolutionItem.${EvolutionItem[this.item].toUpperCase()}`);
|
||||
const rarity = this.item > 50 ? i18next.t("pokemonEvolutions:ULTRA") : i18next.t("pokemonEvolutions:GREAT");
|
||||
strings.push(i18next.t("pokemonEvolutions:using") + itemDescription + ` (${rarity})`);
|
||||
}
|
||||
if (this.condition) {
|
||||
strings.push(this.condition.description);
|
||||
}
|
||||
this.description = strings
|
||||
.filter(str => str !== "")
|
||||
.map((str, index) => index > 0 ? str[0].toLowerCase() + str.slice(1) : str)
|
||||
.join(i18next.t("pokemonEvolutions:connector"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { SpeciesFormEvolution } from "#app/data/balance/pokemon-evolutions";
|
||||
import { EvolutionItem, pokemonEvolutions, pokemonPrevolutions, pokemonStarters } from "#app/data/balance/pokemon-evolutions";
|
||||
import { pokemonEvolutions, pokemonPrevolutions, pokemonStarters } from "#app/data/balance/pokemon-evolutions";
|
||||
import type { Variant } from "#app/data/variant";
|
||||
import { getVariantTint, getVariantIcon } from "#app/data/variant";
|
||||
import { argbFromRgba } from "@material/material-color-utilities";
|
||||
@ -883,28 +883,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
||||
return name + suffix;
|
||||
}
|
||||
|
||||
getConditionString(evo: SpeciesFormEvolution): string {
|
||||
|
||||
const strings: string[] = [];
|
||||
if (evo.level > 1) {
|
||||
strings.push(i18next.t("pokedexUiHandler:evolveAtLv") + ` ${evo.level}`);
|
||||
}
|
||||
if (evo.item) {
|
||||
const itemDescription = i18next.t(`modifierType:EvolutionItem.${EvolutionItem[evo.item].toUpperCase()}`);
|
||||
const rarity = evo.item > 50 ? i18next.t("pokedexUiHandler:ULTRA") : i18next.t("pokedexUiHandler:GREAT");
|
||||
strings.push(i18next.t("pokedexUiHandler:evolveUsing") + itemDescription + ` (${rarity})`);
|
||||
}
|
||||
if (evo.condition) {
|
||||
strings.push(evo.condition.description);
|
||||
}
|
||||
const conditionText = strings
|
||||
.filter(str => str !== "")
|
||||
.map((str, index) => index > 0 ? str[0].toLowerCase() + str.slice(1) : str)
|
||||
.join(", ");
|
||||
|
||||
return conditionText;
|
||||
}
|
||||
|
||||
processInput(button: Button): boolean {
|
||||
if (this.blockInput) {
|
||||
return false;
|
||||
@ -1342,7 +1320,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
||||
this.prevolutions.map(pre => {
|
||||
const preSpecies = allSpecies.find(species => species.speciesId === pokemonPrevolutions[this.species.speciesId]);
|
||||
|
||||
const conditionText:string = this.getConditionString(pre);
|
||||
const conditionText: string = pre.description;
|
||||
|
||||
options.push({
|
||||
label: pre.preFormKey ?
|
||||
@ -1378,7 +1356,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
||||
const evoSpeciesStarterDexEntry = evoSpecies ? globalScene.gameData.dexData[evoSpecies.speciesId] : null;
|
||||
const isCaughtEvo = evoSpeciesStarterDexEntry?.caughtAttr ? true : false;
|
||||
|
||||
const conditionText:string = this.getConditionString(evo);
|
||||
const conditionText: string = evo.description;
|
||||
|
||||
options.push({
|
||||
label: evo.evoFormKey ?
|
||||
|
Loading…
Reference in New Issue
Block a user