Fixing Confusion triggering after Sleep, Paralysis, and Recharging (#44)
* Recharge checked earlier, Move Tags not checked if move cancelled Recharge is now checked at the start of doMove to determine if other Tags need to be checked or if the pokemon is recharging. If the move is already cancelled, Move lapse tags are no longer checked (To account for Sleep/Paralyze happening before hand, so confusion would never trigger) * PRE_MOVE Lapse added for Recharge, Recharge now cancels Added a PRE_MOVE Identifier for Recharge specifically, which now cancels the move and shifts the move queue (since this will no longer occur in doMove. This prevents Confusion/Infatuation from also being triggered after a Pokemon is recharging. * Changed spacingpull/45/head
parent
5b2925cf85
commit
314b7dba43
|
@ -17,6 +17,7 @@ import { BattleStat } from "./battle-stat";
|
||||||
export enum BattlerTagLapseType {
|
export enum BattlerTagLapseType {
|
||||||
FAINT,
|
FAINT,
|
||||||
MOVE,
|
MOVE,
|
||||||
|
PRE_MOVE,
|
||||||
AFTER_MOVE,
|
AFTER_MOVE,
|
||||||
MOVE_EFFECT,
|
MOVE_EFFECT,
|
||||||
TURN_END,
|
TURN_END,
|
||||||
|
@ -77,7 +78,7 @@ export interface TerrainBattlerTag {
|
||||||
|
|
||||||
export class RechargingTag extends BattlerTag {
|
export class RechargingTag extends BattlerTag {
|
||||||
constructor(sourceMove: Moves) {
|
constructor(sourceMove: Moves) {
|
||||||
super(BattlerTagType.RECHARGING, BattlerTagLapseType.MOVE, 1, sourceMove);
|
super(BattlerTagType.RECHARGING, BattlerTagLapseType.PRE_MOVE, 1, sourceMove);
|
||||||
}
|
}
|
||||||
|
|
||||||
onAdd(pokemon: Pokemon): void {
|
onAdd(pokemon: Pokemon): void {
|
||||||
|
@ -90,7 +91,9 @@ export class RechargingTag extends BattlerTag {
|
||||||
super.lapse(pokemon, lapseType);
|
super.lapse(pokemon, lapseType);
|
||||||
|
|
||||||
pokemon.scene.queueMessage(getPokemonMessage(pokemon, ' must\nrecharge!'));
|
pokemon.scene.queueMessage(getPokemonMessage(pokemon, ' must\nrecharge!'));
|
||||||
|
(pokemon.scene.getCurrentPhase() as MovePhase).cancel();
|
||||||
|
pokemon.getMoveQueue().shift();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1042,4 +1045,4 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourc
|
||||||
default:
|
default:
|
||||||
return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId);
|
return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2023,12 +2023,14 @@ export class MovePhase extends BattlePhase {
|
||||||
});
|
});
|
||||||
|
|
||||||
const doMove = () => {
|
const doMove = () => {
|
||||||
if (!this.followUp && this.canMove()) {
|
this.pokemon.lapseTags(BattlerTagLapseType.PRE_MOVE);
|
||||||
|
|
||||||
|
if (!this.followUp && this.canMove() && !this.cancelled) {
|
||||||
this.pokemon.lapseTags(BattlerTagLapseType.MOVE);
|
this.pokemon.lapseTags(BattlerTagLapseType.MOVE);
|
||||||
if (this.cancelled) {
|
}
|
||||||
this.pokemon.pushMoveHistory({ move: Moves.NONE, result: MoveResult.FAIL });
|
if (this.cancelled) {
|
||||||
return this.end();
|
this.pokemon.pushMoveHistory({ move: Moves.NONE, result: MoveResult.FAIL });
|
||||||
}
|
return this.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
const moveQueue = this.pokemon.getMoveQueue();
|
const moveQueue = this.pokemon.getMoveQueue();
|
||||||
|
@ -4242,4 +4244,4 @@ export class TestMessagePhase extends MessagePhase {
|
||||||
constructor(scene: BattleScene, message: string) {
|
constructor(scene: BattleScene, message: string) {
|
||||||
super(scene, message, null, true);
|
super(scene, message, null, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue