mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-20 14:29:28 +02:00
Replaced PRE_MOVE with CUSTOM for lapsing Encore in situations where the encored move has 0 PP
This commit is contained in:
parent
a0994c0151
commit
856c540b7e
@ -917,7 +917,7 @@ export class EncoreTag extends MoveRestrictionBattlerTag {
|
|||||||
public moveId: Moves;
|
public moveId: Moves;
|
||||||
|
|
||||||
constructor(sourceId: number) {
|
constructor(sourceId: number) {
|
||||||
super(BattlerTagType.ENCORE, [ BattlerTagLapseType.PRE_MOVE, BattlerTagLapseType.AFTER_MOVE ], 3, Moves.ENCORE, sourceId);
|
super(BattlerTagType.ENCORE, [ BattlerTagLapseType.CUSTOM, BattlerTagLapseType.AFTER_MOVE ], 3, Moves.ENCORE, sourceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -980,7 +980,7 @@ export class EncoreTag extends MoveRestrictionBattlerTag {
|
|||||||
* @returns `true` to persist | `false` to end and be removed
|
* @returns `true` to persist | `false` to end and be removed
|
||||||
*/
|
*/
|
||||||
override lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
|
override lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
|
||||||
if (lapseType === BattlerTagLapseType.PRE_MOVE) {
|
if (lapseType === BattlerTagLapseType.CUSTOM) {
|
||||||
const encoredMove = pokemon.getMoveset().find(m => m?.moveId === this.moveId);
|
const encoredMove = pokemon.getMoveset().find(m => m?.moveId === this.moveId);
|
||||||
if (encoredMove && encoredMove?.getPpRatio() > 0) {
|
if (encoredMove && encoredMove?.getPpRatio() > 0) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import BattleScene from "#app/battle-scene";
|
import BattleScene from "#app/battle-scene";
|
||||||
import { TurnCommand, BattleType } from "#app/battle";
|
import { TurnCommand, BattleType } from "#app/battle";
|
||||||
import { TrappedTag } from "#app/data/battler-tags";
|
import { BattlerTagLapseType, TrappedTag, EncoreTag } from "#app/data/battler-tags";
|
||||||
import { MoveTargetSet, getMoveTargets } from "#app/data/move";
|
import { MoveTargetSet, getMoveTargets } from "#app/data/move";
|
||||||
import { speciesStarterCosts } from "#app/data/balance/starters";
|
import { speciesStarterCosts } from "#app/data/balance/starters";
|
||||||
import { Abilities } from "#app/enums/abilities";
|
import { Abilities } from "#app/enums/abilities";
|
||||||
@ -61,6 +61,12 @@ export class CommandPhase extends FieldPhase {
|
|||||||
this.scene.currentBattle.turnCommands[this.fieldIndex] = { command: Command.FIGHT, move: { move: Moves.NONE, targets: []}, skip: true };
|
this.scene.currentBattle.turnCommands[this.fieldIndex] = { command: Command.FIGHT, move: { move: Moves.NONE, targets: []}, skip: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Checks if the Pokemon is under the effects of Encore. If so, Encore can end early if the encored move has no more PP.
|
||||||
|
const encoreTag = this.getPokemon().getTag(BattlerTagType.ENCORE) as EncoreTag;
|
||||||
|
if (encoreTag && !encoreTag.lapse(this.getPokemon(), BattlerTagLapseType.CUSTOM)) {
|
||||||
|
this.getPokemon().removeTag(BattlerTagType.ENCORE);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.scene.currentBattle.turnCommands[this.fieldIndex]?.skip) {
|
if (this.scene.currentBattle.turnCommands[this.fieldIndex]?.skip) {
|
||||||
return this.end();
|
return this.end();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user