From dca8a5c529c6684f28eefab3c8ad5138917f117e Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Thu, 29 Feb 2024 15:25:15 -0500 Subject: [PATCH] Remove level and stat caps --- src/battle-scene.ts | 6 ++---- src/modifier/modifier.ts | 2 +- src/pokemon.ts | 3 +-- src/ui/battle-info.ts | 2 +- src/ui/summary-ui-handler.ts | 4 ++-- src/utils.ts | 23 +++++++++++++++++++++++ 6 files changed, 30 insertions(+), 10 deletions(-) diff --git a/src/battle-scene.ts b/src/battle-scene.ts index dc22ba71d..d8aac67c7 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -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 { diff --git a/src/modifier/modifier.ts b/src/modifier/modifier.ts index ae62e989a..dad2b58b6 100644 --- a/src/modifier/modifier.ts +++ b/src/modifier/modifier.ts @@ -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; } diff --git a/src/pokemon.ts b/src/pokemon.ts index 9cb4f4bee..1a0cc34dc 100644 --- a/src/pokemon.ts +++ b/src/pokemon.ts @@ -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; } diff --git a/src/ui/battle-info.ts b/src/ui/battle-info.ts index 2d46edad6..672a62e6c 100644 --- a/src/ui/battle-info.ts +++ b/src/ui/battle-info.ts @@ -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 diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index c6d2a65ab..e8923d93c 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -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); diff --git a/src/utils.ts b/src/utils.ts index c4876eabc..d7dff840d 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -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()); }