This commit is contained in:
Bertie690 2025-08-05 22:02:30 -04:00
parent ce8491f4a5
commit ba6885d289
3 changed files with 9 additions and 4 deletions

View File

@ -1261,7 +1261,7 @@ export class EncoreTag extends MoveRestrictionBattlerTag {
return false; 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; return false;
} }
@ -1318,7 +1318,7 @@ export class EncoreTag extends MoveRestrictionBattlerTag {
*/ */
override lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean { override lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
const encoredMove = pokemon.getMoveset().find(m => m.moveId === this.moveId); const encoredMove = pokemon.getMoveset().find(m => m.moveId === this.moveId);
if (isNullOrUndefined(encoredMove) || encoredMove.getPpRatio() <= 0) { if (isNullOrUndefined(encoredMove) || encoredMove.isOutOfPp()) {
return false; return false;
} }
return super.lapse(pokemon, lapseType); return super.lapse(pokemon, lapseType);

View File

@ -5711,9 +5711,9 @@ export class YawnAttr extends AddBattlerTagAttr {
return false; 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 // 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)
} }
} }
} }

View File

@ -69,6 +69,7 @@ export class PokemonMove {
this.ppUsed = Math.min(this.ppUsed + count, this.getMovePp()); this.ppUsed = Math.min(this.ppUsed + count, this.getMovePp());
} }
// TODO: Rename to `getMaxPP`
getMovePp(): number { getMovePp(): number {
return this.maxPpOverride || this.getMove().pp + this.ppUp * toDmgValue(this.getMove().pp / 5); 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(); return 1 - this.ppUsed / this.getMovePp();
} }
public isOutOfPp(): boolean {
return this.ppUsed < this.getMovePp();
}
getName(): string { getName(): string {
return this.getMove().name; return this.getMove().name;
} }