Add evolution pausing and fix visual bug with evolution scene
parent
fc2665b3f0
commit
dad6401f67
|
@ -2642,11 +2642,13 @@ export class LevelUpPhase extends PlayerPartyMemberPokemonPhase {
|
|||
for (let lm of levelMoves)
|
||||
this.scene.unshiftPhase(new LearnMovePhase(this.scene, this.partyMemberIndex, lm));
|
||||
}
|
||||
if (!pokemon.pauseEvolutions) {
|
||||
const evolution = pokemon.getEvolution();
|
||||
if (evolution)
|
||||
this.scene.unshiftPhase(new EvolutionPhase(this.scene, this.partyMemberIndex, evolution, this.lastLevel));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
||||
private moveId: Moves;
|
||||
|
|
|
@ -95,9 +95,10 @@ export class EvolutionPhase extends BattlePhase {
|
|||
this.scene.ui.showText(`What?\n${preName} is evolving!`, null, () => {
|
||||
pokemon.cry();
|
||||
|
||||
const evolvedPokemon = pokemon.getPossibleEvolution(this.evolution);
|
||||
pokemon.getPossibleEvolution(this.evolution).then(evolvedPokemon => {
|
||||
|
||||
[ this.pokemonEvoSprite, this.pokemonEvoTintSprite ].map(sprite => {
|
||||
console.log(evolvedPokemon.getSpriteKey(true))
|
||||
sprite.play(evolvedPokemon.getSpriteKey(true));
|
||||
[ 'spriteColors', 'fusionSpriteColors' ].map(k => {
|
||||
if (evolvedPokemon.summonData?.speciesForm)
|
||||
|
@ -161,10 +162,23 @@ export class EvolutionPhase extends BattlePhase {
|
|||
this.scene.unshiftPhase(new EndEvolutionPhase(this.scene));
|
||||
|
||||
this.scene.ui.showText(`${preName} stopped evolving.`, null, () => {
|
||||
this.scene.ui.showText(`Would you like to pause evolutions for ${preName}?\nEvolutions can be re-enabled from the party screen.`, null, () => {
|
||||
const end = () => {
|
||||
this.scene.ui.showText(null, 0);
|
||||
this.scene.playBgm();
|
||||
evolvedPokemon.destroy();
|
||||
this.end();
|
||||
}, null, true, 3000);
|
||||
};
|
||||
this.scene.ui.setOverlayMode(Mode.CONFIRM, () => {
|
||||
this.scene.ui.revertMode();
|
||||
pokemon.pauseEvolutions = true;
|
||||
this.scene.ui.showText(`Evolutions have been paused for ${preName}.`, null, end, 3000);
|
||||
}, () => {
|
||||
this.scene.ui.revertMode();
|
||||
this.scene.time.delayedCall(3000, end);
|
||||
});
|
||||
});
|
||||
}, null, true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -231,6 +245,7 @@ export class EvolutionPhase extends BattlePhase {
|
|||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}, 1000);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -515,7 +515,7 @@ 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 evolutionItemPool = party.filter(p => !p.pauseEvolutions && 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().filter(e => (e.item >= 100) === mega).flatMap(e => e.item);
|
||||
|
|
|
@ -65,6 +65,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
public moveset: PokemonMove[];
|
||||
public status: Status;
|
||||
public winCount: integer;
|
||||
public pauseEvolutions: boolean;
|
||||
public pokerus: boolean;
|
||||
|
||||
public fusionSpecies: PokemonSpecies;
|
||||
|
@ -120,6 +121,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
this.moveset = dataSource.moveset;
|
||||
this.status = dataSource.status;
|
||||
this.winCount = dataSource.winCount;
|
||||
this.pauseEvolutions = dataSource.pauseEvolutions;
|
||||
this.pokerus = !!dataSource.pokerus;
|
||||
this.fusionSpecies = dataSource.fusionSpecies instanceof PokemonSpecies ? dataSource.fusionSpecies : getPokemonSpecies(dataSource.fusionSpecies);
|
||||
this.fusionFormIndex = dataSource.fusionFormIndex;
|
||||
|
@ -1716,14 +1718,18 @@ export class PlayerPokemon extends Pokemon {
|
|||
});
|
||||
}
|
||||
|
||||
getPossibleEvolution(evolution: SpeciesEvolution): Pokemon {
|
||||
getPossibleEvolution(evolution: SpeciesEvolution): Promise<Pokemon> {
|
||||
return new Promise(resolve => {
|
||||
const species = getPokemonSpecies(evolution.speciesId);
|
||||
const formIndex = Math.max(this.species.forms.findIndex(f => f.formKey === evolution.evoFormKey), 0);
|
||||
return new PlayerPokemon(this.scene, species, this.level, this.abilityIndex, formIndex, this.gender, this.shiny, this.ivs, this);
|
||||
const ret = new PlayerPokemon(this.scene, species, this.level, this.abilityIndex, formIndex, this.gender, this.shiny, this.ivs, this);
|
||||
ret.loadAssets().then(() => resolve(ret));
|
||||
});
|
||||
}
|
||||
|
||||
evolve(evolution: SpeciesEvolution): Promise<void> {
|
||||
return new Promise(resolve => {
|
||||
this.pauseEvolutions = false;
|
||||
this.handleSpecialEvolutions(evolution);
|
||||
this.species = getPokemonSpecies(evolution.speciesId);
|
||||
if (evolution.preFormKey !== null)
|
||||
|
|
|
@ -25,6 +25,7 @@ export default class PokemonData {
|
|||
public moveset: PokemonMove[];
|
||||
public status: Status;
|
||||
public winCount: integer;
|
||||
public pauseEvolutions: boolean;
|
||||
public pokerus: boolean;
|
||||
|
||||
public fusionSpecies: Species;
|
||||
|
@ -52,6 +53,7 @@ export default class PokemonData {
|
|||
this.stats = source.stats;
|
||||
this.ivs = source.ivs;
|
||||
this.winCount = source.winCount;
|
||||
this.pauseEvolutions = !!source.pauseEvolutions;
|
||||
this.pokerus = !!source.pokerus;
|
||||
|
||||
this.fusionSpecies = sourcePokemon ? sourcePokemon.fusionSpecies?.speciesId : source.fusionSpecies;
|
||||
|
|
|
@ -11,6 +11,7 @@ import { Moves, allMoves } from "../data/move";
|
|||
import { getGenderColor, getGenderSymbol } from "../data/gender";
|
||||
import { StatusEffect } from "../data/status-effect";
|
||||
import PokemonIconAnimHandler, { PokemonIconAnimMode } from "./pokemon-icon-anim-handler";
|
||||
import { pokemonEvolutions } from "../data/pokemon-evolutions";
|
||||
|
||||
const defaultMessage = 'Choose a Pokémon.';
|
||||
|
||||
|
@ -36,6 +37,7 @@ export enum PartyOption {
|
|||
TRANSFER,
|
||||
SPLICE,
|
||||
SUMMARY,
|
||||
UNPAUSE_EVO,
|
||||
RELEASE,
|
||||
SCROLL_UP = 1000,
|
||||
SCROLL_DOWN = 1001,
|
||||
|
@ -223,7 +225,7 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
}
|
||||
ui.playSelect();
|
||||
return true;
|
||||
} else if ((option !== PartyOption.SUMMARY && option !== PartyOption.RELEASE && option !== PartyOption.CANCEL)
|
||||
} else if ((option !== PartyOption.SUMMARY && option !== PartyOption.UNPAUSE_EVO && option !== PartyOption.RELEASE && option !== PartyOption.CANCEL)
|
||||
|| (option === PartyOption.RELEASE && this.partyUiMode === PartyUiMode.RELEASE)) {
|
||||
let filterResult: string;
|
||||
if (option !== PartyOption.TRANSFER && option !== PartyOption.SPLICE) {
|
||||
|
@ -270,6 +272,11 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
ui.playSelect();
|
||||
ui.setModeWithoutClear(Mode.SUMMARY, pokemon).then(() => this.clearOptions());
|
||||
return true;
|
||||
} else if (option === PartyOption.UNPAUSE_EVO) {
|
||||
this.clearOptions();
|
||||
ui.playSelect();
|
||||
pokemon.pauseEvolutions = false;
|
||||
this.showText(`Evolutions have been unpaused for ${pokemon.name}.`, null, () => this.showText(null, 0), null, true);
|
||||
} else if (option === PartyOption.RELEASE) {
|
||||
this.clearOptions();
|
||||
ui.playSelect();
|
||||
|
@ -538,6 +545,9 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
|
||||
this.options.push(PartyOption.SUMMARY);
|
||||
|
||||
if (pokemon.pauseEvolutions && pokemonEvolutions.hasOwnProperty(pokemon.species.speciesId))
|
||||
this.options.push(PartyOption.UNPAUSE_EVO);
|
||||
|
||||
if (this.partyUiMode === PartyUiMode.SWITCH)
|
||||
this.options.push(PartyOption.RELEASE);
|
||||
} else if (this.partyUiMode === PartyUiMode.MOVE_MODIFIER) {
|
||||
|
@ -589,6 +599,9 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
case PartyOption.MOVE_4:
|
||||
optionName = pokemon.moveset[option - PartyOption.MOVE_1].getName();
|
||||
break;
|
||||
case PartyOption.UNPAUSE_EVO:
|
||||
optionName = 'Unpause Evo.';
|
||||
break;
|
||||
default:
|
||||
optionName = Utils.toReadableString(PartyOption[option]);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue