diff --git a/public/images/ui/candy.png b/public/images/ui/candy.png new file mode 100644 index 000000000..6b633a195 Binary files /dev/null and b/public/images/ui/candy.png differ diff --git a/public/images/ui/candy_overlay.png b/public/images/ui/candy_overlay.png new file mode 100644 index 000000000..835cfccb0 Binary files /dev/null and b/public/images/ui/candy_overlay.png differ diff --git a/public/images/ui/legacy/candy.png b/public/images/ui/legacy/candy.png new file mode 100644 index 000000000..6b633a195 Binary files /dev/null and b/public/images/ui/legacy/candy.png differ diff --git a/public/images/ui/legacy/candy_overlay.png b/public/images/ui/legacy/candy_overlay.png new file mode 100644 index 000000000..835cfccb0 Binary files /dev/null and b/public/images/ui/legacy/candy_overlay.png differ diff --git a/src/loading-scene.ts b/src/loading-scene.ts index 05b6c9f50..88e60fb9c 100644 --- a/src/loading-scene.ts +++ b/src/loading-scene.ts @@ -31,6 +31,8 @@ export class LoadingScene extends SceneBase { this.loadAtlas('bg', 'ui'); this.loadImage('command_fight_labels', 'ui'); this.loadAtlas('prompt', 'ui'); + this.loadImage('candy', 'ui'); + this.loadImage('candy_overlay', 'ui'); this.loadImage('cursor', 'ui'); this.loadImage('cursor_reverse', 'ui'); for (let wv of Utils.getEnumValues(WindowVariant)) { diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index 7776e2178..ee514665d 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -1,8 +1,10 @@ -import BattleScene, { Button } from "../battle-scene"; +import BattleScene, { Button, starterColors } from "../battle-scene"; import { Mode } from "./ui"; import UiHandler from "./ui-handler"; import * as Utils from "../utils"; import { PlayerPokemon } from "../field/pokemon"; +import { default as PokemonSpecies, PokemonSpeciesForm, SpeciesFormKey, getFusedSpeciesName, getPokemonSpecies, getPokemonSpeciesForm, getStarterValueFriendshipCap, speciesStarters, starterPassiveAbilities } from '../data/pokemon-species'; +import { argbFromRgba } from "@material/material-color-utilities"; import { Type, getTypeRgb } from "../data/type"; import { TextStyle, addBBCodeTextObject, addTextObject, getBBCodeFrag, getTextColor } from "./text"; import Move, { MoveCategory } from "../data/move"; @@ -44,6 +46,9 @@ export default class SummaryUiHandler extends UiHandler { private genderText: Phaser.GameObjects.Text; private shinyIcon: Phaser.GameObjects.Image; private fusionShinyIcon: Phaser.GameObjects.Image; + private candyShadow: Phaser.GameObjects.Sprite; + private candyIcon: Phaser.GameObjects.Sprite; + private candyOverlay: Phaser.GameObjects.Sprite; private statusContainer: Phaser.GameObjects.Container; private status: Phaser.GameObjects.Image; private summaryPageContainer: Phaser.GameObjects.Container; @@ -136,6 +141,20 @@ export default class SummaryUiHandler extends UiHandler { this.pokeball.setOrigin(0, 1); this.summaryContainer.add(this.pokeball); + this.candyShadow = this.scene.add.sprite(13, -140, 'candy'); + this.candyShadow.setTint(0x141414) + this.candyShadow.setScale(0.8); + this.candyShadow.setInteractive(new Phaser.Geom.Rectangle(0, 0, 16, 16), Phaser.Geom.Rectangle.Contains); + this.summaryContainer.add(this.candyShadow); + + this.candyIcon = this.scene.add.sprite(13, -140, 'candy'); + this.candyIcon.setScale(0.8); + this.summaryContainer.add(this.candyIcon); + + this.candyOverlay = this.scene.add.sprite(13, -140, 'candy_overlay'); + this.candyOverlay.setScale(0.8); + this.summaryContainer.add(this.candyOverlay); + this.levelText = addTextObject(this.scene, 36, -17, '', TextStyle.SUMMARY_ALT); this.levelText.setOrigin(0, 1); this.summaryContainer.add(this.levelText); @@ -222,6 +241,10 @@ export default class SummaryUiHandler extends UiHandler { this.shinyOverlay.setVisible(this.pokemon.isShiny()); + const colorScheme = starterColors[this.pokemon.species.getRootSpeciesId()]; + this.candyIcon.setTint(argbFromRgba(Utils.rgbHexToRgba(colorScheme[0]))); + this.candyOverlay.setTint(argbFromRgba(Utils.rgbHexToRgba(colorScheme[1]))); + this.numberText.setText(Utils.padInt(this.pokemon.species.speciesId, 4)); this.numberText.setColor(this.getTextColor(!this.pokemon.isShiny() ? TextStyle.SUMMARY : TextStyle.SUMMARY_GOLD)); this.numberText.setShadowColor(this.getTextColor(!this.pokemon.isShiny() ? TextStyle.SUMMARY : TextStyle.SUMMARY_GOLD, true)); @@ -251,6 +274,21 @@ export default class SummaryUiHandler extends UiHandler { this.splicedIcon.on('pointerout', () => (this.scene as BattleScene).ui.hideTooltip()); } + var currentFriendship = this.scene.gameData.starterData[this.pokemon.species.getRootSpeciesId()].friendship; + if (!currentFriendship || currentFriendship === undefined) + currentFriendship = 0; + + const friendshipCap = getStarterValueFriendshipCap(speciesStarters[this.pokemon.species.getRootSpeciesId()]); + const candyCropY = 16 - (16 * (currentFriendship / friendshipCap)); + + if (this.candyShadow.visible) { + this.candyShadow.on('pointerover', () => (this.scene as BattleScene).ui.showTooltip(null, `${currentFriendship}/${friendshipCap}`, true)); + this.candyShadow.on('pointerout', () => (this.scene as BattleScene).ui.hideTooltip()); + } + + this.candyIcon.setCrop(0,candyCropY,16, 16); + this.candyOverlay.setCrop(0,candyCropY,16, 16); + const doubleShiny = isFusion && this.pokemon.shiny && this.pokemon.fusionShiny; const baseVariant = !doubleShiny ? this.pokemon.getVariant() : this.pokemon.variant;