Fixed phasemanager bugs

This commit is contained in:
Bertie690 2025-06-08 09:53:10 -04:00
parent a0bffe6114
commit be6000f590
2 changed files with 18 additions and 9 deletions

View File

@ -1036,8 +1036,11 @@ export class PowderTag extends BattlerTag {
movePhase.showMoveText(); movePhase.showMoveText();
movePhase.fail(); movePhase.fail();
globalScene.unshiftPhase( globalScene.phaseManager.unshiftNew(
new CommonAnimPhase(pokemon.getBattlerIndex(), pokemon.getBattlerIndex(), CommonAnim.POWDER), "CommonAnimPhase",
pokemon.getBattlerIndex(),
pokemon.getBattlerIndex(),
CommonAnim.POWDER,
); );
const cancelDamage = new BooleanHolder(false); const cancelDamage = new BooleanHolder(false);
@ -1047,7 +1050,7 @@ export class PowderTag extends BattlerTag {
} }
// "When the flame touched the powder\non the Pokémon, it exploded!" // "When the flame touched the powder\non the Pokémon, it exploded!"
globalScene.queueMessage(i18next.t("battlerTags:powderLapse", { moveName: move.name })); globalScene.phaseManager.queueMessage(i18next.t("battlerTags:powderLapse", { moveName: move.name }));
return true; return true;
} }
@ -1175,7 +1178,13 @@ export class EncoreTag extends MoveRestrictionBattlerTag {
const lastMove = pokemon.getLastXMoves(1)[0]; const lastMove = pokemon.getLastXMoves(1)[0];
globalScene.phaseManager.tryReplacePhase( globalScene.phaseManager.tryReplacePhase(
m => m.is("MovePhase") && m.pokemon === pokemon, m => m.is("MovePhase") && m.pokemon === pokemon,
globalScene.phaseManager.create("MovePhase", pokemon, lastMove.targets ?? [], movesetMove, MoveUseMode.NORMAL), globalScene.phaseManager.create(
"MovePhase",
pokemon,
lastMove.targets ?? [],
movesetMove,
MoveUseMode.NORMAL,
),
); );
} }
} }

View File

@ -206,7 +206,7 @@ export class MoveEffectPhase extends PokemonPhase {
"MovePhase", "MovePhase",
target, target,
newTargets, newTargets,
new PokemonMove(this.move.id, 0, 0, true), new PokemonMove(this.move.id),
MoveUseMode.REFLECTED, MoveUseMode.REFLECTED,
), ),
); );
@ -427,7 +427,7 @@ export class MoveEffectPhase extends PokemonPhase {
* unshift another MoveEffectPhase for the next strike before ending this phase. * unshift another MoveEffectPhase for the next strike before ending this phase.
*/ */
if (--user.turnData.hitsLeft >= 1 && this.getFirstTarget()) { if (--user.turnData.hitsLeft >= 1 && this.getFirstTarget()) {
globalScene.phaseManager.unshiftPhase(this.addNextHitPhase()); this.addNextHitPhase();
super.end(); super.end();
return; return;
} }
@ -439,7 +439,7 @@ export class MoveEffectPhase extends PokemonPhase {
const hitsTotal = user.turnData.hitCount - Math.max(user.turnData.hitsLeft, 0); const hitsTotal = user.turnData.hitCount - Math.max(user.turnData.hitsLeft, 0);
if (hitsTotal > 1 || user.turnData.hitsLeft > 0) { if (hitsTotal > 1 || user.turnData.hitsLeft > 0) {
// Queue message if multiple hits occurred or were slated to occur (such as a Triple Axel miss) // Queue message if multiple hits occurred or were slated to occur (such as a Triple Axel miss)
globalScene.queueMessage(i18next.t("battle:attackHitsCount", { count: hitsTotal })); globalScene.phaseManager.queueMessage(i18next.t("battle:attackHitsCount", { count: hitsTotal }));
} }
globalScene.applyModifiers(HitHealModifier, this.player, user); globalScene.applyModifiers(HitHealModifier, this.player, user);
@ -741,8 +741,8 @@ export class MoveEffectPhase extends PokemonPhase {
} }
/** /**
* Unshifts a new `MoveEffectPhase` with the same properties as this phase, * Unshifts a new `MoveEffectPhase` with the same properties as this phase.
* except with 1 fewer hit remaining * Used to queue the next hit of multi-strike moves.
*/ */
protected addNextHitPhase(): void { protected addNextHitPhase(): void {
globalScene.phaseManager.unshiftNew("MoveEffectPhase", this.battlerIndex, this.targets, this.move, this.useMode); globalScene.phaseManager.unshiftNew("MoveEffectPhase", this.battlerIndex, this.targets, this.move, this.useMode);