Added a way to see the pokemon stats in the Learn Move Phase (#286)

* Added the move category icon to the fight ui

* Added a way to see the pokemon stats in the Learn Move Phase
 -Pressing Button.LEFT now shows the stats summary page
 -Pressing Button.RIGHT goes back to move selection page

* Minor nitpicks

---------

Co-authored-by: Silvestre Emmanuel <silvestre.ramirez@wundertec.com>
Co-authored-by: Flashfyre <flashfireex@gmail.com>
This commit is contained in:
Silvestre Emmanuel 2024-04-24 23:18:23 -06:00 committed by GitHub
parent e1800e6040
commit ab8b9f0bfa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -342,6 +342,12 @@ export default class SummaryUiHandler extends UiHandler {
case Button.DOWN: case Button.DOWN:
success = this.setCursor(this.moveCursor < 4 ? this.moveCursor + 1 : 0); success = this.setCursor(this.moveCursor < 4 ? this.moveCursor + 1 : 0);
break; break;
case Button.LEFT:
this.moveSelect = false;
this.setCursor(Page.STATS);
this.hideMoveEffect();
success = true;
break;
} }
} }
} else { } else {
@ -358,6 +364,8 @@ export default class SummaryUiHandler extends UiHandler {
switch (button) { switch (button) {
case Button.UP: case Button.UP:
case Button.DOWN: case Button.DOWN:
if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE)
break;
const isDown = button === Button.DOWN; const isDown = button === Button.DOWN;
const party = this.scene.getParty(); const party = this.scene.getParty();
const partyMemberIndex = party.indexOf(this.pokemon); const partyMemberIndex = party.indexOf(this.pokemon);
@ -368,10 +376,18 @@ export default class SummaryUiHandler extends UiHandler {
} }
break; break;
case Button.LEFT: case Button.LEFT:
if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE)
break;
if (this.cursor) if (this.cursor)
success = this.setCursor(this.cursor - 1); success = this.setCursor(this.cursor - 1);
break; break;
case Button.RIGHT: case Button.RIGHT:
if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE) {
this.setCursor(Page.MOVES);
this.moveSelect = true;
success = true;
break;
}
if (this.cursor < pages.length - 1) if (this.cursor < pages.length - 1)
success = this.setCursor(this.cursor + 1); success = this.setCursor(this.cursor + 1);
break; break;
@ -387,11 +403,11 @@ export default class SummaryUiHandler extends UiHandler {
return success || error; return success || error;
} }
setCursor(cursor: integer): boolean { setCursor(cursor: integer, overrideChanged: boolean = false): boolean {
let changed: boolean; let changed: boolean;
if (this.moveSelect) { if (this.moveSelect) {
changed = this.moveCursor !== cursor; changed = overrideChanged || this.moveCursor !== cursor;
if (changed) { if (changed) {
this.moveCursor = cursor; this.moveCursor = cursor;
@ -449,7 +465,6 @@ export default class SummaryUiHandler extends UiHandler {
}); });
} }
}); });
if (this.selectedMoveIndex > -1) { if (this.selectedMoveIndex > -1) {
if (!this.selectedMoveCursorObj) { if (!this.selectedMoveCursorObj) {
this.selectedMoveCursorObj = this.scene.add.sprite(-2, 0, 'summary_moves_cursor', 'select'); this.selectedMoveCursorObj = this.scene.add.sprite(-2, 0, 'summary_moves_cursor', 'select');
@ -482,8 +497,15 @@ export default class SummaryUiHandler extends UiHandler {
x: forward ? '-=214' : '+=214', x: forward ? '-=214' : '+=214',
duration: 250, duration: 250,
onComplete: () => { onComplete: () => {
if (forward) if (forward){
this.populatePageContainer(this.summaryPageContainer); this.populatePageContainer(this.summaryPageContainer);
if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE) {
this.moveCursorObj = null;
this.extraMoveRowContainer.setVisible(true);
this.setCursor(0, true);
this.showMoveEffect();
}
}
else else
this.summaryPageTransitionContainer.x -= 214; this.summaryPageTransitionContainer.x -= 214;
this.summaryPageTransitionContainer.setVisible(false); this.summaryPageTransitionContainer.setVisible(false);
@ -699,6 +721,7 @@ export default class SummaryUiHandler extends UiHandler {
this.extraMoveRowContainer.add(extraRowText); this.extraMoveRowContainer.add(extraRowText);
if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE) { if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE) {
this.extraMoveRowContainer.setVisible(true);
const newMoveTypeIcon = this.scene.add.sprite(0, 0, 'types', Type[this.newMove.type].toLowerCase()); const newMoveTypeIcon = this.scene.add.sprite(0, 0, 'types', Type[this.newMove.type].toLowerCase());
newMoveTypeIcon.setOrigin(0, 1); newMoveTypeIcon.setOrigin(0, 1);
this.extraMoveRowContainer.add(newMoveTypeIcon); this.extraMoveRowContainer.add(newMoveTypeIcon);