mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-05 07:52:17 +02:00
Inverting order of several conditional checks (if the function always returns after seeing the summary option, may as well check for it straight away...)
This commit is contained in:
parent
3ab516c0ae
commit
b58b633b6f
@ -669,6 +669,13 @@ export default class PartyUiHandler extends MessageUiHandler {
|
||||
const ui = this.getUi();
|
||||
const option = this.options[this.optionsCursor];
|
||||
|
||||
// Button.CANCEL has no special behavior for any option
|
||||
if (button === Button.CANCEL || option === PartyOption.CANCEL) {
|
||||
this.clearOptions();
|
||||
ui.playSelect();
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO: Careful about using success for the return values here
|
||||
if (this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER) {
|
||||
success = this.processModifierTransferModeInput(button);
|
||||
@ -684,23 +691,42 @@ export default class PartyUiHandler extends MessageUiHandler {
|
||||
|
||||
if (button === Button.ACTION) {
|
||||
const pokemon = globalScene.getPlayerParty()[this.cursor];
|
||||
if (
|
||||
![
|
||||
PartyOption.SUMMARY,
|
||||
PartyOption.POKEDEX,
|
||||
PartyOption.UNPAUSE_EVOLUTION,
|
||||
PartyOption.UNSPLICE,
|
||||
PartyOption.RELEASE,
|
||||
PartyOption.CANCEL,
|
||||
PartyOption.RENAME,
|
||||
].includes(option) ||
|
||||
(option === PartyOption.RELEASE && this.partyUiMode === PartyUiMode.RELEASE)
|
||||
) {
|
||||
|
||||
if (option === PartyOption.SUMMARY) {
|
||||
return this.processSummaryOption(pokemon);
|
||||
}
|
||||
if (option === PartyOption.POKEDEX) {
|
||||
return this.processPokedexOption(pokemon);
|
||||
}
|
||||
if (option === PartyOption.UNPAUSE_EVOLUTION) {
|
||||
return this.processUnpauseEvolutionOption(pokemon);
|
||||
}
|
||||
if (option === PartyOption.UNSPLICE) {
|
||||
return this.processUnspliceOption(pokemon);
|
||||
}
|
||||
if (option === PartyOption.RENAME) {
|
||||
return this.processRenameOption(pokemon);
|
||||
}
|
||||
// TODO: Figure out why we need this edge case
|
||||
if (option === PartyOption.RELEASE && this.partyUiMode !== PartyUiMode.RELEASE) {
|
||||
return this.processReleaseOption(pokemon);
|
||||
}
|
||||
if (option === PartyOption.SELECT) {
|
||||
ui.playSelect();
|
||||
return true;
|
||||
}
|
||||
|
||||
const filterResult = this.getFilterResult(option, pokemon);
|
||||
if (filterResult === null) {
|
||||
if (filterResult) {
|
||||
this.clearOptions();
|
||||
this.showText(filterResult as string, undefined, () => this.showText("", 0), undefined, true);
|
||||
}
|
||||
|
||||
// This is always going to return
|
||||
if (this.partyUiMode !== PartyUiMode.SPLICE) {
|
||||
this.clearOptions();
|
||||
}
|
||||
|
||||
if (this.selectCallback && this.partyUiMode !== PartyUiMode.CHECK) {
|
||||
if (option === PartyOption.TRANSFER) {
|
||||
if (this.transferCursor !== this.cursor) {
|
||||
@ -726,7 +752,9 @@ export default class PartyUiHandler extends MessageUiHandler {
|
||||
}
|
||||
}
|
||||
this.clearTransfer();
|
||||
} else if (this.partyUiMode === PartyUiMode.SPLICE) {
|
||||
return true;
|
||||
}
|
||||
if (this.partyUiMode === PartyUiMode.SPLICE) {
|
||||
if (option === PartyOption.SPLICE) {
|
||||
(this.selectCallback as PartyModifierSpliceSelectCallback)(this.transferCursor, this.cursor);
|
||||
this.clearTransfer();
|
||||
@ -734,18 +762,17 @@ export default class PartyUiHandler extends MessageUiHandler {
|
||||
this.startTransfer();
|
||||
}
|
||||
this.clearOptions();
|
||||
} else if (option === PartyOption.RELEASE) {
|
||||
return true;
|
||||
}
|
||||
if (option === PartyOption.RELEASE) {
|
||||
this.doRelease(this.cursor);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
const selectCallback = this.selectCallback;
|
||||
this.selectCallback = null;
|
||||
selectCallback(this.cursor, option);
|
||||
}
|
||||
} else {
|
||||
if (
|
||||
option >= PartyOption.FORM_CHANGE_ITEM &&
|
||||
globalScene.getCurrentPhase() instanceof SelectModifierPhase
|
||||
) {
|
||||
if (option >= PartyOption.FORM_CHANGE_ITEM && globalScene.getCurrentPhase() instanceof SelectModifierPhase) {
|
||||
if (this.partyUiMode === PartyUiMode.CHECK) {
|
||||
const formChangeItemModifiers = this.getFormChangeItemsModifiers(pokemon);
|
||||
const modifier = formChangeItemModifiers[option - PartyOption.FORM_CHANGE_ITEM];
|
||||
@ -760,6 +787,7 @@ export default class PartyUiHandler extends MessageUiHandler {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
this.partyUiMode !== PartyUiMode.MODIFIER &&
|
||||
this.partyUiMode !== PartyUiMode.TM_MODIFIER &&
|
||||
@ -769,31 +797,8 @@ export default class PartyUiHandler extends MessageUiHandler {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
this.clearOptions();
|
||||
this.showText(filterResult as string, undefined, () => this.showText("", 0), undefined, true);
|
||||
} else if (option === PartyOption.SUMMARY) {
|
||||
return this.processSummaryOption(pokemon);
|
||||
} else if (option === PartyOption.POKEDEX) {
|
||||
return this.processPokedexOption(pokemon);
|
||||
} else if (option === PartyOption.UNPAUSE_EVOLUTION) {
|
||||
return this.processUnpauseEvolutionOption(pokemon);
|
||||
} else if (option === PartyOption.UNSPLICE) {
|
||||
return this.processUnspliceOption(pokemon);
|
||||
} else if (option === PartyOption.RELEASE) {
|
||||
return this.processReleaseOption(pokemon);
|
||||
} else if (option === PartyOption.RENAME) {
|
||||
return this.processRenameOption(pokemon);
|
||||
} else if (option === PartyOption.CANCEL) {
|
||||
return this.processOptionMenuInput(Button.CANCEL);
|
||||
} else if (option === PartyOption.SELECT) {
|
||||
ui.playSelect();
|
||||
return true;
|
||||
}
|
||||
} else if (button === Button.CANCEL) {
|
||||
this.clearOptions();
|
||||
ui.playSelect();
|
||||
return true;
|
||||
} else if (button === Button.UP || button === Button.DOWN) {
|
||||
|
||||
if (button === Button.UP || button === Button.DOWN) {
|
||||
success = this.moveOptionCursor(button);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user