From 90f0d7e72e304a7a91611b581b40876940dfb1ab Mon Sep 17 00:00:00 2001 From: Greenlamp Date: Mon, 6 May 2024 21:19:22 +0200 Subject: [PATCH] Revert "added Done button in pokemon selection menu and choosing which pokemon to replace" This reverts commit ff562af446f131c256692d8ce829e9880fbeba51. --- src/phases.ts | 6 +-- src/ui/party-ui-handler.ts | 97 +++++--------------------------------- 2 files changed, 14 insertions(+), 89 deletions(-) diff --git a/src/phases.ts b/src/phases.ts index 5e46133ed48..b966712f2be 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -1936,10 +1936,8 @@ export class SelectTargetPhase extends PokemonPhase { if (cursor === -1) { this.scene.currentBattle.turnCommands[this.fieldIndex] = null; this.scene.unshiftPhase(new CommandPhase(this.scene, this.fieldIndex)); - } else { - turnCommand.targets = [cursor]; - this.scene.hasFreeSwitch = false; - } + } else + turnCommand.targets = [ cursor ]; if (turnCommand.command === Command.BALL && this.fieldIndex) this.scene.currentBattle.turnCommands[this.fieldIndex - 1].skip = true; this.end(); diff --git a/src/ui/party-ui-handler.ts b/src/ui/party-ui-handler.ts index dc57dd9e7a1..8b497655a17 100644 --- a/src/ui/party-ui-handler.ts +++ b/src/ui/party-ui-handler.ts @@ -36,8 +36,6 @@ export enum PartyUiMode { export enum PartyOption { CANCEL = -1, SEND_OUT, - SEND_OUT_1, - SEND_OUT_2, PASS_BATON, APPLY, TEACH, @@ -53,7 +51,7 @@ export enum PartyOption { MOVE_1 = 3000, MOVE_2, MOVE_3, - MOVE_4, + MOVE_4 } export type PartySelectCallback = (cursor: integer, option: PartyOption) => void; @@ -72,7 +70,6 @@ export default class PartyUiHandler extends MessageUiHandler { private partySlotsContainer: Phaser.GameObjects.Container; private partySlots: PartySlot[]; private partyCancelButton: PartyCancelButton; - private partyDoneButton: PartyDoneButton; private partyMessageBox: Phaser.GameObjects.NineSlice; private optionsMode: boolean; @@ -156,13 +153,10 @@ export default class PartyUiHandler extends MessageUiHandler { this.message = partyMessageText; - const partyCancelButton = new PartyCancelButton(this.scene, 291, -9); - const partyDoneButton = new PartyDoneButton(this.scene, 291, -26); + const partyCancelButton = new PartyCancelButton(this.scene, 291, -16); partyContainer.add(partyCancelButton); - partyContainer.add(partyDoneButton); this.partyCancelButton = partyCancelButton; - this.partyDoneButton = partyDoneButton; this.optionsContainer = this.scene.add.container((this.scene.game.canvas.width / 6) - 1, -1); partyContainer.add(this.optionsContainer); @@ -369,9 +363,7 @@ export default class PartyUiHandler extends MessageUiHandler { ui.playSelect(); } else if (this.partyUiMode === PartyUiMode.FAINT_SWITCH) ui.playError(); - else if (this.cursor === 6) { - console.log('DONE'); - } else + else return this.processInput(Button.CANCEL); return true; } else if (button === Button.CANCEL) { @@ -398,27 +390,26 @@ export default class PartyUiHandler extends MessageUiHandler { switch (button) { case Button.UP: - if (this.cursor === 7) success = this.setCursor(6); - else success = this.setCursor(this.cursor ? this.cursor < 6 ? this.cursor - 1 : slotCount - 1 : 7); + success = this.setCursor(this.cursor ? this.cursor < 6 ? this.cursor - 1 : slotCount - 1 : 6); break; case Button.DOWN: - if (this.cursor === 6) success = this.setCursor(7); - else success = this.setCursor(this.cursor < 6 ? this.cursor < slotCount - 1 ? this.cursor + 1 : 6 : 0); + success = this.setCursor(this.cursor < 6 ? this.cursor < slotCount - 1 ? this.cursor + 1 : 6 : 0); break; case Button.LEFT: - if (this.cursor >= battlerCount && this.cursor <= 7) + if (this.cursor >= battlerCount && this.cursor <= 6) success = this.setCursor(0); break; case Button.RIGHT: if (slotCount === battlerCount){ success = this.setCursor(6); - break; + break; } else if (battlerCount >= 2 && slotCount > battlerCount && this.getCursor() === 0 && this.lastCursor === 1){ success = this.setCursor(2); break; - } else if (slotCount > battlerCount && this.cursor < battlerCount) + } else if (slotCount > battlerCount && this.cursor < battlerCount){ success = this.setCursor(this.lastCursor < 6 ? this.lastCursor || battlerCount : battlerCount); break; + } } } @@ -434,8 +425,6 @@ export default class PartyUiHandler extends MessageUiHandler { if (this.cursor < 6 && this.cursor >= party.length) this.cursor = party.length - 1; else if (this.cursor === 6) - this.partyDoneButton.select(); - else if (this.cursor === 7) this.partyCancelButton.select(); for (let p in party) { @@ -493,24 +482,12 @@ export default class PartyUiHandler extends MessageUiHandler { this.cursor = cursor; if (this.lastCursor < 6) this.partySlots[this.lastCursor].deselect(); - else if (this.lastCursor === 6){ + else if (this.lastCursor === 6) this.partyCancelButton.deselect(); - } else if (this.lastCursor === 7){ - this.partyDoneButton.deselect(); - } - if (cursor < 6) { + if (cursor < 6) this.partySlots[cursor].select(); - this.partyCancelButton.deselect(); - this.partyDoneButton.deselect(); - } - else if (cursor === 6){ - this.partyCancelButton.deselect(); - this.partyDoneButton.select(); - } - else if (cursor === 7) { - this.partyDoneButton.deselect(); + else if (cursor === 6) this.partyCancelButton.select(); - } } } @@ -590,8 +567,6 @@ export default class PartyUiHandler extends MessageUiHandler { case PartyUiMode.POST_BATTLE_SWITCH: if (this.cursor >= this.scene.currentBattle.getBattlerCount()) { this.options.push(PartyOption.SEND_OUT); - this.options.push(PartyOption.SEND_OUT_1); - this.options.push(PartyOption.SEND_OUT_2); if (this.partyUiMode !== PartyUiMode.FAINT_SWITCH && this.scene.findModifier(m => m instanceof SwitchEffectTransferModifier && (m as SwitchEffectTransferModifier).pokemonId === this.scene.getPlayerField()[this.fieldIndex].id)) @@ -1083,52 +1058,4 @@ class PartyCancelButton extends Phaser.GameObjects.Container { this.partyCancelBg.setFrame('party_cancel'); this.partyCancelPb.setFrame('party_pb'); } -} - -class PartyDoneButton extends Phaser.GameObjects.Container { - private selected: boolean; - - private partyDoneBg: Phaser.GameObjects.Sprite; - private partyDonePb: Phaser.GameObjects.Sprite; - - constructor(scene: BattleScene, x: number, y: number) { - super(scene, x, y); - - this.setup(); - } - - setup() { - const partyDoneBg = this.scene.add.sprite(0, 0, 'party_cancel'); - this.add(partyDoneBg); - - this.partyDoneBg = partyDoneBg; - - const partyDonePb = this.scene.add.sprite(-17, 0, 'party_pb'); - this.add(partyDonePb); - - this.partyDonePb = partyDonePb; - - const partyCancelText = addTextObject(this.scene, -7, -6, 'Done', TextStyle.PARTY); - this.add(partyCancelText); - } - - select() { - if (this.selected) - return; - - this.selected = true; - - this.partyDoneBg.setFrame(`party_cancel_sel`); - this.partyDonePb.setFrame('party_pb_sel'); - } - - deselect() { - if (!this.selected) - return; - - this.selected = false; - - this.partyDoneBg.setFrame('party_cancel'); - this.partyDonePb.setFrame('party_pb'); - } } \ No newline at end of file