mirror of
				https://github.com/pagefaultgames/pokerogue.git
				synced 2025-10-31 08:25:58 +01:00 
			
		
		
		
	* Replace various `scene` pass-arounds with global scene variable * Modify tests * Add scene back to `fade[in|out]()` calls Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> * Fix Bug Superfan ME test Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> * Re-enable fixed test Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> * Rename `gScene` to `globalScene` * Move `globalScene` to its own file to fix import/async issues * Fix `SelectModifierPhase` tests * Fix ME tests by removing `scene` from `expect()`s * Resolve merge issues * Remove tsdocs referencing `scene` params Remove missed instances of `.scene` * Remove unnecessary `globalScene` usage in `loading-scene.ts` * Fix merge conflicts * Attempt to fix circular import issue * Found the source of the import issue * Fix merge issues --------- Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com>
		
			
				
	
	
		
			41 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { globalScene } from "#app/global-scene";
 | |
| import * as Utils from "#app/utils";
 | |
| import { BattlePhase } from "./battle-phase";
 | |
| 
 | |
| export class PartyHealPhase extends BattlePhase {
 | |
|   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();
 | |
|         for (const move of pokemon.moveset) {
 | |
|             move!.ppUsed = 0; // TODO: is this bang correct?
 | |
|         }
 | |
|         pokemon.updateInfo(true);
 | |
|       }
 | |
|       const healSong = globalScene.playSoundWithoutBgm("heal");
 | |
|       globalScene.time.delayedCall(Utils.fixedInt(healSong.totalDuration * 1000), () => {
 | |
|         healSong.destroy();
 | |
|         if (this.resumeBgm && bgmPlaying) {
 | |
|           globalScene.playBgm();
 | |
|         }
 | |
|         globalScene.ui.fadeIn(500).then(() => this.end());
 | |
|       });
 | |
|     });
 | |
|   }
 | |
| }
 |