mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-01 14:02:18 +02:00
Fix Shedinja
This commit is contained in:
parent
fb3988f624
commit
446849636d
@ -154,29 +154,41 @@ export class SpeciesEvolutionCondition {
|
|||||||
switch(cond) {
|
switch(cond) {
|
||||||
case EvoCondKey.FRIENDSHIP:
|
case EvoCondKey.FRIENDSHIP:
|
||||||
str.push(i18next.t("pokemonEvolutions:friendship"));
|
str.push(i18next.t("pokemonEvolutions:friendship"));
|
||||||
|
break;
|
||||||
case EvoCondKey.TIME:
|
case EvoCondKey.TIME:
|
||||||
str.push(i18next.t(`pokemonEvolutions:timeOfDay.${TimeOfDay[this.data.time![0]]}`));
|
str.push(i18next.t(`pokemonEvolutions:timeOfDay.${TimeOfDay[this.data.time![0]]}`));
|
||||||
|
break;
|
||||||
case EvoCondKey.MOVE_TYPE:
|
case EvoCondKey.MOVE_TYPE:
|
||||||
str.push(i18next.t("pokemonEvolutions:moveType", {type: i18next.t(`pokemonInfo:Type.${this.data.moveType!}`)}));
|
str.push(i18next.t("pokemonEvolutions:moveType", {type: i18next.t(`pokemonInfo:Type.${this.data.moveType!}`)}));
|
||||||
|
break;
|
||||||
case EvoCondKey.PARTY_TYPE:
|
case EvoCondKey.PARTY_TYPE:
|
||||||
str.push(i18next.t("pokemonEvolutions:partyType", {type: i18next.t(`pokemonInfo:Type.${this.data.partyType!}`)}));
|
str.push(i18next.t("pokemonEvolutions:partyType", {type: i18next.t(`pokemonInfo:Type.${this.data.partyType!}`)}));
|
||||||
|
break;
|
||||||
case EvoCondKey.GENDER:
|
case EvoCondKey.GENDER:
|
||||||
str.push(i18next.t(`pokemonEvolutions:gender.${Gender[this.data.gender!]}`));
|
str.push(i18next.t(`pokemonEvolutions:gender.${Gender[this.data.gender!]}`));
|
||||||
|
break;
|
||||||
case EvoCondKey.MOVE:
|
case EvoCondKey.MOVE:
|
||||||
case EvoCondKey.TYROGUE:
|
case EvoCondKey.TYROGUE:
|
||||||
str.push(i18next.t("pokemonEvolutions:move", {move: allMoves[this.data.move!].name}));
|
str.push(i18next.t("pokemonEvolutions:move", {move: allMoves[this.data.move!].name}));
|
||||||
|
break;
|
||||||
case EvoCondKey.BIOME:
|
case EvoCondKey.BIOME:
|
||||||
str.push(i18next.t("pokemonEvolutions:biome"));
|
str.push(i18next.t("pokemonEvolutions:biome"));
|
||||||
|
break;
|
||||||
case EvoCondKey.NATURE:
|
case EvoCondKey.NATURE:
|
||||||
str.push(i18next.t("pokemonEvolutions:nature"));
|
str.push(i18next.t("pokemonEvolutions:nature"));
|
||||||
|
break;
|
||||||
case EvoCondKey.WEATHER:
|
case EvoCondKey.WEATHER:
|
||||||
str.push(i18next.t("pokemonEvolutions:weather"));
|
str.push(i18next.t("pokemonEvolutions:weather"));
|
||||||
|
break;
|
||||||
case EvoCondKey.SHEDINJA:
|
case EvoCondKey.SHEDINJA:
|
||||||
str.push(i18next.t("pokemonEvolutions:shedinja"));
|
str.push(i18next.t("pokemonEvolutions:shedinja"));
|
||||||
|
break;
|
||||||
case EvoCondKey.EVO_COUNTER:
|
case EvoCondKey.EVO_COUNTER:
|
||||||
str.push(i18next.t("pokemonEvolutions:treasure"));
|
str.push(i18next.t("pokemonEvolutions:treasure"));
|
||||||
|
break;
|
||||||
case EvoCondKey.SPECIES_CAUGHT:
|
case EvoCondKey.SPECIES_CAUGHT:
|
||||||
str.push(i18next.t("pokemonEvolutions:caught", {species: getPokemonSpecies(this.data.speciesCaught!).name}));
|
str.push(i18next.t("pokemonEvolutions:caught", {species: getPokemonSpecies(this.data.speciesCaught!).name}));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return str.join(i18next.t("pokemonEvolutions:connector"));
|
return str.join(i18next.t("pokemonEvolutions:connector"));
|
||||||
@ -207,8 +219,8 @@ export class SpeciesEvolutionCondition {
|
|||||||
).length >= this.data.evoCount!;
|
).length >= this.data.evoCount!;
|
||||||
case EvoCondKey.GENDER:
|
case EvoCondKey.GENDER:
|
||||||
return pokemon.gender === this.data.gender;
|
return pokemon.gender === this.data.gender;
|
||||||
case EvoCondKey.SHEDINJA:
|
case EvoCondKey.SHEDINJA: // Shedinja cannot be evolved into directly
|
||||||
return globalScene.getPlayerParty().length < 6 && globalScene.pokeballCounts[PokeballType.POKEBALL] > 0;
|
return false;
|
||||||
case EvoCondKey.BIOME:
|
case EvoCondKey.BIOME:
|
||||||
return this.data.biome?.includes(globalScene.arena.biomeType);
|
return this.data.biome?.includes(globalScene.arena.biomeType);
|
||||||
case EvoCondKey.WEATHER:
|
case EvoCondKey.WEATHER:
|
||||||
@ -230,6 +242,10 @@ export class SpeciesEvolutionCondition {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function validateShedinjaEvo(): boolean {
|
||||||
|
return globalScene.getPlayerParty().length < 6 && globalScene.pokeballCounts[PokeballType.POKEBALL] > 0;
|
||||||
|
}
|
||||||
|
|
||||||
export class SpeciesFormEvolution {
|
export class SpeciesFormEvolution {
|
||||||
public speciesId: Species;
|
public speciesId: Species;
|
||||||
public preFormKey: string | null;
|
public preFormKey: string | null;
|
||||||
@ -253,9 +269,7 @@ export class SpeciesFormEvolution {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get description(): string {
|
get description(): string {
|
||||||
if (this.desc.length > 0) {
|
if (this.desc.length === 0) {
|
||||||
return this.desc;
|
|
||||||
}
|
|
||||||
const strings: string[] = [];
|
const strings: string[] = [];
|
||||||
if (this.level > 1) {
|
if (this.level > 1) {
|
||||||
strings.push(i18next.t("pokemonEvolutions:level") + ` ${this.level}`);
|
strings.push(i18next.t("pokemonEvolutions:level") + ` ${this.level}`);
|
||||||
@ -268,11 +282,12 @@ export class SpeciesFormEvolution {
|
|||||||
if (this.condition) {
|
if (this.condition) {
|
||||||
strings.push(this.condition.description);
|
strings.push(this.condition.description);
|
||||||
}
|
}
|
||||||
return 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) => index > 0 ? str[0].toLowerCase() + str.slice(1) : str)
|
||||||
.join(i18next.t("pokemonEvolutions:connector"));
|
.join(i18next.t("pokemonEvolutions:connector"));
|
||||||
|
}
|
||||||
|
return this.desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -284,12 +299,11 @@ export class SpeciesFormEvolution {
|
|||||||
*/
|
*/
|
||||||
public validate(pokemon: Pokemon, forFusion: boolean = false, item?: EvolutionItem): boolean {
|
public validate(pokemon: Pokemon, forFusion: boolean = false, item?: EvolutionItem): boolean {
|
||||||
return (
|
return (
|
||||||
// If an item is given, check if it's the right one
|
|
||||||
item === this.item &&
|
|
||||||
pokemon.level >= this.level &&
|
pokemon.level >= this.level &&
|
||||||
// Check form key, using the fusion's form key if we're checking the fusion
|
// Check form key, using the fusion's form key if we're checking the fusion
|
||||||
(isNullOrUndefined(this.preFormKey) || (forFusion ? pokemon.getFormKey() : pokemon.getFusionFormKey()) === this.preFormKey) &&
|
(isNullOrUndefined(this.preFormKey) || (forFusion ? pokemon.getFusionFormKey() : pokemon.getFormKey()) === this.preFormKey) &&
|
||||||
(this.condition === null || this.condition?.conditionsFulfilled(pokemon))
|
(isNullOrUndefined(this.condition) || this.condition?.conditionsFulfilled(pokemon)) &&
|
||||||
|
((item ?? EvolutionItem.NONE) === (this.item ?? EvolutionItem.NONE))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,6 +99,7 @@ import {
|
|||||||
pokemonEvolutions,
|
pokemonEvolutions,
|
||||||
pokemonPrevolutions,
|
pokemonPrevolutions,
|
||||||
FusionSpeciesFormEvolution,
|
FusionSpeciesFormEvolution,
|
||||||
|
validateShedinjaEvo,
|
||||||
} from "#app/data/balance/pokemon-evolutions";
|
} from "#app/data/balance/pokemon-evolutions";
|
||||||
import {
|
import {
|
||||||
reverseCompatibleTms,
|
reverseCompatibleTms,
|
||||||
@ -6667,10 +6668,8 @@ export class PlayerPokemon extends Pokemon {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
if (preEvolution.speciesId === Species.GIMMIGHOUL) {
|
if (preEvolution.speciesId === Species.GIMMIGHOUL) {
|
||||||
const evotracker =
|
const evotracker = this.getHeldItems().find(m => m instanceof EvoTrackerModifier);
|
||||||
this.getHeldItems().filter(m => m instanceof EvoTrackerModifier)[0] ??
|
if (!isNullOrUndefined(evotracker)) {
|
||||||
null;
|
|
||||||
if (evotracker) {
|
|
||||||
globalScene.removeModifier(evotracker);
|
globalScene.removeModifier(evotracker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6699,7 +6698,7 @@ export class PlayerPokemon extends Pokemon {
|
|||||||
) {
|
) {
|
||||||
const newEvolution = pokemonEvolutions[evoSpecies.speciesId][1];
|
const newEvolution = pokemonEvolutions[evoSpecies.speciesId][1];
|
||||||
|
|
||||||
if (newEvolution.validate(this, evoSpecies.speciesId === this.species.speciesId)) {
|
if (validateShedinjaEvo()) {
|
||||||
const newPokemon = globalScene.addPlayerPokemon(
|
const newPokemon = globalScene.addPlayerPokemon(
|
||||||
this.species,
|
this.species,
|
||||||
this.level,
|
this.level,
|
||||||
|
Loading…
Reference in New Issue
Block a user