[Fix] Implemented UI suggestions and removed discard text confirmation

This commit is contained in:
Tiago Rodrigues 2025-07-09 01:58:10 +01:00
parent 2315ea5916
commit dcbe8ada04

View File

@ -367,6 +367,7 @@ export default class PartyUiHandler extends MessageUiHandler {
this.partyBg.setTexture(`party_bg${globalScene.currentBattle.double ? "_double" : ""}`); this.partyBg.setTexture(`party_bg${globalScene.currentBattle.double ? "_double" : ""}`);
} }
this.showPartyText();
this.populatePartySlots(); this.populatePartySlots();
this.partyDiscardModeButton.toggleIcon(this.partyUiMode); this.partyDiscardModeButton.toggleIcon(this.partyUiMode);
this.setCursor(0); this.setCursor(0);
@ -658,7 +659,6 @@ export default class PartyUiHandler extends MessageUiHandler {
} }
private processDiscardMenuInput(pokemon: PlayerPokemon) { private processDiscardMenuInput(pokemon: PlayerPokemon) {
const ui = this.getUi();
this.clearOptions(); this.clearOptions();
const itemModifiers = this.getTransferrableItemsFromPokemon(pokemon); const itemModifiers = this.getTransferrableItemsFromPokemon(pokemon);
@ -676,15 +676,6 @@ export default class PartyUiHandler extends MessageUiHandler {
); );
} }
if (success) {
this.showText(
i18next.t("partyUiHandler:discardItemConfirmation", { pokemonName: getPokemonNameWithAffix(pokemon) }),
);
ui.playSelect();
} else {
ui.playError();
}
return success; return success;
} }
@ -997,6 +988,7 @@ export default class PartyUiHandler extends MessageUiHandler {
ui.playSelect(); ui.playSelect();
} }
// Toggle item transfer mode to discard items or vice versa
if (this.cursor === 7) { if (this.cursor === 7) {
switch (this.partyUiMode) { switch (this.partyUiMode) {
case PartyUiMode.DISCARD: case PartyUiMode.DISCARD:
@ -1012,6 +1004,7 @@ export default class PartyUiHandler extends MessageUiHandler {
break; break;
} }
this.partyDiscardModeButton.toggleIcon(this.partyUiMode); this.partyDiscardModeButton.toggleIcon(this.partyUiMode);
this.showPartyText();
ui.playSelect(); ui.playSelect();
} }
// Pressing return button // Pressing return button
@ -1278,6 +1271,20 @@ export default class PartyUiHandler extends MessageUiHandler {
this.setCursor(0); this.setCursor(0);
} }
private showPartyText() {
switch (this.partyUiMode) {
case PartyUiMode.MODIFIER_TRANSFER:
this.showText(i18next.t("partyUiHandler:PartyTransfer"));
break;
case PartyUiMode.DISCARD:
this.showText(i18next.t("partyUiHandler:PartyDiscard"));
break;
default:
this.showText("", 0);
break;
}
}
private allowBatonModifierSwitch(): boolean { private allowBatonModifierSwitch(): boolean {
return !!( return !!(
this.partyUiMode !== PartyUiMode.FAINT_SWITCH && this.partyUiMode !== PartyUiMode.FAINT_SWITCH &&
@ -1729,7 +1736,7 @@ export default class PartyUiHandler extends MessageUiHandler {
this.eraseOptionsCursor(); this.eraseOptionsCursor();
this.partyMessageBox.setSize(262, 30); this.partyMessageBox.setSize(262, 30);
this.showText("", 0); this.showPartyText();
} }
eraseOptionsCursor() { eraseOptionsCursor() {
@ -2143,7 +2150,7 @@ class PartyDiscardModeButton extends Phaser.GameObjects.Container {
toggleIcon(partyMode: number) { toggleIcon(partyMode: number) {
switch (partyMode) { switch (partyMode) {
case PartyUiMode.DISCARD: case PartyUiMode.MODIFIER_TRANSFER:
this.transferIcon.setVisible(true); this.transferIcon.setVisible(true);
this.discardIcon.setVisible(false); this.discardIcon.setVisible(false);
this.partyDiscardPb.setVisible(true); this.partyDiscardPb.setVisible(true);
@ -2155,7 +2162,7 @@ class PartyDiscardModeButton extends Phaser.GameObjects.Container {
); );
this.transferIcon.displayWidth = this.textBox.text.length * 9 + 3; this.transferIcon.displayWidth = this.textBox.text.length * 9 + 3;
break; break;
case PartyUiMode.MODIFIER_TRANSFER: case PartyUiMode.DISCARD:
this.transferIcon.setVisible(false); this.transferIcon.setVisible(false);
this.discardIcon.setVisible(true); this.discardIcon.setVisible(true);
this.partyDiscardPb.setVisible(true); this.partyDiscardPb.setVisible(true);