mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-12 03:12:18 +02:00
Added some fixes. Weird stuff going on.
This commit is contained in:
parent
865dcb5a0b
commit
f9b086eb03
@ -57,11 +57,11 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||||||
const moveLimitReached = i18next.t("battle:learnMoveLimitReached", { pokemonName: getPokemonNameWithAffix(pokemon) });
|
const moveLimitReached = i18next.t("battle:learnMoveLimitReached", { pokemonName: getPokemonNameWithAffix(pokemon) });
|
||||||
const shouldReplaceQ = i18next.t("battle:learnMoveReplaceQuestion", { moveName: move.name });
|
const shouldReplaceQ = i18next.t("battle:learnMoveReplaceQuestion", { moveName: move.name });
|
||||||
const preQText = [learnMovePrompt, moveLimitReached].join("$");
|
const preQText = [learnMovePrompt, moveLimitReached].join("$");
|
||||||
this.scene.ui.showText(preQText, null, () => {
|
this.scene.ui.showTextPromise(preQText).then(() => {
|
||||||
this.scene.ui.showText(shouldReplaceQ, null, () => {
|
this.scene.ui.showTextPromise(shouldReplaceQ, undefined, false).then(() => {
|
||||||
this.scene.ui.setModeWithoutClear(Mode.CONFIRM, () => this.forgetMoveProcess(move, pokemon), () => this.rejectMoveAndEnd(move, pokemon));
|
this.scene.ui.setModeWithoutClear(Mode.CONFIRM, () => this.forgetMoveProcess(move, pokemon), () => this.rejectMoveAndEnd(move, pokemon));
|
||||||
}, null);
|
});
|
||||||
}, null, true);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,6 +77,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||||||
this.scene.ui.setModeWithoutClear(Mode.SUMMARY, pokemon, SummaryUiMode.LEARN_MOVE, move, (moveIndex: integer) => {
|
this.scene.ui.setModeWithoutClear(Mode.SUMMARY, pokemon, SummaryUiMode.LEARN_MOVE, move, (moveIndex: integer) => {
|
||||||
if (moveIndex === 4) {
|
if (moveIndex === 4) {
|
||||||
this.scene.ui.setMode(this.messageMode).then(() => this.rejectMoveAndEnd(move, pokemon));
|
this.scene.ui.setMode(this.messageMode).then(() => this.rejectMoveAndEnd(move, pokemon));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
const forgetSuccessText = i18next.t("battle:learnMoveForgetSuccess", { pokemonName: getPokemonNameWithAffix(pokemon), moveName: pokemon.moveset[moveIndex]!.getName() });
|
const forgetSuccessText = i18next.t("battle:learnMoveForgetSuccess", { pokemonName: getPokemonNameWithAffix(pokemon), moveName: pokemon.moveset[moveIndex]!.getName() });
|
||||||
const fullText = [i18next.t("battle:countdownPoof"), forgetSuccessText, i18next.t("battle:learnMoveAnd")].join("$");
|
const fullText = [i18next.t("battle:countdownPoof"), forgetSuccessText, i18next.t("battle:learnMoveAnd")].join("$");
|
||||||
@ -92,15 +93,14 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||||||
* If the player reconsiders, it repeats the process for a Pokemon with a full moveset once again.
|
* If the player reconsiders, it repeats the process for a Pokemon with a full moveset once again.
|
||||||
*/
|
*/
|
||||||
rejectMoveAndEnd(move: Move, pokemon: Pokemon) {
|
rejectMoveAndEnd(move: Move, pokemon: Pokemon) {
|
||||||
this.scene.ui.setMode(this.messageMode);
|
|
||||||
this.scene.ui.showText(i18next.t("battle:learnMoveStopTeaching", { moveName: move.name }), null, () => {
|
this.scene.ui.showText(i18next.t("battle:learnMoveStopTeaching", { moveName: move.name }), null, () => {
|
||||||
this.scene.ui.setModeWithoutClear(Mode.CONFIRM,
|
this.scene.ui.setModeWithoutClear(Mode.CONFIRM,
|
||||||
() => {
|
() => {
|
||||||
this.scene.ui.setMode(this.messageMode);
|
this.scene.ui.setMode(this.messageMode);
|
||||||
this.scene.ui.showText(i18next.t("battle:learnMoveNotLearned", { pokemonName: getPokemonNameWithAffix(pokemon), moveName: move.name }), null, () => {
|
this.scene.ui.showText(i18next.t("battle:learnMoveNotLearned", { pokemonName: getPokemonNameWithAffix(pokemon), moveName: move.name }), null, () => {
|
||||||
this.end();
|
this.end();
|
||||||
});
|
}, null, true);
|
||||||
});
|
}, () => this.replaceMoveCheck());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,6 +286,12 @@ export default class UI extends Phaser.GameObjects.Container {
|
|||||||
return handler.processInput(button);
|
return handler.processInput(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showTextPromise(text: string, callbackDelay: number = 0, prompt: boolean = true, promptDelay?: integer | null): Promise<void> {
|
||||||
|
return new Promise<void>(resolve => {
|
||||||
|
this.showText(text ?? "", null, () => resolve(), callbackDelay, prompt, promptDelay);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
showText(text: string, delay?: integer | null, callback?: Function | null, callbackDelay?: integer | null, prompt?: boolean | null, promptDelay?: integer | null): void {
|
showText(text: string, delay?: integer | null, callback?: Function | null, callbackDelay?: integer | null, prompt?: boolean | null, promptDelay?: integer | null): void {
|
||||||
if (prompt && text.indexOf("$") > -1) {
|
if (prompt && text.indexOf("$") > -1) {
|
||||||
const messagePages = text.split(/\$/g).map(m => m.trim());
|
const messagePages = text.split(/\$/g).map(m => m.trim());
|
||||||
|
Loading…
Reference in New Issue
Block a user