From c8db3bff4cd81f34069279e95f960c3a240a3dea Mon Sep 17 00:00:00 2001 From: Teju Rajbabu Date: Tue, 25 Jun 2024 13:48:48 -0400 Subject: [PATCH] [QOL] UI Improvement - Shiny Icon (#2372) * Test changes to change variant label color based on Tint * Revert "Test changes to change variant label" This reverts commit 0ad0f6293050cc5d3552fb996dc68c05f55afc1c. * minimal recovery changes * Finalized recovery and implemented ShinyIcon * add setY in MockSprite * added back some unintentional removed code * added shiny_icons * Initial test for tier change * implemented Shiny Icon full functionality * slight setY change for non-Base starters --- public/images/ui/shiny_icons.json | 78 ++++++++++++++++++ public/images/ui/shiny_icons.png | Bin 0 -> 296 bytes src/data/variant.ts | 13 +++ src/enums/variant-tier.ts | 5 ++ src/loading-scene.ts | 1 + .../utils/mocks/mocksContainer/mockSprite.ts | 4 + src/ui/settings/shiny_icons.json | 41 +++++++++ src/ui/starter-select-ui-handler.ts | 54 +++++++----- 8 files changed, 176 insertions(+), 20 deletions(-) create mode 100644 public/images/ui/shiny_icons.json create mode 100644 public/images/ui/shiny_icons.png create mode 100644 src/enums/variant-tier.ts create mode 100644 src/ui/settings/shiny_icons.json diff --git a/public/images/ui/shiny_icons.json b/public/images/ui/shiny_icons.json new file mode 100644 index 00000000000..698b5b96e72 --- /dev/null +++ b/public/images/ui/shiny_icons.json @@ -0,0 +1,78 @@ +{ + "textures": [ + { + "image": "shiny_icons.png", + "format": "RGBA8888", + "size": { + "w": 15, + "h": 14 + }, + "scale": 1, + "frames": [ + { + "filename": "0", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 15, + "h": 14 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 15, + "h": 14 + }, + "frame": { + "x": 0, + "y": 0, + "w": 15, + "h": 14 + } + }, + { + "filename": "1", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 15, + "h": 14 + }, + "spriteSourceSize": { + "x": 15, + "y": 0, + "w": 15, + "h": 14 + }, + "frame": { + "x": 15, + "y": 0, + "w": 15, + "h": 14 + } + }, + { + "filename": "2", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 15, + "h": 14 + }, + "spriteSourceSize": { + "x": 30, + "y": 0, + "w": 15, + "h": 14 + }, + "frame": { + "x": 30, + "y": 0, + "w": 15, + "h": 14 + } + } + ] + } + ] +} diff --git a/public/images/ui/shiny_icons.png b/public/images/ui/shiny_icons.png new file mode 100644 index 0000000000000000000000000000000000000000..f601d908d32be506973df5953a379719c9b3277c GIT binary patch literal 296 zcmeAS@N?(olHy`uVBq!ia0vp^xNn{1`ISV`@iy0V%N?S*!ZXd+mq822<^W<4xD-4YNG|qtaSZYB zzB=VLUxNaV^Tq%F)3+{BNxrsFuw$Nhd1j%`F_Z4M4G)v|lt29(eqv#D9_y4@uOdVC zU&+aTvFxML0h7Z)7B&lfs@nPX3M`YHwrWvXmE%^i1b ietfxbfd5Z$&@D#ski`!|Z`9U c.setVisible(false)); - this.pokemonFormText.setY(25); } else if (species.speciesId === Species.ETERNATUS) { this.pokemonHatchedIcon.setVisible(false); this.pokemonHatchedCountText.setVisible(false); } else { this.pokemonCaughtHatchedContainer.setY(25); + this.pokemonShinyIcon.setY(117); this.pokemonCandyIcon.setTint(argbFromRgba(Utils.rgbHexToRgba(colorScheme[0]))); this.pokemonCandyIcon.setVisible(true); this.pokemonCandyOverlayIcon.setTint(argbFromRgba(Utils.rgbHexToRgba(colorScheme[1]))); @@ -2070,8 +2090,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler { this.pokemonCandyCountText.setText(`x${this.scene.gameData.starterData[species.speciesId].candyCount}`); this.pokemonCandyCountText.setVisible(true); this.pokemonFormText.setVisible(true); - this.pokemonFormText.setY(42); this.pokemonHatchedIcon.setVisible(true); + this.pokemonShinyIcon.setVisible(true); this.pokemonHatchedCountText.setVisible(true); let currentFriendship = this.scene.gameData.starterData[this.lastSpecies.speciesId].friendship; @@ -2124,17 +2144,9 @@ export default class StarterSelectUiHandler extends MessageUiHandler { this.setSpeciesDetails(species, props.shiny, props.formIndex, props.female, props.variant, this.starterAbilityIndexes[starterIndex], this.starterNatures[starterIndex]); } else { const defaultDexAttr = this.scene.gameData.getSpeciesDefaultDexAttr(species, false, true); - const defaultAbilityIndex = starterAttributes?.ability ?? this.scene.gameData.getStarterSpeciesDefaultAbilityIndex(species); - // load default nature from stater save data, if set - const defaultNature = starterAttributes?.nature || this.scene.gameData.getSpeciesDefaultNature(species); + const defaultAbilityIndex = this.scene.gameData.getStarterSpeciesDefaultAbilityIndex(species); + const defaultNature = this.scene.gameData.getSpeciesDefaultNature(species); props = this.scene.gameData.getSpeciesDexAttrProps(species, defaultDexAttr); - if (!isNaN(starterAttributes?.variant)) { - if (props.shiny = (starterAttributes.variant >= 0)) { - props.variant = starterAttributes.variant as Variant; - } - } - props.formIndex = starterAttributes?.form ?? props.formIndex; - props.female = starterAttributes?.female ?? props.female; this.setSpeciesDetails(species, props.shiny, props.formIndex, props.female, props.variant, defaultAbilityIndex, defaultNature); } @@ -2197,6 +2209,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler { } } + + setSpeciesDetails(species: PokemonSpecies, shiny: boolean, formIndex: integer, female: boolean, variant: Variant, abilityIndex: integer, natureIndex: integer, forSeen: boolean = false): void { const oldProps = species ? this.scene.gameData.getSpeciesDexAttrProps(species, this.dexAttrCursor) : null; const oldAbilityIndex = this.abilityCursor > -1 ? this.abilityCursor : this.scene.gameData.getStarterSpeciesDefaultAbilityIndex(species);