mirror of
				https://github.com/pagefaultgames/pokerogue.git
				synced 2025-10-31 00:15:59 +01:00 
			
		
		
		
	* Extract Mode enum out of UI and into its own file Reduces circular imports from 909 to 773 * Move around utility files Reduces cyclical dependencies from 773 to 765 * Remove starterColors and bypassLogin from battle-scene Reduces cyclical dependencies from 765 to 623 * Fix test runner error * Update import for bypassLogin in test * Update mocks for utils in tests * Fix broken tests * Update selectWithTera override * Update path for utils in ab-attr.ts * Update path for utils in ability-class.ts * Fix utils import path in healer.test.ts
		
			
				
	
	
		
			45 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { globalScene } from "#app/global-scene";
 | |
| import { getPokemonNameWithAffix } from "#app/messages";
 | |
| import { ExpBoosterModifier } from "#app/modifier/modifier";
 | |
| import i18next from "i18next";
 | |
| import { NumberHolder } from "#app/utils/common";
 | |
| import { PlayerPartyMemberPokemonPhase } from "./player-party-member-pokemon-phase";
 | |
| import { LevelUpPhase } from "./level-up-phase";
 | |
| 
 | |
| export class ExpPhase extends PlayerPartyMemberPokemonPhase {
 | |
|   private expValue: number;
 | |
| 
 | |
|   constructor(partyMemberIndex: number, expValue: number) {
 | |
|     super(partyMemberIndex);
 | |
| 
 | |
|     this.expValue = expValue;
 | |
|   }
 | |
| 
 | |
|   start() {
 | |
|     super.start();
 | |
| 
 | |
|     const pokemon = this.getPokemon();
 | |
|     const exp = new NumberHolder(this.expValue);
 | |
|     globalScene.applyModifiers(ExpBoosterModifier, true, exp);
 | |
|     exp.value = Math.floor(exp.value);
 | |
|     globalScene.ui.showText(
 | |
|       i18next.t("battle:expGain", {
 | |
|         pokemonName: getPokemonNameWithAffix(pokemon),
 | |
|         exp: exp.value,
 | |
|       }),
 | |
|       null,
 | |
|       () => {
 | |
|         const lastLevel = pokemon.level;
 | |
|         pokemon.addExp(exp.value);
 | |
|         const newLevel = pokemon.level;
 | |
|         if (newLevel > lastLevel) {
 | |
|           globalScene.unshiftPhase(new LevelUpPhase(this.partyMemberIndex, lastLevel, newLevel));
 | |
|         }
 | |
|         pokemon.updateInfo().then(() => this.end());
 | |
|       },
 | |
|       null,
 | |
|       true,
 | |
|     );
 | |
|   }
 | |
| }
 |