mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 09:02:47 +02:00
Merge branch 'beta' into WorkingDiscardFunction
This commit is contained in:
commit
0d998a7d3a
@ -291,13 +291,18 @@ export class SpeciesFormEvolution {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if this evolution is item-based and any conditions for it are fulfilled
|
||||||
|
* @param pokemon {@linkcode Pokemon} who wants to evolve
|
||||||
|
* @param forFusion defaults to False. Whether this evolution is meant for the secondary fused mon. In that case, use their form key.
|
||||||
|
* @returns whether this evolution uses an item and can apply to the Pokemon
|
||||||
|
*/
|
||||||
public isValidItemEvolution(pokemon: Pokemon, forFusion = false): boolean {
|
public isValidItemEvolution(pokemon: Pokemon, forFusion = false): boolean {
|
||||||
return (
|
return (
|
||||||
// If an item is given, check if it's the right one
|
|
||||||
!isNullOrUndefined(this.item) &&
|
!isNullOrUndefined(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) &&
|
||||||
(isNullOrUndefined(this.condition) || this.condition.conditionsFulfilled(pokemon))
|
(isNullOrUndefined(this.condition) || this.condition.conditionsFulfilled(pokemon))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1603,12 +1603,12 @@ class EvolutionItemModifierTypeGenerator extends ModifierTypeGenerator {
|
|||||||
)
|
)
|
||||||
.flatMap(p => {
|
.flatMap(p => {
|
||||||
const evolutions = pokemonEvolutions[p.fusionSpecies!.speciesId];
|
const evolutions = pokemonEvolutions[p.fusionSpecies!.speciesId];
|
||||||
return evolutions.filter(e => e.validate(p, true));
|
return evolutions.filter(e => e.isValidItemEvolution(p, true));
|
||||||
}),
|
}),
|
||||||
]
|
]
|
||||||
.flat()
|
.flat()
|
||||||
.flatMap(e => e.evoItem)
|
.flatMap(e => e.evoItem)
|
||||||
.filter(i => (!!i && i > 50) === rare);
|
.filter(i => !!i && i > 50 === rare);
|
||||||
|
|
||||||
if (!evolutionItemPool.length) {
|
if (!evolutionItemPool.length) {
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user