From ba6885d2892eb9592d0e23f8cd33231860ed2173 Mon Sep 17 00:00:00 2001 From: Bertie690 Date: Tue, 5 Aug 2025 22:02:30 -0400 Subject: [PATCH] ddd --- src/data/battler-tags.ts | 4 ++-- src/data/moves/move.ts | 4 ++-- src/data/moves/pokemon-move.ts | 5 +++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index cad8f4055e0..4b0171dbaf0 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -1261,7 +1261,7 @@ export class EncoreTag extends MoveRestrictionBattlerTag { return false; } - if (!pokemon.getMoveset().some(m => m.moveId === this.moveId && m.ppUsed > 0)) { + if (!pokemon.getMoveset().some(m => m.moveId === this.moveId && !m.isOutOfPp())) { return false; } @@ -1318,7 +1318,7 @@ export class EncoreTag extends MoveRestrictionBattlerTag { */ override lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean { const encoredMove = pokemon.getMoveset().find(m => m.moveId === this.moveId); - if (isNullOrUndefined(encoredMove) || encoredMove.getPpRatio() <= 0) { + if (isNullOrUndefined(encoredMove) || encoredMove.isOutOfPp()) { return false; } return super.lapse(pokemon, lapseType); diff --git a/src/data/moves/move.ts b/src/data/moves/move.ts index 3a5b7f080a2..8081d24a526 100644 --- a/src/data/moves/move.ts +++ b/src/data/moves/move.ts @@ -5711,9 +5711,9 @@ export class YawnAttr extends AddBattlerTagAttr { return false; } - // TODO: This displays a message for the cause and another "but it failed" message, + // TODO: This does not display the cause of the "but it failed" message, // but fixing it would require a rework of the move failure system - return target.canSetStatus(StatusEffect.SLEEP, false, false, user) + return target.canSetStatus(StatusEffect.SLEEP, true, false, user) } } } diff --git a/src/data/moves/pokemon-move.ts b/src/data/moves/pokemon-move.ts index d3f68fe9db4..2141486f10d 100644 --- a/src/data/moves/pokemon-move.ts +++ b/src/data/moves/pokemon-move.ts @@ -69,6 +69,7 @@ export class PokemonMove { this.ppUsed = Math.min(this.ppUsed + count, this.getMovePp()); } + // TODO: Rename to `getMaxPP` getMovePp(): number { return this.maxPpOverride || this.getMove().pp + this.ppUp * toDmgValue(this.getMove().pp / 5); } @@ -77,6 +78,10 @@ export class PokemonMove { return 1 - this.ppUsed / this.getMovePp(); } + public isOutOfPp(): boolean { + return this.ppUsed < this.getMovePp(); + } + getName(): string { return this.getMove().name; }