From 3670574342e354c4179866628e7db3f8b7483347 Mon Sep 17 00:00:00 2001 From: Jon Studders Date: Fri, 24 May 2024 20:57:02 +0100 Subject: [PATCH] Added a champion ribbon on enemy pokemon if they have a classic win. (#881) * Added a champion ribbon on enemy pokemon if they have a classic win. * Refactored to check for other non-root starterDex entities. * Check for caughtIcon, if false then move ribbon to the left. * Fixed Merge. * Bit of refactoring, added check for classic mode. * Removed random newline and removed unused import. * Removed overlapping ribbon. --- src/ui/battle-info.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ui/battle-info.ts b/src/ui/battle-info.ts index 1aebce7f457..16e23a105f8 100644 --- a/src/ui/battle-info.ts +++ b/src/ui/battle-info.ts @@ -35,6 +35,7 @@ export default class BattleInfo extends Phaser.GameObjects.Container { private nameText: Phaser.GameObjects.Text; private genderText: Phaser.GameObjects.Text; private ownedIcon: Phaser.GameObjects.Sprite; + private championRibbon: Phaser.GameObjects.Sprite; private teraIcon: Phaser.GameObjects.Sprite; private shinyIcon: Phaser.GameObjects.Sprite; private fusionShinyIcon: Phaser.GameObjects.Sprite; @@ -96,6 +97,12 @@ export default class BattleInfo extends Phaser.GameObjects.Container { this.ownedIcon.setOrigin(0, 0); this.ownedIcon.setPositionRelative(this.nameText, 0, 11.75); this.add(this.ownedIcon); + + this.championRibbon = this.scene.add.sprite(0, 0, "champion_ribbon"); + this.championRibbon.setVisible(false); + this.championRibbon.setOrigin(0, 0); + this.championRibbon.setPositionRelative(this.nameText, 11.75, 11.75); + this.add(this.championRibbon); } this.teraIcon = this.scene.add.sprite(0, 0, "icon_tera"); @@ -266,6 +273,11 @@ export default class BattleInfo extends Phaser.GameObjects.Container { const dexEntry = pokemon.scene.gameData.dexData[pokemon.species.speciesId]; this.ownedIcon.setVisible(!!dexEntry.caughtAttr); const opponentPokemonDexAttr = pokemon.getDexAttr(); + if (pokemon.scene.gameMode.isClassic) { + if(pokemon.scene.gameData.starterData[pokemon.species.getRootSpeciesId()].classicWinCount > 0 && pokemon.scene.gameData.starterData[pokemon.species.getRootSpeciesId(true)].classicWinCount > 0) { + this.championRibbon.setVisible(true); + } + } // Check if Player owns all genders and forms of the Pokemon const missingDexAttrs = ((dexEntry.caughtAttr & opponentPokemonDexAttr) < opponentPokemonDexAttr);