Add evolution for secondary fusion species
This commit is contained in:
1 parent
1085e0f692
commit
4c383e105f
5 files changed
+99
-29
No files matched your search
@@ -513,6 +513,9 @@ export class EvolutionItemModifierType extends PokemonModifierType implements Ge
|
||||
if (pokemonEvolutions.hasOwnProperty(pokemon.species.speciesId) && pokemonEvolutions[pokemon.species.speciesId].filter(e => e.item === this.evolutionItem
|
||||
&& (!e.condition || e.condition.predicate(pokemon))).length)
|
||||
return null;
|
||||
else if (pokemon.isFusion() && pokemonEvolutions.hasOwnProperty(pokemon.fusionSpecies.speciesId) && pokemonEvolutions[pokemon.fusionSpecies.speciesId].filter(e => e.item === this.evolutionItem
|
||||
&& (!e.condition || e.condition.predicate(pokemon))).length)
|
||||
return null;
|
||||
|
||||
return PartyUiHandler.NoEffectMessage;
|
||||
}, EvolutionItem[evolutionItem].toLowerCase());
|
||||
@@ -621,10 +624,16 @@ class EvolutionItemModifierTypeGenerator extends ModifierTypeGenerator {
|
||||
if (pregenArgs)
|
||||
return new EvolutionItemModifierType(pregenArgs[0] as EvolutionItem);
|
||||
|
||||
const evolutionItemPool = party.filter(p => pokemonEvolutions.hasOwnProperty(p.species.speciesId)).map(p => {
|
||||
const evolutions = pokemonEvolutions[p.species.speciesId];
|
||||
return evolutions.filter(e => e.item !== EvolutionItem.NONE && (e.evoFormKey === null || (e.preFormKey || '') === p.getFormKey()) && (!e.condition || e.condition.predicate(p)));
|
||||
}).flat().flatMap(e => e.item).filter(i => (i > 50) === rare);
|
||||
const evolutionItemPool = [
|
||||
party.filter(p => pokemonEvolutions.hasOwnProperty(p.species.speciesId)).map(p => {
|
||||
const evolutions = pokemonEvolutions[p.species.speciesId];
|
||||
return evolutions.filter(e => e.item !== EvolutionItem.NONE && (e.evoFormKey === null || (e.preFormKey || '') === p.getFormKey()) && (!e.condition || e.condition.predicate(p)));
|
||||
}).flat(),
|
||||
party.filter(p => p.isFusion() && pokemonEvolutions.hasOwnProperty(p.fusionSpecies.speciesId)).map(p => {
|
||||
const evolutions = pokemonEvolutions[p.fusionSpecies.speciesId];
|
||||
return evolutions.filter(e => e.item !== EvolutionItem.NONE && (e.evoFormKey === null || (e.preFormKey || '') === p.getFusionFormKey()) && (!e.condition || e.condition.predicate(p)));
|
||||
}).flat()
|
||||
].flat().flatMap(e => e.item).filter(i => (i > 50) === rare);
|
||||
|
||||
if (!evolutionItemPool.length)
|
||||
return null;
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Stat } from "../data/pokemon-stat";
|
||||
import { addTextObject, TextStyle } from "../ui/text";
|
||||
import { Type } from '../data/type';
|
||||
import { EvolutionPhase } from '../evolution-phase';
|
||||
import { pokemonEvolutions } from '../data/pokemon-evolutions';
|
||||
import { FusionSpeciesFormEvolution, pokemonEvolutions } from '../data/pokemon-evolutions';
|
||||
import { getPokemonMessage } from '../messages';
|
||||
import * as Utils from "../utils";
|
||||
import { TempBattleStat } from '../data/temp-battle-stat';
|
||||
@@ -1183,10 +1183,18 @@ export class EvolutionItemModifier extends ConsumablePokemonModifier {
|
||||
apply(args: any[]): boolean {
|
||||
const pokemon = args[0] as PlayerPokemon;
|
||||
|
||||
const matchingEvolution = pokemonEvolutions[pokemon.species.speciesId].find(e => e.item === (this.type as ModifierTypes.EvolutionItemModifierType).evolutionItem
|
||||
let matchingEvolution = pokemonEvolutions[pokemon.species.speciesId].find(e => e.item === (this.type as ModifierTypes.EvolutionItemModifierType).evolutionItem
|
||||
&& (e.evoFormKey === null || (e.preFormKey || '') === pokemon.getFormKey())
|
||||
&& (!e.condition || e.condition.predicate(pokemon)));
|
||||
|
||||
if (!matchingEvolution && pokemon.isFusion()) {
|
||||
matchingEvolution = pokemonEvolutions[pokemon.fusionSpecies.speciesId].find(e => e.item === (this.type as ModifierTypes.EvolutionItemModifierType).evolutionItem
|
||||
&& (e.evoFormKey === null || (e.preFormKey || '') === pokemon.getFusionFormKey())
|
||||
&& (!e.condition || e.condition.predicate(pokemon)));
|
||||
if (matchingEvolution)
|
||||
matchingEvolution = new FusionSpeciesFormEvolution(pokemon.species.speciesId, matchingEvolution);
|
||||
}
|
||||
|
||||
if (matchingEvolution) {
|
||||
pokemon.scene.unshiftPhase(new EvolutionPhase(pokemon.scene, pokemon, matchingEvolution, pokemon.level - 1));
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user