From b84a4b4ee5fde701464383c271e67fea0248f38f Mon Sep 17 00:00:00 2001 From: Benjamin Odom Date: Fri, 3 May 2024 01:46:19 -0500 Subject: [PATCH] Fix Shedinja PPused Share Fixed having Shedinja share PP usage with the Ninjask it evolved from and vice versa. The solution was to make a deep copy of each move in the moveset array rather than copying the array itself. --- src/field/pokemon.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 7720d741b20..bc51323075b 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -2473,7 +2473,7 @@ export class PlayerPokemon extends Pokemon { if (newEvolution.condition.predicate(this)) { const newPokemon = this.scene.addPlayerPokemon(this.species, this.level, this.abilityIndex, this.formIndex, undefined, this.shiny, this.variant, this.ivs, this.nature); newPokemon.natureOverride = this.natureOverride; - newPokemon.moveset = this.moveset.slice(); + newPokemon.moveset = this.copyMoveset(); newPokemon.luck = this.luck; newPokemon.fusionSpecies = this.fusionSpecies; @@ -2583,6 +2583,15 @@ export class PlayerPokemon extends Pokemon { this.updateFusionPalette(); }); } + + /** Returns a deep copy of this Pokemon's moveset array */ + copyMoveset(): PokemonMove[] { + let newMoveset = []; + this.moveset.forEach(move => + newMoveset.push(new PokemonMove(move.moveId, 0, move.ppUp, move.virtual))); + + return newMoveset; + } } export class EnemyPokemon extends Pokemon {