From 79c5b3d4f3fa5f19c147e6769b690cc2d9003723 Mon Sep 17 00:00:00 2001
From: Flashfyre <flashfireex@gmail.com>
Date: Sun, 5 Nov 2023 23:48:04 -0500
Subject: [PATCH] Inherit shininess from splices

---
 src/battle-phases.ts         | 4 ++--
 src/pokemon.ts               | 4 ++++
 src/system/game-data.ts      | 4 ++--
 src/ui/party-ui-handler.ts   | 2 +-
 src/ui/summary-ui-handler.ts | 6 +++---
 5 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/battle-phases.ts b/src/battle-phases.ts
index 4bef981a4bc..51bdd4b32a4 100644
--- a/src/battle-phases.ts
+++ b/src/battle-phases.ts
@@ -379,7 +379,7 @@ export class EncounterPhase extends BattlePhase {
     const enemyField = this.scene.getEnemyField();
 
     enemyField.forEach((enemyPokemon, e) => {
-      if (enemyPokemon.shiny)
+      if (enemyPokemon.isShiny())
         this.scene.unshiftPhase(new ShinySparklePhase(this.scene, BattlerIndex.ENEMY + e));
     });
 
@@ -670,7 +670,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
   onEnd(): void {
     const pokemon = this.getPokemon();
 
-    if (pokemon.shiny)
+    if (pokemon.isShiny())
       this.scene.unshiftPhase(new ShinySparklePhase(this.scene, pokemon.getBattlerIndex()));
 
     pokemon.resetTurnData();
diff --git a/src/pokemon.ts b/src/pokemon.ts
index 9d6a0d36d0a..7c7e2c1b088 100644
--- a/src/pokemon.ts
+++ b/src/pokemon.ts
@@ -461,6 +461,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
     return this.gender;
   }
 
+  isShiny(): boolean {
+    return this.shiny || (this.fusionSpecies && this.fusionShiny);
+  }
+
   getMoveset(ignoreOverride?: boolean): PokemonMove[] {
     if (!ignoreOverride && this.summonData?.moveset)
       return this.summonData.moveset;
diff --git a/src/system/game-data.ts b/src/system/game-data.ts
index 7e527e2a3d2..181c0a65cfa 100644
--- a/src/system/game-data.ts
+++ b/src/system/game-data.ts
@@ -365,7 +365,7 @@ export class GameData {
 
   setPokemonSpeciesCaught(pokemon: Pokemon, species: PokemonSpecies): Promise<void> {
     return new Promise<void>((resolve) => {
-      const dexEntry = this.getDexEntry(species, pokemon.shiny, pokemon.formIndex, pokemon.gender === Gender.FEMALE, pokemon.abilityIndex);
+      const dexEntry = this.getDexEntry(species, pokemon.isShiny(), pokemon.formIndex, pokemon.gender === Gender.FEMALE, pokemon.abilityIndex);
       const hasPrevolution = pokemonPrevolutions.hasOwnProperty(species.speciesId);
       if (!dexEntry.caught) {
         const newCatch = !this.getDefaultDexEntry(species);
@@ -389,7 +389,7 @@ export class GameData {
   }
 
   getPokemonDexEntry(pokemon: Pokemon) {
-    return this.getDexEntry(pokemon.species, pokemon.shiny, pokemon.formIndex, pokemon.gender === Gender.FEMALE, pokemon.abilityIndex);
+    return this.getDexEntry(pokemon.species, pokemon.isShiny(), pokemon.formIndex, pokemon.gender === Gender.FEMALE, pokemon.abilityIndex);
   }
 
   getDexEntry(species: PokemonSpecies, shiny: boolean, formIndex: integer, female: boolean, abilityIndex: integer): DexEntry {
diff --git a/src/ui/party-ui-handler.ts b/src/ui/party-ui-handler.ts
index 7524b1ee446..5a0747ac4f2 100644
--- a/src/ui/party-ui-handler.ts
+++ b/src/ui/party-ui-handler.ts
@@ -686,7 +686,7 @@ class PartySlot extends Phaser.GameObjects.Container {
       slotInfoContainer.add(statusIndicator);
     }
 
-    if (this.pokemon.shiny) {
+    if (this.pokemon.isShiny()) {
       const shinyStar = this.scene.add.image(0, 0, 'shiny_star');
       shinyStar.setOrigin(0, 0);
       shinyStar.setPositionRelative(slotName, -8, 2);
diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts
index 6795dd78e44..fd906570d6a 100644
--- a/src/ui/summary-ui-handler.ts
+++ b/src/ui/summary-ui-handler.ts
@@ -190,11 +190,11 @@ export default class SummaryUiHandler extends UiHandler {
     this.summaryContainer.setVisible(true);
     this.cursor = -1;
 
-    this.shinyOverlay.setVisible(this.pokemon.shiny);
+    this.shinyOverlay.setVisible(this.pokemon.isShiny());
 
     this.numberText.setText(Utils.padInt(this.pokemon.species.speciesId, 3));
-    this.numberText.setColor(getTextColor(!this.pokemon.shiny ? TextStyle.SUMMARY : TextStyle.SUMMARY_GOLD));
-    this.numberText.setShadowColor(getTextColor(!this.pokemon.shiny ? TextStyle.SUMMARY : TextStyle.SUMMARY_GOLD, true));
+    this.numberText.setColor(getTextColor(!this.pokemon.isShiny() ? TextStyle.SUMMARY : TextStyle.SUMMARY_GOLD));
+    this.numberText.setShadowColor(getTextColor(!this.pokemon.isShiny() ? TextStyle.SUMMARY : TextStyle.SUMMARY_GOLD, true));
 
     this.pokemonSprite.play(this.pokemon.getSpriteKey(true));
     this.pokemon.cry();