diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index ab24d5bd867..4b77ec44601 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -917,7 +917,7 @@ export class EncoreTag extends MoveRestrictionBattlerTag { public moveId: Moves; constructor(sourceId: number) { - super(BattlerTagType.ENCORE, BattlerTagLapseType.AFTER_MOVE, 3, Moves.ENCORE, sourceId); + super(BattlerTagType.ENCORE, [ BattlerTagLapseType.PRE_MOVE, BattlerTagLapseType.AFTER_MOVE ], 3, Moves.ENCORE, sourceId); } /** @@ -973,6 +973,24 @@ export class EncoreTag extends MoveRestrictionBattlerTag { } } + /** + * If the encored move has run out of PP, Encore ends early. Otherwise, Encore lapses based on the AFTER_MOVE battler tag lapse type. + * @param pokemon + * @param lapseType + * @returns `true` to persist | `false` to end and be removed + */ + override lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean { + if (lapseType === BattlerTagLapseType.PRE_MOVE) { + const encoredMove = pokemon.getMoveset().find(m => m?.moveId === this.moveId); + if (encoredMove && encoredMove?.getPpRatio() > 0) { + return true; + } + return false; + } else { + return super.lapse(pokemon, lapseType); + } + } + /** * Checks if the move matches the moveId stored within the tag and returns a boolean value * @param move {@linkcode Moves} the move selected