mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-03-16 14:56:21 +00:00
- remove any `.js` extension imports - remove unncessary dynamic imports of `modifier.ts` file. The file was being imported statically & dynamically. Made it pure static - increase vite chunk-size warning limit Co-authored-by: Mumble <171087428+frutescens@users.noreply.github.com>
36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
import BattleScene from "#app/battle-scene";
|
|
import { getPokemonNameWithAffix } from "#app/messages";
|
|
import { ExpBoosterModifier } from "#app/modifier/modifier";
|
|
import i18next from "i18next";
|
|
import * as Utils from "#app/utils";
|
|
import { PlayerPartyMemberPokemonPhase } from "./player-party-member-pokemon-phase";
|
|
import { LevelUpPhase } from "./level-up-phase";
|
|
|
|
export class ExpPhase extends PlayerPartyMemberPokemonPhase {
|
|
private expValue: number;
|
|
|
|
constructor(scene: BattleScene, partyMemberIndex: integer, expValue: number) {
|
|
super(scene, partyMemberIndex);
|
|
|
|
this.expValue = expValue;
|
|
}
|
|
|
|
start() {
|
|
super.start();
|
|
|
|
const pokemon = this.getPokemon();
|
|
const exp = new Utils.NumberHolder(this.expValue);
|
|
this.scene.applyModifiers(ExpBoosterModifier, true, exp);
|
|
exp.value = Math.floor(exp.value);
|
|
this.scene.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) {
|
|
this.scene.unshiftPhase(new LevelUpPhase(this.scene, this.partyMemberIndex, lastLevel, newLevel));
|
|
}
|
|
pokemon.updateInfo().then(() => this.end());
|
|
}, null, true);
|
|
}
|
|
}
|