[QoL] Summary Option for Caught Pokemon (#2921)
* Option to view Summary before adding new Pokemon to party * Fixed issues described by HopsWas * Adjusted makeRoomForConfirmUi to improve window spacing * Fixed ESLint issue + addressed OrangeRed review * Fixed Github pages issue * Removed duplicate unshiftPhase * Fixed phase order * Don't start from beginning of catch function * Option to view Summary before adding new Pokemon to party * Fixed issues described by HopsWas * Adjusted makeRoomForConfirmUi to improve window spacing * Fixed Github pages issue * Fixed phase order * Quick fix * This should fix the summaryOption feature without bugging confirm-ui-handler in other cases * Revert "Merge remote-tracking branch 'origin/summaryOption1' into summaryOption1" This reverts commitea7d0ce59e
, reversing changes made to4c565958da
. * Added a better conditional that reflects its source and purpose --------- Co-authored-by: Frutescens <info@laptop> Co-authored-by: AJ Fontaine <fontbane@gmail.com>
This commit is contained in:
parent
3f9f7914db
commit
26c98f4afe
|
@ -4911,7 +4911,10 @@ export class AttemptCapturePhase extends PokemonPhase {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onComplete: () => this.catch()
|
onComplete: () => {
|
||||||
|
this.scene.gameData.setPokemonCaught(pokemon);
|
||||||
|
this.catch();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4952,7 +4955,6 @@ export class AttemptCapturePhase extends PokemonPhase {
|
||||||
|
|
||||||
catch() {
|
catch() {
|
||||||
const pokemon = this.getPokemon() as EnemyPokemon;
|
const pokemon = this.getPokemon() as EnemyPokemon;
|
||||||
this.scene.unshiftPhase(new VictoryPhase(this.scene, this.battlerIndex));
|
|
||||||
|
|
||||||
const speciesForm = !pokemon.fusionSpecies ? pokemon.getSpeciesForm() : pokemon.getFusionSpeciesForm();
|
const speciesForm = !pokemon.fusionSpecies ? pokemon.getSpeciesForm() : pokemon.getFusionSpeciesForm();
|
||||||
|
|
||||||
|
@ -4978,6 +4980,7 @@ export class AttemptCapturePhase extends PokemonPhase {
|
||||||
|
|
||||||
this.scene.ui.showText(i18next.t("battle:pokemonCaught", { pokemonName: getPokemonNameWithAffix(pokemon) }), null, () => {
|
this.scene.ui.showText(i18next.t("battle:pokemonCaught", { pokemonName: getPokemonNameWithAffix(pokemon) }), null, () => {
|
||||||
const end = () => {
|
const end = () => {
|
||||||
|
this.scene.unshiftPhase(new VictoryPhase(this.scene, this.battlerIndex));
|
||||||
this.scene.pokemonInfoContainer.hide();
|
this.scene.pokemonInfoContainer.hide();
|
||||||
this.removePb();
|
this.removePb();
|
||||||
this.end();
|
this.end();
|
||||||
|
@ -5006,12 +5009,19 @@ export class AttemptCapturePhase extends PokemonPhase {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
Promise.all([pokemon.hideInfo(), this.scene.gameData.setPokemonCaught(pokemon)]).then(() => {
|
Promise.all([pokemon.hideInfo()]).then(() => {
|
||||||
if (this.scene.getParty().length === 6) {
|
if (this.scene.getParty().length === 6) {
|
||||||
const promptRelease = () => {
|
const promptRelease = () => {
|
||||||
this.scene.ui.showText(i18next.t("battle:partyFull", { pokemonName: getPokemonNameWithAffix(pokemon) }), null, () => {
|
this.scene.ui.showText(i18next.t("battle:partyFull", { pokemonName: getPokemonNameWithAffix(pokemon) }), null, () => {
|
||||||
this.scene.pokemonInfoContainer.makeRoomForConfirmUi();
|
this.scene.pokemonInfoContainer.makeRoomForConfirmUi(1, true);
|
||||||
this.scene.ui.setMode(Mode.CONFIRM, () => {
|
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, 0, SummaryUiMode.DEFAULT, () => {
|
||||||
|
this.scene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||||
|
promptRelease();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}, () => {
|
||||||
this.scene.ui.setMode(Mode.PARTY, PartyUiMode.RELEASE, this.fieldIndex, (slotIndex: integer, _option: PartyOption) => {
|
this.scene.ui.setMode(Mode.PARTY, PartyUiMode.RELEASE, this.fieldIndex, (slotIndex: integer, _option: PartyOption) => {
|
||||||
this.scene.ui.setMode(Mode.MESSAGE).then(() => {
|
this.scene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||||
if (slotIndex < 6) {
|
if (slotIndex < 6) {
|
||||||
|
@ -5026,7 +5036,7 @@ export class AttemptCapturePhase extends PokemonPhase {
|
||||||
removePokemon();
|
removePokemon();
|
||||||
end();
|
end();
|
||||||
});
|
});
|
||||||
});
|
}, "fullParty");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
promptRelease();
|
promptRelease();
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { Mode } from "./ui";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import {Button} from "#enums/buttons";
|
import {Button} from "#enums/buttons";
|
||||||
|
|
||||||
|
|
||||||
export default class ConfirmUiHandler extends AbstractOptionSelectUiHandler {
|
export default class ConfirmUiHandler extends AbstractOptionSelectUiHandler {
|
||||||
|
|
||||||
public static readonly windowWidth: integer = 48;
|
public static readonly windowWidth: integer = 48;
|
||||||
|
@ -20,7 +21,44 @@ export default class ConfirmUiHandler extends AbstractOptionSelectUiHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
show(args: any[]): boolean {
|
show(args: any[]): boolean {
|
||||||
if (args.length >= 2 && args[0] instanceof Function && args[1] instanceof Function) {
|
if (args.length === 4 && args[0] instanceof Function && args[1] instanceof Function && args[2] instanceof Function && args[3] === "fullParty") {
|
||||||
|
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 >= 8 && args[7] !== null ? args[7] as integer : 0
|
||||||
|
};
|
||||||
|
|
||||||
|
super.show([ config ]);
|
||||||
|
|
||||||
|
this.switchCheck = args.length >= 5 && args[4] !== null && args[4] as boolean;
|
||||||
|
|
||||||
|
const xOffset = (args.length >= 6 && args[5] !== null ? args[5] as number : 0);
|
||||||
|
const yOffset = (args.length >= 7 && args[6] !== null ? args[6] 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 = {
|
const config: OptionSelectConfig = {
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
|
@ -54,7 +92,6 @@ export default class ConfirmUiHandler extends AbstractOptionSelectUiHandler {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -364,13 +364,14 @@ export default class PokemonInfoContainer extends Phaser.GameObjects.Container {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
makeRoomForConfirmUi(speedMultiplier: number = 1): Promise<void> {
|
makeRoomForConfirmUi(speedMultiplier: number = 1, fromCatch: boolean = false): Promise<void> {
|
||||||
|
const xPosition = fromCatch ? this.initialX - this.infoWindowWidth - 65 : this.initialX - this.infoWindowWidth - ConfirmUiHandler.windowWidth;
|
||||||
return new Promise<void>(resolve => {
|
return new Promise<void>(resolve => {
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: this,
|
targets: this,
|
||||||
duration: Utils.fixedInt(Math.floor(150 / speedMultiplier)),
|
duration: Utils.fixedInt(Math.floor(150 / speedMultiplier)),
|
||||||
ease: "Cubic.easeInOut",
|
ease: "Cubic.easeInOut",
|
||||||
x: this.initialX - this.infoWindowWidth - ConfirmUiHandler.windowWidth,
|
x: xPosition,
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,6 +102,7 @@ export default class SummaryUiHandler extends UiHandler {
|
||||||
private moveSelect: boolean;
|
private moveSelect: boolean;
|
||||||
private moveCursor: integer;
|
private moveCursor: integer;
|
||||||
private selectedMoveIndex: integer;
|
private selectedMoveIndex: integer;
|
||||||
|
private selectCallback: Function;
|
||||||
|
|
||||||
constructor(scene: BattleScene) {
|
constructor(scene: BattleScene) {
|
||||||
super(scene, Mode.SUMMARY);
|
super(scene, Mode.SUMMARY);
|
||||||
|
@ -368,6 +369,9 @@ export default class SummaryUiHandler extends UiHandler {
|
||||||
const page = args.length < 2 ? Page.PROFILE : args[2] as Page;
|
const page = args.length < 2 ? Page.PROFILE : args[2] as Page;
|
||||||
this.hideMoveEffect(true);
|
this.hideMoveEffect(true);
|
||||||
this.setCursor(page);
|
this.setCursor(page);
|
||||||
|
if (args.length > 3) {
|
||||||
|
this.selectCallback = args[3];
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SummaryUiMode.LEARN_MOVE:
|
case SummaryUiMode.LEARN_MOVE:
|
||||||
this.newMove = args[2] as Move;
|
this.newMove = args[2] as Move;
|
||||||
|
@ -397,7 +401,7 @@ export default class SummaryUiHandler extends UiHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
const ui = this.getUi();
|
const ui = this.getUi();
|
||||||
|
const fromPartyMode = ui.handlers[Mode.PARTY].active;
|
||||||
let success = false;
|
let success = false;
|
||||||
let error = false;
|
let error = false;
|
||||||
|
|
||||||
|
@ -485,7 +489,17 @@ export default class SummaryUiHandler extends UiHandler {
|
||||||
if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE) {
|
if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE) {
|
||||||
this.hideMoveSelect();
|
this.hideMoveSelect();
|
||||||
} else {
|
} else {
|
||||||
ui.setMode(Mode.PARTY);
|
if (this.selectCallback instanceof Function) {
|
||||||
|
const selectCallback = this.selectCallback;
|
||||||
|
this.selectCallback = null;
|
||||||
|
selectCallback();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!fromPartyMode) {
|
||||||
|
ui.setMode(Mode.MESSAGE);
|
||||||
|
} else {
|
||||||
|
ui.setMode(Mode.PARTY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
success = true;
|
success = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -495,6 +509,8 @@ export default class SummaryUiHandler extends UiHandler {
|
||||||
case Button.DOWN:
|
case Button.DOWN:
|
||||||
if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE) {
|
if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE) {
|
||||||
break;
|
break;
|
||||||
|
} else if (!fromPartyMode) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
const isDown = button === Button.DOWN;
|
const isDown = button === Button.DOWN;
|
||||||
const party = this.scene.getParty();
|
const party = this.scene.getParty();
|
||||||
|
|
Loading…
Reference in New Issue