fix leppa berry logic

pull/232/head
Luc 2024-05-08 23:42:53 -04:00
parent 83663bc252
commit c15e4bd33c
1 changed files with 5 additions and 3 deletions

View File

@ -149,9 +149,11 @@ export function getBerryEffectFunc(berryType: BerryType): BerryEffectFunc {
return (pokemon: Pokemon) => { return (pokemon: Pokemon) => {
if (pokemon.battleData) if (pokemon.battleData)
pokemon.battleData.berriesEaten.push(berryType); pokemon.battleData.berriesEaten.push(berryType);
const ppRestoreMove = pokemon.getMoveset().find(m => !m.getPpRatio()); const ppRestoreMove = pokemon.getMoveset().find(m => !m.getPpRatio()) ? pokemon.getMoveset().find(m => !m.getPpRatio()) : pokemon.getMoveset().find(m => m.getPpRatio() < 1);
ppRestoreMove.ppUsed = Math.max(ppRestoreMove.ppUsed - 10, 0); if(ppRestoreMove !== undefined){
pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` restored PP to its move ${ppRestoreMove.getName()}\nusing its ${getBerryName(berryType)}!`)); ppRestoreMove.ppUsed = Math.max(ppRestoreMove.ppUsed - 10, 0);
pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` restored PP to its move ${ppRestoreMove.getName()}\nusing its ${getBerryName(berryType)}!`));
}
}; };
} }
} }