Fix Charge Move Infinites (#741)
Fixed an issue where two turn charge moves could be paused by status or Truant causing some infinite sequences if not careful.pull/723/head^2
parent
28c75e4377
commit
ae7c1ef4f0
|
@ -731,7 +731,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
const overrideArray: Array<Moves> = this.isPlayer() ? Overrides.MOVESET_OVERRIDE : Overrides.OPP_MOVESET_OVERRIDE;
|
const overrideArray: Array<Moves> = this.isPlayer() ? Overrides.MOVESET_OVERRIDE : Overrides.OPP_MOVESET_OVERRIDE;
|
||||||
if (overrideArray.length > 0) {
|
if (overrideArray.length > 0) {
|
||||||
overrideArray.forEach((move: Moves, index: number) => {
|
overrideArray.forEach((move: Moves, index: number) => {
|
||||||
const ppUsed = this.moveset[index]?.ppUp || 0;
|
const ppUsed = this.moveset[index]?.ppUsed || 0;
|
||||||
this.moveset[index] = new PokemonMove(move, Math.min(ppUsed, allMoves[move].pp))
|
this.moveset[index] = new PokemonMove(move, Math.min(ppUsed, allMoves[move].pp))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -2269,16 +2269,20 @@ const moveTarget = this.targets.length === 1
|
||||||
if (!this.followUp && this.canMove() && !this.cancelled) {
|
if (!this.followUp && this.canMove() && !this.cancelled) {
|
||||||
this.pokemon.lapseTags(BattlerTagLapseType.MOVE);
|
this.pokemon.lapseTags(BattlerTagLapseType.MOVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const moveQueue = this.pokemon.getMoveQueue();
|
||||||
if (this.cancelled || this.failed) {
|
if (this.cancelled || this.failed) {
|
||||||
if (this.failed)
|
if (this.failed)
|
||||||
this.move.usePp(ppUsed); // Only use PP if the move failed
|
this.move.usePp(ppUsed); // Only use PP if the move failed
|
||||||
|
|
||||||
|
// Record a failed move so Abilities like Truant don't trigger next turn and soft-lock
|
||||||
this.pokemon.pushMoveHistory({ move: Moves.NONE, result: MoveResult.FAIL });
|
this.pokemon.pushMoveHistory({ move: Moves.NONE, result: MoveResult.FAIL });
|
||||||
|
|
||||||
|
this.pokemon.lapseTags(BattlerTagLapseType.MOVE_EFFECT); // Remove any tags from moves like Fly/Dive/etc.
|
||||||
|
moveQueue.shift(); // Remove the second turn of charge moves
|
||||||
return this.end();
|
return this.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
const moveQueue = this.pokemon.getMoveQueue();
|
|
||||||
|
|
||||||
this.scene.triggerPokemonFormChange(this.pokemon, SpeciesFormChangePreMoveTrigger);
|
this.scene.triggerPokemonFormChange(this.pokemon, SpeciesFormChangePreMoveTrigger);
|
||||||
|
|
||||||
if (this.move.moveId)
|
if (this.move.moveId)
|
||||||
|
|
Loading…
Reference in New Issue