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.
pull/414/head
Benjamin Odom 2024-05-03 01:46:19 -05:00 committed by Samuel H
parent f7b391746e
commit b84a4b4ee5
1 changed files with 10 additions and 1 deletions

View File

@ -2473,7 +2473,7 @@ export class PlayerPokemon extends Pokemon {
if (newEvolution.condition.predicate(this)) { 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); 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.natureOverride = this.natureOverride;
newPokemon.moveset = this.moveset.slice(); newPokemon.moveset = this.copyMoveset();
newPokemon.luck = this.luck; newPokemon.luck = this.luck;
newPokemon.fusionSpecies = this.fusionSpecies; newPokemon.fusionSpecies = this.fusionSpecies;
@ -2583,6 +2583,15 @@ export class PlayerPokemon extends Pokemon {
this.updateFusionPalette(); 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 { export class EnemyPokemon extends Pokemon {