diff --git a/src/data/moves/pokemon-move.ts b/src/data/moves/pokemon-move.ts index 1d8f4d8e823..44f15e67d52 100644 --- a/src/data/moves/pokemon-move.ts +++ b/src/data/moves/pokemon-move.ts @@ -93,13 +93,14 @@ export class PokemonMove { } /** - * Sets {@link ppUsed} for this move and ensures the value does not exceed {@link getMovePp} - * @param count Amount of PP to use + * Consume up to `count` PP from this move (up to its maximum PP). + * @param count - (Default `1`) The amount of PP to use */ - usePp(count = 1) { + public usePp(count = 1): void { this.ppUsed = Math.min(this.ppUsed + count, this.getMovePp()); } + // TODO: Rename to `getMaxPP`; the current name is obscure and frankly stupid getMovePp(): number { return this.maxPpOverride || this.getMove().pp + this.ppUp * toDmgValue(this.getMove().pp / 5); } @@ -108,6 +109,14 @@ export class PokemonMove { return 1 - this.ppUsed / this.getMovePp(); } + /** + * @returns Whether this move is out of PP. + */ + // TODO: Replace checks comparing `getPpRatio` with 0 to use this instead + public isOutOfPp(): boolean { + return this.getMovePp() !== -1 && this.ppUsed >= this.getMovePp(); + } + getName(): string { return this.getMove().name; }