From fefc6341f6db9b09c19df149936261da0ba6b949 Mon Sep 17 00:00:00 2001 From: Paul Date: Sat, 27 Apr 2024 16:12:00 +0200 Subject: [PATCH 1/6] 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 --- src/ui/summary-ui-handler.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index 44003a7c8fc..d8fa4af91e8 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -426,11 +426,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 +460,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'); From 8cf7577ec7e64389fd9ad65a8bf886eb97650adc Mon Sep 17 00:00:00 2001 From: Paul Date: Sun, 28 Apr 2024 01:22:00 +0200 Subject: [PATCH 2/6] 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 --- src/ui/party-ui-handler.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/party-ui-handler.ts b/src/ui/party-ui-handler.ts index 30558b5bda0..14be7a17fad 100644 --- a/src/ui/party-ui-handler.ts +++ b/src/ui/party-ui-handler.ts @@ -392,13 +392,13 @@ 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 >= this.scene.currentBattle.getBattlerCount() && 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); + success = this.setCursor(this.lastCursor < 6 || this.lastCursor ? battlerCount : battlerCount); break; } } From 793d1b6f16ea3233e0b4dbd6e481ddb41a176d8b Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 30 Apr 2024 17:06:39 +0200 Subject: [PATCH 3/6] finalised the minor UI changes --- package-lock.json | 4 ++-- src/ui/party-ui-handler.ts | 15 +++++++++++---- src/ui/summary-ui-handler.ts | 37 ++++++++++++++++++++++++++++-------- 3 files changed, 42 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5521dcc86a8..ecaadf378ba 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 14be7a17fad..29a4037f12f 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 d8fa4af91e8..9250c21f7e4 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 { @@ -376,11 +383,13 @@ export default class SummaryUiHandler extends UiHandler { success = true; } } else if (button === Button.CANCEL) { - if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE) + if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE){ this.hideMoveSelect(); - else + success = true; + } else { ui.setMode(Mode.PARTY); - success = true; + success = true; + } } else { const pages = Utils.getEnumValues(Page); switch (button) { @@ -524,6 +533,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; @@ -841,6 +855,7 @@ export default class SummaryUiHandler extends UiHandler { } getSelectedMove(): Move { + console.log("selected moves") if (this.cursor !== Page.MOVES) return null; @@ -852,6 +867,7 @@ export default class SummaryUiHandler extends UiHandler { } showMoveSelect() { + console.log("show move select") this.moveSelect = true; this.extraMoveRowContainer.setVisible(true); this.selectedMoveIndex = -1; @@ -860,6 +876,7 @@ export default class SummaryUiHandler extends UiHandler { } hideMoveSelect() { + console.log("hide move select") if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE) { this.moveSelectFunction(4); return; @@ -868,6 +885,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; @@ -880,8 +903,6 @@ export default class SummaryUiHandler extends UiHandler { this.selectedMoveCursorObj.destroy(); this.selectedMoveCursorObj = null; } - - this.hideMoveEffect(); } showMoveEffect(instant?: boolean) { From c3237e816da2ad2d5e42abf901b48bbfff64b03f Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 30 Apr 2024 17:22:51 +0200 Subject: [PATCH 4/6] finalising --- src/ui/summary-ui-handler.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index 9250c21f7e4..a173d2c5da1 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -383,13 +383,11 @@ export default class SummaryUiHandler extends UiHandler { success = true; } } else if (button === Button.CANCEL) { - if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE){ + if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE) this.hideMoveSelect(); - success = true; - } else { + else ui.setMode(Mode.PARTY); - success = true; - } + success = true; } else { const pages = Utils.getEnumValues(Page); switch (button) { From 173c2a3fe68f3ce2781fd7db4ed52f86a68c8bed Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 30 Apr 2024 17:24:33 +0200 Subject: [PATCH 5/6] refactor --- src/ui/summary-ui-handler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index a173d2c5da1..efbcd5c0ca9 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -385,7 +385,7 @@ export default class SummaryUiHandler extends UiHandler { } else if (button === Button.CANCEL) { if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE) this.hideMoveSelect(); - else + else ui.setMode(Mode.PARTY); success = true; } else { From 996b672c0e21e582b030f769b29fd9c448b8508d Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 30 Apr 2024 18:31:39 +0200 Subject: [PATCH 6/6] removed console logs used for testing --- src/ui/summary-ui-handler.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index efbcd5c0ca9..cf5eb3639fd 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -853,7 +853,6 @@ export default class SummaryUiHandler extends UiHandler { } getSelectedMove(): Move { - console.log("selected moves") if (this.cursor !== Page.MOVES) return null; @@ -865,7 +864,6 @@ export default class SummaryUiHandler extends UiHandler { } showMoveSelect() { - console.log("show move select") this.moveSelect = true; this.extraMoveRowContainer.setVisible(true); this.selectedMoveIndex = -1; @@ -874,7 +872,6 @@ export default class SummaryUiHandler extends UiHandler { } hideMoveSelect() { - console.log("hide move select") if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE) { this.moveSelectFunction(4); return;