From 3e092876ad9f5a2f54589d9d8ccbab684738af1a Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Sun, 29 Oct 2023 23:36:29 -0400 Subject: [PATCH] Add shiny indicators to starter screen --- src/ui/starter-select-ui-handler.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index 644c62547da..a5df541e53e 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -67,6 +67,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { private starterIcons: Phaser.GameObjects.Sprite[]; private genCursorObj: Phaser.GameObjects.Image; private genCursorHighlightObj: Phaser.GameObjects.Image; + private shinyIcons: Phaser.GameObjects.Image[]; private starterSelectCallback: StarterSelectCallback; @@ -204,6 +205,17 @@ export default class StarterSelectUiHandler extends MessageUiHandler { return icon; }); + this.shinyIcons = new Array(81).fill(null).map((_, i) => { + const x = (i % 9) * 18; + const y = Math.floor(i / 9) * 18; + const ret = this.scene.add.image(x + 161, y + 11, 'shiny_star'); + ret.setOrigin(0, 0); + ret.setScale(0.5); + ret.setVisible(false); + this.starterSelectContainer.add(ret); + return ret; + }); + this.pokemonSprite = this.scene.add.sprite(53, 63, `pkmn__sub`); this.starterSelectContainer.add(this.pokemonSprite); @@ -488,6 +500,11 @@ export default class StarterSelectUiHandler extends MessageUiHandler { this.starterCursorObjs[s].setVisible(this.starterGens[s] === cursor); for (let s = 0; s < this.pokerusCursorObjs.length; s++) this.pokerusCursorObjs[s].setVisible(this.pokerusGens[s] === cursor); + + const genLimit = this.genSpecies[this.genCursor].length; + for (let s = 0; s < 81; s++) { + this.shinyIcons[s].setVisible(s < genLimit && !!this.scene.gameData.getDefaultDexEntry(this.genSpecies[this.genCursor][s], true)); + } } else { changed = super.setCursor(cursor);