Remove level and stat caps

This commit is contained in:
Flashfyre 2024-02-29 15:25:15 -05:00
parent c275620755
commit dca8a5c529
6 changed files with 30 additions and 10 deletions

View File

@ -1126,12 +1126,10 @@ export default class BattleScene extends Phaser.Scene {
this.ui?.achvBar.setY((this.game.canvas.height / 6 + this.moneyText.y + 15));
}
getMaxExpLevel(ignoreLevelCap?: boolean): integer {
if (ignoreLevelCap)
return 10000;
getMaxExpLevel(): integer {
const lastWaveIndex = Math.ceil((this.currentBattle?.waveIndex || 1) / 10) * 10;
const baseLevel = (1 + lastWaveIndex / 2 + Math.pow(lastWaveIndex / 25, 2)) * 1.2;
return Math.min(Math.ceil(baseLevel / 2) * 2 + 2, 10000);
return Math.ceil(baseLevel / 2) * 2 + 2;
}
randomSpecies(waveIndex: integer, level: integer, fromArenaPool?: boolean, speciesFilter?: PokemonSpeciesFilter, filterAllEvolutions?: boolean): PokemonSpecies {

View File

@ -1080,7 +1080,7 @@ export class PokemonLevelIncrementModifier extends ConsumablePokemonModifier {
pokemon.scene.applyModifiers(LevelIncrementBoosterModifier, true, levelCount);
pokemon.level += levelCount.value;
if (pokemon.level <= pokemon.scene.getMaxExpLevel(true)) {
if (pokemon.level <= pokemon.scene.getMaxExpLevel()) {
pokemon.exp = getLevelTotalExp(pokemon.level, pokemon.species.growthRate);
pokemon.levelExp = 0;
}

View File

@ -542,7 +542,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
let baseStat = baseStats[s];
let value = Math.floor(((2 * baseStat + this.ivs[s]) * this.level) * 0.01);
if (isHp) {
value = Math.min(value + this.level + 10, 99999);
value = value + this.level + 10;
if (this.getAbility().hasAttr(NonSuperEffectiveImmunityAbAttr))
value = 1;
if (this.hp > value || this.hp === undefined)
@ -558,7 +558,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
this.scene.applyModifier(PokemonNatureWeightModifier, this.isPlayer(), this, natureStatMultiplier);
if (natureStatMultiplier.value !== 1)
value = Math.max(Math[natureStatMultiplier.value > 1 ? 'ceil' : 'floor'](value * natureStatMultiplier.value), 1);
value = Math.min(value, 99999);
}
this.stats[s] = value;
}

View File

@ -378,7 +378,7 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
const relLevelExp = getLevelRelExp(this.lastLevel + 1, pokemon.species.growthRate);
const levelExp = levelUp ? relLevelExp : pokemon.levelExp;
let ratio = relLevelExp ? levelExp / relLevelExp : 0;
if (this.lastLevel >= (this.scene as BattleScene).getMaxExpLevel(true)) {
if (this.lastLevel >= (this.scene as BattleScene).getMaxExpLevel()) {
if (levelUp)
ratio = 1;
else

View File

@ -570,8 +570,8 @@ export default class SummaryUiHandler extends UiHandler {
statsContainer.add(statLabel);
const statValueText = stat !== Stat.HP
? this.pokemon.stats[s].toString()
: `${this.pokemon.hp}/${this.pokemon.getMaxHp()}`;
? Utils.formatStat(this.pokemon.stats[s])
: `${Utils.formatStat(this.pokemon.hp, true)}/${Utils.formatStat(this.pokemon.getMaxHp(), true)}`;
const statValue = addTextObject(this.scene, 120 + 88 * colIndex, 56 + 16 * rowIndex, statValueText, TextStyle.WINDOW);
statValue.setOrigin(1, 0);

View File

@ -139,6 +139,29 @@ export function decToBin(input: integer): string {
return bin;
}
export function formatStat(stat: integer, forHp: boolean = false): string {
if (stat < (forHp ? 100000 : 1000000))
return stat.toString();
let ret = stat.toString();
let suffix = '';
switch (Math.ceil(ret.length / 3) - 1) {
case 1:
suffix = 'K';
break;
case 2:
suffix = 'M';
break;
case 3:
suffix = 'B';
break;
default:
return '?';
}
const digits = ((ret.length + 2) % 3) + 1;
const decimalNumber = parseInt(ret.slice(digits, digits + (3 - digits)));
return `${ret.slice(0, digits)}${decimalNumber ? `.${decimalNumber}` : ''}${suffix}`;
}
export function getEnumKeys(enumType): string[] {
return Object.values(enumType).filter(v => isNaN(parseInt(v.toString()))).map(v => v.toString());
}