From 55dc33964739b05905613e6d41d16d3b3543e58a Mon Sep 17 00:00:00 2001 From: Nero <122359402+paulcazac@users.noreply.github.com> Date: Tue, 30 Apr 2024 18:42:20 +0200 Subject: [PATCH] Bug Fixes and QoL: Minor changes to UI related bugs (#356) * bug fix: updates move description correctly viewing the description of move slot 1 in a pokemon's move summary UI only updated the first time it was viewed per session, exiting the party UI and re-entering caused the moves in a pokemon's summary screen to not automatically populate the description box unless you moved the cursor down to move 2 and then back up to move 1 * slight logic changes to fix party UI controls when battlerCount = 2 (double battle), starting in party slot 1 and pressing DOWN -> UP -> RIGHT would move the cursor back down when it should be moving it to the right: these changes fix that * finalised the minor UI changes * finalising * refactor * removed console logs used for testing * bug fix: updates move description correctly viewing the description of move slot 1 in a pokemon's move summary UI only updated the first time it was viewed per session, exiting the party UI and re-entering caused the moves in a pokemon's summary screen to not automatically populate the description box unless you moved the cursor down to move 2 and then back up to move 1 * slight logic changes to fix party UI controls when battlerCount = 2 (double battle), starting in party slot 1 and pressing DOWN -> UP -> RIGHT would move the cursor back down when it should be moving it to the right: these changes fix that * finalised the minor UI changes * finalising * refactor * removed console logs used for testing --- package-lock.json | 4 ++-- src/ui/party-ui-handler.ts | 15 +++++++++++---- src/ui/summary-ui-handler.ts | 31 ++++++++++++++++++++++--------- 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5521dcc86..ecaadf378 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pokemon-rogue-battle", - "version": "1.0.1", + "version": "1.0.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "pokemon-rogue-battle", - "version": "1.0.1", + "version": "1.0.3", "dependencies": { "@material/material-color-utilities": "^0.2.7", "crypto-js": "^4.2.0", diff --git a/src/ui/party-ui-handler.ts b/src/ui/party-ui-handler.ts index 30558b5bd..29a4037f1 100644 --- a/src/ui/party-ui-handler.ts +++ b/src/ui/party-ui-handler.ts @@ -383,6 +383,7 @@ export default class PartyUiHandler extends MessageUiHandler { } const slotCount = this.partySlots.length; + const battlerCount = this.scene.currentBattle.getBattlerCount(); switch (button) { case Button.UP: @@ -392,14 +393,20 @@ export default class PartyUiHandler extends MessageUiHandler { success = this.setCursor(this.cursor < 6 ? this.cursor < slotCount - 1 ? this.cursor + 1 : 6 : 0); break; case Button.LEFT: - if (this.cursor >= this.scene.currentBattle.getBattlerCount() && this.cursor < 6) + if (this.cursor >= battlerCount && this.cursor <= 6) success = this.setCursor(0); break; case Button.RIGHT: - const battlerCount = this.scene.currentBattle.getBattlerCount(); - if (slotCount > battlerCount && this.cursor < battlerCount) - success = this.setCursor(this.lastCursor < 6 ? this.lastCursor || battlerCount : battlerCount); + if (slotCount === battlerCount){ + success = this.setCursor(6); 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){ + success = this.setCursor(this.lastCursor < 6 ? this.lastCursor || battlerCount : battlerCount); + break; + } } } diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index 44003a7c8..cf5eb3639 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -364,9 +364,16 @@ export default class SummaryUiHandler extends UiHandler { case Button.LEFT: this.moveSelect = false; this.setCursor(Page.STATS); - this.hideMoveEffect(); - success = true; - break; + if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE){ + this.hideMoveEffect(); + this.destroyBlinkCursor(); + success = true; + break; + } else { + this.hideMoveSelect(); + success = true; + break; + } } } } else { @@ -426,11 +433,9 @@ export default class SummaryUiHandler extends UiHandler { } setCursor(cursor: integer, overrideChanged: boolean = false): boolean { - let changed: boolean; + let changed: boolean = overrideChanged || this.moveCursor !== cursor; if (this.moveSelect) { - changed = overrideChanged || this.moveCursor !== cursor; - if (changed) { this.moveCursor = cursor; const selectedMove = this.getSelectedMove(); @@ -462,7 +467,6 @@ export default class SummaryUiHandler extends UiHandler { y: `-=${14.83 * (moveDescriptionLineCount - 3)}` }); } - } if (!this.moveCursorObj) { this.moveCursorObj = this.scene.add.sprite(-2, 0, 'summary_moves_cursor', 'highlight'); @@ -527,6 +531,11 @@ export default class SummaryUiHandler extends UiHandler { this.setCursor(0, true); this.showMoveEffect(); } + else if (this.cursor===Page.MOVES) { + this.moveCursorObj = null; + this.showMoveSelect(); + this.showMoveEffect(); + } } else this.summaryPageTransitionContainer.x -= 214; @@ -871,6 +880,12 @@ export default class SummaryUiHandler extends UiHandler { this.moveSelect = false; this.extraMoveRowContainer.setVisible(false); this.moveDescriptionText.setText(''); + + this.destroyBlinkCursor(); + this.hideMoveEffect(); + } + + destroyBlinkCursor(){ if (this.moveCursorBlinkTimer) { this.moveCursorBlinkTimer.destroy(); this.moveCursorBlinkTimer = null; @@ -883,8 +898,6 @@ export default class SummaryUiHandler extends UiHandler { this.selectedMoveCursorObj.destroy(); this.selectedMoveCursorObj = null; } - - this.hideMoveEffect(); } showMoveEffect(instant?: boolean) {