fixed double phase start bug fr

This commit is contained in:
Bertie690 2025-08-08 14:10:47 -04:00
parent a691c43d33
commit 2a611da07a

View File

@ -93,18 +93,25 @@ export class PokemonHealPhase extends CommonAnimPhase {
// Only play animation if not skipped and target is not at full HP // Only play animation if not skipped and target is not at full HP
if (!this.skipAnim && !this.getPokemon().isFullHp()) { if (!this.skipAnim && !this.getPokemon().isFullHp()) {
super.start(); super.start();
} else {
this.end();
}
} }
this.heal(); // This is required as `commonAnimPhase` calls `this.end` once the animation finishes
// TODO: This is a really shitty process and i hate it
override end() {
this.heal().then(() => {
super.end();
});
} }
private heal() { private async heal() {
const pokemon = this.getPokemon(); const pokemon = this.getPokemon();
// Prevent healing off-field pokemon unless via revives // Prevent healing off-field pokemon unless via revives
// TODO: Revival effects shouldn't use this phase // TODO: Revival effects shouldn't use this phase
if (!this.revive && !pokemon.isActive(true)) { if (!this.revive && !pokemon.isActive(true)) {
super.end();
return; return;
} }
@ -112,7 +119,6 @@ export class PokemonHealPhase extends CommonAnimPhase {
const healBlock = pokemon.getTag(BattlerTagType.HEAL_BLOCK); const healBlock = pokemon.getTag(BattlerTagType.HEAL_BLOCK);
if (healBlock && this.hpHealed > 0) { if (healBlock && this.hpHealed > 0) {
globalScene.phaseManager.queueMessage(healBlock.onActivation(pokemon)); globalScene.phaseManager.queueMessage(healBlock.onActivation(pokemon));
super.end();
return; return;
} }
@ -137,7 +143,7 @@ export class PokemonHealPhase extends CommonAnimPhase {
if (this.message) { if (this.message) {
globalScene.phaseManager.queueMessage(this.message); globalScene.phaseManager.queueMessage(this.message);
} }
pokemon.updateInfo().then(() => super.end()); await pokemon.updateInfo();
} }
/** /**