mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-10-30 07:56:07 +01:00
* Move phase types out of phase interceptor * Create isXPhase method and add properties to each phase * Replace instanceof phase with isXPhase * Fix missing union types for phaseName * Update doc comment in phase.ts * Fix incomplete comment in encounter-phase * Make phaseName as public and fix more uses * Move phaseName property declaration before constructor in move anim phase Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Rename isXPhase to is --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import { globalScene } from "#app/global-scene";
|
|
import { fixedInt } from "#app/utils/common";
|
|
import { BattlePhase } from "./battle-phase";
|
|
|
|
export class PartyHealPhase extends BattlePhase {
|
|
public readonly phaseName = "PartyHealPhase";
|
|
private resumeBgm: boolean;
|
|
|
|
constructor(resumeBgm: boolean) {
|
|
super();
|
|
|
|
this.resumeBgm = resumeBgm;
|
|
}
|
|
|
|
start() {
|
|
super.start();
|
|
|
|
const bgmPlaying = globalScene.isBgmPlaying();
|
|
if (bgmPlaying) {
|
|
globalScene.fadeOutBgm(1000, false);
|
|
}
|
|
globalScene.ui.fadeOut(1000).then(() => {
|
|
for (const pokemon of globalScene.getPlayerParty()) {
|
|
pokemon.hp = pokemon.getMaxHp();
|
|
pokemon.resetStatus(true, false, false, true);
|
|
for (const move of pokemon.moveset) {
|
|
move.ppUsed = 0;
|
|
}
|
|
pokemon.updateInfo(true);
|
|
}
|
|
const healSong = globalScene.playSoundWithoutBgm("heal");
|
|
globalScene.time.delayedCall(fixedInt(healSong.totalDuration * 1000), () => {
|
|
healSong.destroy();
|
|
if (this.resumeBgm && bgmPlaying) {
|
|
globalScene.playBgm();
|
|
}
|
|
globalScene.ui.fadeIn(500).then(() => this.end());
|
|
});
|
|
});
|
|
globalScene.arena.playerTerasUsed = 0;
|
|
}
|
|
}
|