mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-01 14:02:18 +02:00
Fixed up descriptions a little
This commit is contained in:
parent
c4f9447902
commit
4f4b4a5c94
@ -1,5 +1,5 @@
|
|||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import { Gender } from "#app/data/gender";
|
import { Gender, getGenderSymbol } from "#app/data/gender";
|
||||||
import { PokeballType } from "#enums/pokeball";
|
import { PokeballType } from "#enums/pokeball";
|
||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { PokemonType } from "#enums/pokemon-type";
|
import { PokemonType } from "#enums/pokemon-type";
|
||||||
@ -120,44 +120,47 @@ type EvolutionConditionData =
|
|||||||
|
|
||||||
export class SpeciesEvolutionCondition {
|
export class SpeciesEvolutionCondition {
|
||||||
public data: EvolutionConditionData[];
|
public data: EvolutionConditionData[];
|
||||||
|
private desc: string[];
|
||||||
|
|
||||||
constructor(...data: EvolutionConditionData[]) {
|
constructor(...data: EvolutionConditionData[]) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get description(): string {
|
public get description(): string[] {
|
||||||
const str: string[] = this.data.map(cond => {
|
if (isNullOrUndefined(this.desc)) {
|
||||||
switch(cond.key) {
|
this.desc = this.data.map(cond => {
|
||||||
case EvoCondKey.FRIENDSHIP:
|
switch(cond.key) {
|
||||||
return i18next.t("pokemonEvolutions:friendship");
|
case EvoCondKey.FRIENDSHIP:
|
||||||
case EvoCondKey.TIME:
|
return i18next.t("pokemonEvolutions:friendship");
|
||||||
return i18next.t(`pokemonEvolutions:timeOfDay.${TimeOfDay[cond.time[0]]}`);
|
case EvoCondKey.TIME:
|
||||||
case EvoCondKey.MOVE_TYPE:
|
return i18next.t(`pokemonEvolutions:timeOfDay.${TimeOfDay[cond.time[cond.time.length - 1]]}`); // For Day and Night evos, the key we want goes last
|
||||||
return i18next.t("pokemonEvolutions:moveType", {type: i18next.t(`pokemonInfo:Type.${cond.pkmnType}`)});
|
case EvoCondKey.MOVE_TYPE:
|
||||||
case EvoCondKey.PARTY_TYPE:
|
return i18next.t("pokemonEvolutions:moveType", {type: i18next.t(`pokemonInfo:Type.${PokemonType[cond.pkmnType]}`)});
|
||||||
return i18next.t("pokemonEvolutions:partyType", {type: i18next.t(`pokemonInfo:Type.${cond.pkmnType}`)});
|
case EvoCondKey.PARTY_TYPE:
|
||||||
case EvoCondKey.GENDER:
|
return i18next.t("pokemonEvolutions:partyType", {type: i18next.t(`pokemonInfo:Type.${PokemonType[cond.pkmnType]}`)});
|
||||||
return i18next.t(`pokemonEvolutions:gender.${Gender[cond.gender]}`);
|
case EvoCondKey.GENDER:
|
||||||
case EvoCondKey.MOVE:
|
return i18next.t("pokemonEvolutions:gender", {gender: getGenderSymbol(cond.gender)});
|
||||||
case EvoCondKey.TYROGUE:
|
case EvoCondKey.MOVE:
|
||||||
return i18next.t("pokemonEvolutions:move", {move: allMoves[cond.move].name});
|
case EvoCondKey.TYROGUE:
|
||||||
case EvoCondKey.BIOME:
|
return i18next.t("pokemonEvolutions:move", {move: allMoves[cond.move].name});
|
||||||
return i18next.t("pokemonEvolutions:biome");
|
case EvoCondKey.BIOME:
|
||||||
case EvoCondKey.NATURE:
|
return i18next.t("pokemonEvolutions:biome");
|
||||||
return i18next.t("pokemonEvolutions:nature");
|
case EvoCondKey.NATURE:
|
||||||
case EvoCondKey.WEATHER:
|
return i18next.t("pokemonEvolutions:nature");
|
||||||
return i18next.t("pokemonEvolutions:weather");
|
case EvoCondKey.WEATHER:
|
||||||
case EvoCondKey.SHEDINJA:
|
return i18next.t("pokemonEvolutions:weather");
|
||||||
return i18next.t("pokemonEvolutions:shedinja");
|
case EvoCondKey.SHEDINJA:
|
||||||
case EvoCondKey.EVO_TREASURE_TRACKER:
|
return i18next.t("pokemonEvolutions:shedinja");
|
||||||
return i18next.t("pokemonEvolutions:treasure");
|
case EvoCondKey.EVO_TREASURE_TRACKER:
|
||||||
case EvoCondKey.SPECIES_CAUGHT:
|
return i18next.t("pokemonEvolutions:treasure");
|
||||||
return i18next.t("pokemonEvolutions:caught", {species: getPokemonSpecies(cond.speciesCaught).name});
|
case EvoCondKey.SPECIES_CAUGHT:
|
||||||
case EvoCondKey.HELD_ITEM:
|
return i18next.t("pokemonEvolutions:caught", {species: getPokemonSpecies(cond.speciesCaught).name});
|
||||||
return i18next.t(`pokemonEvolutions:heldItem.${cond.itemKey}`);
|
case EvoCondKey.HELD_ITEM:
|
||||||
}
|
return i18next.t(`pokemonEvolutions:heldItem.${cond.itemKey}`);
|
||||||
}).filter(s => !isNullOrUndefined(s)); // Filter out stringless conditions
|
}
|
||||||
return str.join(i18next.t("pokemonEvolutions:connector")); // A comma or something of the sort
|
}).filter(s => !isNullOrUndefined(s)); // Filter out stringless conditions
|
||||||
|
}
|
||||||
|
return this.desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public conditionsFulfilled(pokemon: Pokemon): boolean {
|
public conditionsFulfilled(pokemon: Pokemon): boolean {
|
||||||
@ -238,21 +241,36 @@ export class SpeciesFormEvolution {
|
|||||||
get description(): string {
|
get description(): string {
|
||||||
if (this.desc.length === 0) {
|
if (this.desc.length === 0) {
|
||||||
const strings: string[] = [];
|
const strings: string[] = [];
|
||||||
|
let len = 0;
|
||||||
if (this.level > 1) {
|
if (this.level > 1) {
|
||||||
strings.push(i18next.t("pokemonEvolutions:level") + ` ${this.level}`);
|
strings.push(i18next.t("pokemonEvolutions:level", {lv: this.level}));
|
||||||
}
|
}
|
||||||
if (this.item) {
|
if (this.item) {
|
||||||
const itemDescription = i18next.t(`modifierType:EvolutionItem.${EvolutionItem[this.item].toUpperCase()}`);
|
const itemDescription = i18next.t(`modifierType:EvolutionItem.${EvolutionItem[this.item].toUpperCase()}`);
|
||||||
const rarity = this.item > 50 ? i18next.t("pokemonEvolutions:ULTRA") : i18next.t("pokemonEvolutions:GREAT");
|
const rarity = this.item > 50 ? i18next.t("pokemonEvolutions:ULTRA") : i18next.t("pokemonEvolutions:GREAT");
|
||||||
strings.push(i18next.t("pokemonEvolutions:using") + itemDescription + ` (${rarity})`);
|
strings.push(i18next.t("pokemonEvolutions:using", {item: itemDescription, tier: rarity}));
|
||||||
}
|
}
|
||||||
if (this.condition) {
|
if (this.condition) {
|
||||||
strings.push(this.condition.description);
|
if (strings.length === 0) {
|
||||||
|
strings.push(i18next.t("pokemonEvolutions:levelUp"));
|
||||||
|
}
|
||||||
|
strings.push(...this.condition.description);
|
||||||
}
|
}
|
||||||
this.desc = strings
|
this.desc = strings
|
||||||
.filter(str => str !== "")
|
.filter(str => str !== "")
|
||||||
.map((str, index) => index > 0 ? str[0].toLowerCase() + str.slice(1) : str)
|
.map((str, index, arr) => {
|
||||||
.join(i18next.t("pokemonEvolutions:connector"));
|
if (index === 0) {
|
||||||
|
len = str.length;
|
||||||
|
return str;
|
||||||
|
} else if (len + str.length > 60) {
|
||||||
|
len = str.length;
|
||||||
|
return "\n" + str[0].toLowerCase() + str.slice(1);
|
||||||
|
}
|
||||||
|
len += str.length;
|
||||||
|
return str[0].toLowerCase() + str.slice(1);
|
||||||
|
})
|
||||||
|
.join(" ")
|
||||||
|
.replace(" \n", i18next.t("pokemonEvolutions:connector") + "\n");
|
||||||
}
|
}
|
||||||
return this.desc;
|
return this.desc;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user