Option to view Summary before adding new Pokemon to party

This commit is contained in:
Frutescens 2024-06-09 23:13:41 -07:00
parent 126174efe4
commit 489cf1df52
3 changed files with 53 additions and 5 deletions

View File

@ -4890,7 +4890,9 @@ export class AttemptCapturePhase extends PokemonPhase {
});
}
},
onComplete: () => this.catch()
onComplete: () => {
this.scene.unshiftPhase(new VictoryPhase(this.scene, this.battlerIndex)); this.catch();
}
});
};
@ -4931,7 +4933,6 @@ export class AttemptCapturePhase extends PokemonPhase {
catch() {
const pokemon = this.getPokemon() as EnemyPokemon;
this.scene.unshiftPhase(new VictoryPhase(this.scene, this.battlerIndex));
const speciesForm = !pokemon.fusionSpecies ? pokemon.getSpeciesForm() : pokemon.getFusionSpeciesForm();
@ -4991,6 +4992,12 @@ export class AttemptCapturePhase extends PokemonPhase {
this.scene.ui.showText(i18next.t("battle:partyFull", { pokemonName: pokemon.name }), null, () => {
this.scene.pokemonInfoContainer.makeRoomForConfirmUi();
this.scene.ui.setMode(Mode.CONFIRM, () => {
const newPokemon = this.scene.addPlayerPokemon(pokemon.species, pokemon.level, pokemon.abilityIndex, pokemon.formIndex, pokemon.gender, pokemon.shiny, pokemon.variant, pokemon.ivs, pokemon.nature, pokemon);
this.scene.ui.setMode(Mode.SUMMARY, newPokemon).then(() => {
this.catch();
return;
});
}, () => {
this.scene.ui.setMode(Mode.PARTY, PartyUiMode.RELEASE, this.fieldIndex, (slotIndex: integer, _option: PartyOption) => {
this.scene.ui.setMode(Mode.MESSAGE).then(() => {
if (slotIndex < 6) {

View File

@ -20,7 +20,45 @@ export default class ConfirmUiHandler extends AbstractOptionSelectUiHandler {
}
show(args: any[]): boolean {
if (args.length >= 2 && args[0] instanceof Function && args[1] instanceof Function) {
if (args.length === 3 && args[0].toString().includes("newPokemon")) {
const config: OptionSelectConfig = {
options: [
{
label: i18next.t("partyUiHandler:SUMMARY"),
handler: () => {
args[0]();
return false;
},
}, {
label: i18next.t("menu:yes"),
handler: () => {
args[1]();
return true;
}
}, {
label: i18next.t("menu:no"),
handler: () => {
args[2]();
return true;
}
}
],
delay: args.length >= 7 && args[6] !== null ? args[6] as integer : 0
};
super.show([ config ]);
this.switchCheck = args.length >= 4 && args[3] !== null && args[3] as boolean;
const xOffset = (args.length >= 5 && args[4] !== null ? args[4] as number : 0);
const yOffset = (args.length >= 6 && args[5] !== null ? args[5] as number : 0);
this.optionSelectContainer.setPosition((this.scene.game.canvas.width / 6) - 1 + xOffset, -48 + yOffset);
this.setCursor(this.switchCheck ? this.switchCheckCursor : 0);
return true;
} else if (args.length >= 2 && args[0] instanceof Function && args[1] instanceof Function) {
const config: OptionSelectConfig = {
options: [
{
@ -54,7 +92,6 @@ export default class ConfirmUiHandler extends AbstractOptionSelectUiHandler {
return true;
}
return false;
}

View File

@ -485,7 +485,11 @@ export default class SummaryUiHandler extends UiHandler {
if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE) {
this.hideMoveSelect();
} else {
ui.setMode(Mode.PARTY);
if (!ui.getMessageHandler().onActionInput) {
ui.setMode(Mode.PARTY);
} else {
ui.setMode(Mode.MESSAGE);
}
}
success = true;
} else {