diff --git a/public/images/arenas/desert_a.png b/public/images/arenas/desert_a.png index dbacc4564..0d8ead825 100644 Binary files a/public/images/arenas/desert_a.png and b/public/images/arenas/desert_a.png differ diff --git a/public/images/arenas/desert_b.png b/public/images/arenas/desert_b.png index 5455e82aa..854033412 100644 Binary files a/public/images/arenas/desert_b.png and b/public/images/arenas/desert_b.png differ diff --git a/public/images/arenas/desert_b_1.png b/public/images/arenas/desert_b_1.png new file mode 100644 index 000000000..1e8d33d48 Binary files /dev/null and b/public/images/arenas/desert_b_1.png differ diff --git a/public/images/arenas/desert_b_2.png b/public/images/arenas/desert_b_2.png new file mode 100644 index 000000000..a90737273 Binary files /dev/null and b/public/images/arenas/desert_b_2.png differ diff --git a/public/images/arenas/desert_b_3.png b/public/images/arenas/desert_b_3.png new file mode 100644 index 000000000..8016fe6c9 Binary files /dev/null and b/public/images/arenas/desert_b_3.png differ diff --git a/public/images/arenas/desert_bg.png b/public/images/arenas/desert_bg.png index 5c1518c1e..45c8162be 100644 Binary files a/public/images/arenas/desert_bg.png and b/public/images/arenas/desert_bg.png differ diff --git a/public/images/arenas/lake_a.png b/public/images/arenas/lake_a.png new file mode 100644 index 000000000..6ca45fb41 Binary files /dev/null and b/public/images/arenas/lake_a.png differ diff --git a/public/images/arenas/lake_b.png b/public/images/arenas/lake_b.png new file mode 100644 index 000000000..c1c81f2b2 Binary files /dev/null and b/public/images/arenas/lake_b.png differ diff --git a/public/images/arenas/lake_b_1.png b/public/images/arenas/lake_b_1.png new file mode 100644 index 000000000..be6db3451 Binary files /dev/null and b/public/images/arenas/lake_b_1.png differ diff --git a/public/images/arenas/lake_b_2.png b/public/images/arenas/lake_b_2.png new file mode 100644 index 000000000..ee8af5049 Binary files /dev/null and b/public/images/arenas/lake_b_2.png differ diff --git a/public/images/arenas/lake_b_3.png b/public/images/arenas/lake_b_3.png new file mode 100644 index 000000000..f0cf92f53 Binary files /dev/null and b/public/images/arenas/lake_b_3.png differ diff --git a/public/images/arenas/lake_bg.png b/public/images/arenas/lake_bg.png new file mode 100644 index 000000000..c546468a9 Binary files /dev/null and b/public/images/arenas/lake_bg.png differ diff --git a/public/images/arenas/sea_a.png b/public/images/arenas/sea_a.png index 2bc643e25..b027f7c71 100644 Binary files a/public/images/arenas/sea_a.png and b/public/images/arenas/sea_a.png differ diff --git a/public/images/arenas/sea_b.png b/public/images/arenas/sea_b.png index 161ea4e28..56e0443c0 100644 Binary files a/public/images/arenas/sea_b.png and b/public/images/arenas/sea_b.png differ diff --git a/public/images/arenas/sea_bg.png b/public/images/arenas/sea_bg.png index fa47b0bf9..142cd6567 100644 Binary files a/public/images/arenas/sea_bg.png and b/public/images/arenas/sea_bg.png differ diff --git a/src/arena.ts b/src/arena.ts index b791d82b6..0ad43bf0b 100644 --- a/src/arena.ts +++ b/src/arena.ts @@ -97,26 +97,6 @@ export class Arena { return ret; } - getBiomeKey(): string { - switch (this.biomeType) { - case Biome.LAKE: - return 'sea'; - case Biome.ABYSS: - return 'wasteland'; - case Biome.MEADOW: - return 'grass'; - case Biome.VOLCANO: - return 'cave'; - case Biome.POWER_PLANT: - return 'ruins'; - case Biome.FACTORY: - return 'wasteland'; - case Biome.END: - return 'wasteland'; - } - return Biome[this.biomeType].toLowerCase(); - } - getFormIndex(species: PokemonSpecies) { if (!species.canChangeForm && species.forms?.length) return Utils.randInt(species.forms.length); // TODO: Base on biome @@ -326,4 +306,80 @@ export class Arena { return 21.347; } } +} + +export function getBiomeKey(biome: Biome): string { + switch (biome) { + case Biome.ABYSS: + return 'wasteland'; + case Biome.MEADOW: + return 'grass'; + case Biome.VOLCANO: + return 'cave'; + case Biome.POWER_PLANT: + return 'ruins'; + case Biome.FACTORY: + return 'wasteland'; + case Biome.END: + return 'wasteland'; + } + return Biome[biome].toLowerCase(); +} + +export function getBiomeHasProps(biomeType: Biome): boolean { + switch (biomeType) { + case Biome.LAKE: + case Biome.DESERT: + return true; + } + + return false; +} + +export class ArenaBase extends Phaser.GameObjects.Container { + public player: boolean; + public biome: Biome; + public propValue: integer; + public base: Phaser.GameObjects.Sprite; + public props: Phaser.GameObjects.Sprite[]; + + constructor(scene: BattleScene, player: boolean) { + super(scene, 0, 0); + + this.player = player; + this.biome = Biome.PLAINS; + + this.base = scene.add.sprite(0, 0, `plains_a`); + this.base.setOrigin(0, 0); + + this.props = !player ? + new Array(3).fill(null).map(() => { + const ret = scene.add.sprite(0, 0, `plains_b`); + ret.setOrigin(0, 0); + ret.setVisible(false); + return ret; + }) : []; + } + + setBiome(biome: Biome, propValue?: integer): void { + if (this.biome === biome) + return; + + const hasProps = getBiomeHasProps(biome); + const biomeKey = getBiomeKey(biome); + + this.base.setTexture(`${biomeKey}_${this.player ? 'a' : 'b'}`); + this.add(this.base); + + if (!this.player) { + this.propValue = propValue === undefined + ? hasProps ? Utils.randInt(8) : 0 + : propValue; + for (let p = 0; p < 3; p++) { + this.props[p].setTexture(`${biomeKey}_b${hasProps ? `_${p + 1}` : ''}`); + this.props[p].setVisible(hasProps && !!(this.propValue & (1 << p))); + this.add(this.props[p]); + } + } + } } \ No newline at end of file diff --git a/src/battle-phases.ts b/src/battle-phases.ts index dd7406cd6..65edb62ee 100644 --- a/src/battle-phases.ts +++ b/src/battle-phases.ts @@ -1,4 +1,4 @@ -import BattleScene, { startingLevel, startingWave } from "./battle-scene"; +import BattleScene, { maxExpLevel, startingLevel, startingWave } from "./battle-scene"; import { default as Pokemon, PlayerPokemon, EnemyPokemon, PokemonMove, MoveResult, DamageResult } from "./pokemon"; import * as Utils from './utils'; import { allMoves, applyMoveAttrs, BypassSleepAttr, ChargeAttr, applyFilteredMoveAttrs, HitsTagAttr, MissEffectAttr, MoveAttr, MoveCategory, MoveEffectAttr, MoveFlags, MoveHitEffectAttr, Moves, MultiHitAttr, OverrideMoveEffectAttr, VariableAccuracyAttr, MoveTarget, OneHitKOAttr } from "./data/move"; @@ -27,6 +27,7 @@ import { TempBattleStat } from "./data/temp-battle-stat"; import { ArenaTagType, ArenaTrapTag, TrickRoomTag } from "./data/arena-tag"; import { CheckTrappedAbAttr, PostDefendAbAttr, PostSummonAbAttr, PostTurnAbAttr, PostWeatherLapseAbAttr, PreWeatherDamageAbAttr, ProtectStatAbAttr, SuppressWeatherEffectAbAttr, applyCheckTrappedAbAttrs, applyPostDefendAbAttrs, applyPostSummonAbAttrs, applyPostTurnAbAttrs, applyPostWeatherLapseAbAttrs, applyPreStatChangeAbAttrs, applyPreWeatherEffectAbAttrs } from "./data/ability"; import { Unlockables, getUnlockableName } from "./system/unlockables"; +import { getBiomeKey } from "./arena"; export class CheckLoadPhase extends BattlePhase { private loaded: boolean; @@ -157,7 +158,7 @@ export class EncounterPhase extends BattlePhase { } doEncounter() { - if (startingWave > 10 && startingLevel < 100) { + if (startingWave > 10) { for (let m = 0; m < Math.floor(startingWave / 10); m++) this.scene.addModifier(getPlayerModifierTypeOptionsForWave((m + 1) * 10, 1, this.scene.getParty())[0].type.newModifier()); } @@ -303,14 +304,12 @@ export class SwitchBiomePhase extends BattlePhase { this.scene.newArena(this.nextBiome); - const biomeKey = this.scene.arena.getBiomeKey(); + const biomeKey = getBiomeKey(this.nextBiome); const bgTexture = `${biomeKey}_bg`; - const playerTexture = `${biomeKey}_a`; - const enemyTexture = `${biomeKey}_b`; this.scene.arenaBgTransition.setTexture(bgTexture) this.scene.arenaBgTransition.setAlpha(0); this.scene.arenaBgTransition.setVisible(true); - this.scene.arenaPlayerTransition.setTexture(playerTexture) + this.scene.arenaPlayerTransition.setBiome(this.nextBiome); this.scene.arenaPlayerTransition.setAlpha(0); this.scene.arenaPlayerTransition.setVisible(true); @@ -324,11 +323,11 @@ export class SwitchBiomePhase extends BattlePhase { alpha: (target: any) => target === this.scene.arenaPlayer ? 0 : 1, onComplete: () => { this.scene.arenaBg.setTexture(bgTexture); - this.scene.arenaPlayer.setTexture(playerTexture); + this.scene.arenaPlayer.setBiome(this.nextBiome); this.scene.arenaPlayer.setAlpha(1); - this.scene.arenaEnemy.setTexture(enemyTexture); + this.scene.arenaEnemy.setBiome(this.nextBiome); this.scene.arenaEnemy.setAlpha(1); - this.scene.arenaNextEnemy.setTexture(enemyTexture); + this.scene.arenaNextEnemy.setBiome(this.nextBiome); this.scene.arenaBgTransition.setVisible(false); this.scene.arenaPlayerTransition.setVisible(false); @@ -1550,7 +1549,7 @@ export class VictoryPhase extends PokemonPhase { const expBalanceModifier = this.scene.findModifier(m => m instanceof ExpBalanceModifier) as ExpBalanceModifier; const multipleParticipantExpBonusModifier = this.scene.findModifier(m => m instanceof MultipleParticipantExpBonusModifier) as MultipleParticipantExpBonusModifier; const expValue = this.scene.getEnemyPokemon().getExpValue(); - const expPartyMembers = party.filter(p => p.hp && p.level < 100); + const expPartyMembers = party.filter(p => p.hp && p.level < maxExpLevel); const partyMemberExp = []; for (let partyMember of expPartyMembers) { const pId = partyMember.id; @@ -1753,10 +1752,10 @@ export class LevelUpPhase extends PartyMemberPokemonPhase { const levelMoves = this.getPokemon().getLevelMoves(this.lastLevel + 1); for (let lm of levelMoves) this.scene.unshiftPhase(new LearnMovePhase(this.scene, this.partyMemberIndex, lm)); - const evolution = pokemon.getEvolution(); - if (evolution) - this.scene.unshiftPhase(new EvolutionPhase(this.scene, this.partyMemberIndex, evolution, this.lastLevel)); } + const evolution = pokemon.getEvolution(); + if (evolution) + this.scene.unshiftPhase(new EvolutionPhase(this.scene, this.partyMemberIndex, evolution, this.lastLevel)); } } diff --git a/src/battle-scene.ts b/src/battle-scene.ts index d093c2638..8a8557a47 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -13,7 +13,7 @@ import { Battle } from './battle'; import { initCommonAnims, initMoveAnim, loadCommonAnimAssets, loadMoveAnimAssets, populateAnims } from './data/battle-anims'; import { BattlePhase } from './battle-phase'; import { initGameSpeed } from './system/game-speed'; -import { Arena } from './arena'; +import { Arena, ArenaBase, getBiomeHasProps, getBiomeKey } from './arena'; import { GameData } from './system/game-data'; import StarterSelectUiHandler from './ui/starter-select-ui-handler'; import { TextStyle, addTextObject } from './ui/text'; @@ -28,6 +28,8 @@ export const startingLevel = 5; export const startingWave = 1; export const startingBiome = Biome.TOWN; +export const maxExpLevel = 10000; + export enum Button { UP, DOWN, @@ -64,13 +66,12 @@ export default class BattleScene extends Phaser.Scene { public field: Phaser.GameObjects.Container; public fieldUI: Phaser.GameObjects.Container; public abilityBar: AbilityBar; - public arenaBg: Phaser.GameObjects.Image; - public arenaBgTransition: Phaser.GameObjects.Image; - public arenaPlayer: Phaser.GameObjects.Image; - public arenaPlayerTransition: Phaser.GameObjects.Image; - public arenaEnemy: Phaser.GameObjects.Image; - public arenaEnemyTransition: Phaser.GameObjects.Image; - public arenaNextEnemy: Phaser.GameObjects.Image; + public arenaBg: Phaser.GameObjects.Sprite; + public arenaBgTransition: Phaser.GameObjects.Sprite; + public arenaPlayer: ArenaBase; + public arenaPlayerTransition: ArenaBase; + public arenaEnemy: ArenaBase; + public arenaNextEnemy: ArenaBase; public arena: Arena; public trainer: Phaser.GameObjects.Sprite; public currentBattle: Battle; @@ -209,11 +210,15 @@ export default class BattleScene extends Phaser.Scene { this.loadImage('starter_select_gen_cursor_highlight', 'ui'); // Load arena images - Utils.getEnumValues(Biome).map(at => { - const atKey = Biome[at].toLowerCase(); - this.loadImage(`${atKey}_bg`, 'arenas', `${atKey}_bg.png`); - this.loadImage(`${atKey}_a`, 'arenas', `${atKey}_a.png`); - this.loadImage(`${atKey}_b`, 'arenas', `${atKey}_b.png`); + Utils.getEnumValues(Biome).map(bt => { + const btKey = Biome[bt].toLowerCase(); + this.loadImage(`${btKey}_bg`, 'arenas'); + this.loadImage(`${btKey}_a`, 'arenas'); + this.loadImage(`${btKey}_b`, 'arenas'); + if (getBiomeHasProps(bt)) { + for (let p = 1; p <= 3; p++) + this.loadImage(`${btKey}_b_${p}`, 'arenas') + } }); // Load trainer images @@ -338,16 +343,17 @@ export default class BattleScene extends Phaser.Scene { this.arenaBg = this.add.sprite(0, 0, 'plains_bg'); this.arenaBgTransition = this.add.sprite(0, 0, `plains_bg`); - this.arenaPlayer = this.add.sprite(0, 0, `plains_a`); - this.arenaPlayerTransition = this.add.sprite(0, 0, `plains_a`); - this.arenaEnemy = this.add.sprite(0, 0, `plains_b`); - this.arenaNextEnemy = this.add.sprite(0, 0, `plains_b`); + this.arenaPlayer = new ArenaBase(this, true); + this.arenaPlayerTransition = new ArenaBase(this, true); + this.arenaEnemy = new ArenaBase(this, false); + this.arenaNextEnemy = new ArenaBase(this, false); this.arenaBgTransition.setVisible(false); this.arenaPlayerTransition.setVisible(false); - [this.arenaBg, this.arenaBgTransition, this.arenaPlayer, this.arenaPlayerTransition, this.arenaEnemy, this.arenaNextEnemy].forEach(a => { - a.setOrigin(0, 0); + [ this.arenaBg, this.arenaBgTransition, this.arenaPlayer, this.arenaPlayerTransition, this.arenaEnemy, this.arenaNextEnemy ].forEach(a => { + if (a instanceof Phaser.GameObjects.Sprite) + a.setOrigin(0, 0); field.add(a); }); @@ -481,8 +487,7 @@ export default class BattleScene extends Phaser.Scene { this.arenaBgTransition.setPosition(0, 0); this.arenaPlayer.setPosition(300, 0); this.arenaPlayerTransition.setPosition(0, 0); - this.arenaEnemy.setPosition(-280, 0); - this.arenaNextEnemy.setPosition(-280, 0); + [ this.arenaEnemy, this.arenaNextEnemy ].forEach(a => a.setPosition(-280, 0)); this.trainer.setTexture('trainer_m'); this.trainer.setPosition(406, 132); @@ -518,14 +523,14 @@ export default class BattleScene extends Phaser.Scene { this.arena = new Arena(this, biome, Biome[biome].toLowerCase()); if (init) { - const biomeKey = this.arena.getBiomeKey(); + const biomeKey = getBiomeKey(biome); this.arenaBg.setTexture(`${biomeKey}_bg`); this.arenaBgTransition.setTexture(`${biomeKey}_bg`); - this.arenaPlayer.setTexture(`${biomeKey}_a`); - this.arenaPlayerTransition.setTexture(`${biomeKey}_a`); - this.arenaEnemy.setTexture(`${biomeKey}_b`); - this.arenaNextEnemy.setTexture(`${biomeKey}_b`); + this.arenaPlayer.setBiome(biome); + this.arenaPlayerTransition.setBiome(biome); + this.arenaEnemy.setBiome(biome); + this.arenaNextEnemy.setBiome(biome); } return this.arena; diff --git a/src/data/exp.ts b/src/data/exp.ts index ae11a2a0a..9c8dccf04 100644 --- a/src/data/exp.ts +++ b/src/data/exp.ts @@ -16,10 +16,26 @@ const expLevels = [ [ 0, 4, 13, 32, 65, 112, 178, 276, 393, 540, 745, 967, 1230, 1591, 1957, 2457, 3046, 3732, 4526, 5440, 6482, 7666, 9003, 10506, 12187, 14060, 16140, 18439, 20974, 23760, 26811, 30146, 33780, 37731, 42017, 46656, 50653, 55969, 60505, 66560, 71677, 78533, 84277, 91998, 98415, 107069, 114205, 123863, 131766, 142500, 151222, 163105, 172697, 185807, 196322, 210739, 222231, 238036, 250562, 267840, 281456, 300293, 315059, 335544, 351520, 373744, 390991, 415050, 433631, 459620, 479600, 507617, 529063, 559209, 582187, 614566, 639146, 673863, 700115, 737280, 765275, 804997, 834809, 877201, 908905, 954084, 987754, 1035837, 1071552, 1122660, 1160499, 1214753, 1254796, 1312322, 1354652, 1415577, 1460276, 1524731, 1571884, 1640000 ] ]; -export function getLevelTotalExp(level: integer, growthRate: integer) { - return expLevels[growthRate][level - 1]; +export function getLevelTotalExp(level: integer, growthRate: GrowthRate): number { + if (level < 100) + return expLevels[growthRate][level - 1]; + + switch (growthRate) { + case GrowthRate.ERRATIC: + return (Math.pow(level, 4) + (Math.pow(level, 3) * 2000)) / 3500; + case GrowthRate.FAST: + return Math.pow(level, 3) * 4 / 5; + case GrowthRate.MEDIUM_FAST: + return Math.pow(level, 3); + case GrowthRate.MEDIUM_SLOW: + return (Math.pow(level, 3) * 6 / 5) - (15 * Math.pow(level, 2)) + (100 * level) - 140; + case GrowthRate.SLOW: + return Math.pow(level, 3) * 5 / 4; + case GrowthRate.FLUCTUATING: + return (Math.pow(level, 3) + ((level / 2) + 32)) * 4 / (100 + level); + } }; -export function getLevelRelExp(level: integer, growthRate: integer) { +export function getLevelRelExp(level: integer, growthRate: GrowthRate): number { return getLevelTotalExp(level, growthRate) - getLevelTotalExp(level - 1, growthRate); }; \ No newline at end of file diff --git a/src/modifier/modifier-type.ts b/src/modifier/modifier-type.ts index 8386f60d1..75db27cbd 100644 --- a/src/modifier/modifier-type.ts +++ b/src/modifier/modifier-type.ts @@ -11,6 +11,7 @@ import * as Utils from '../utils'; import { TempBattleStat, getTempBattleStatBoosterItemName, getTempBattleStatName } from '../data/temp-battle-stat'; import { BerryType, getBerryEffectDescription, getBerryName } from '../data/berry'; import { Unlockables } from '../system/unlockables'; +import { maxExpLevel } from '../battle-scene'; type Modifier = Modifiers.Modifier; @@ -696,7 +697,7 @@ const modifierPool = { return !party[0].scene.findModifier(m => m instanceof Modifiers.MapModifier) ? 1 : 0; }), new WeightedModifierType(modifierTypes.TM_GREAT, 2), - new WeightedModifierType(modifierTypes.EXP_SHARE, (party: Pokemon[]) => party.filter(p => p.level < 100).length ? 1 : 0), + new WeightedModifierType(modifierTypes.EXP_SHARE, (party: Pokemon[]) => party.filter(p => p.level < maxExpLevel).length ? 1 : 0), new WeightedModifierType(modifierTypes.BASE_STAT_BOOSTER, 3) ].map(m => { m.setTier(ModifierTier.GREAT); return m; }), [ModifierTier.ULTRA]: [ @@ -713,10 +714,10 @@ const modifierPool = { new WeightedModifierType(modifierTypes.LEFTOVERS, 2), new WeightedModifierType(modifierTypes.SHELL_BELL, 2), new WeightedModifierType(modifierTypes.BERRY_POUCH, 3), - new WeightedModifierType(modifierTypes.EXP_CHARM, (party: Pokemon[]) => party.filter(p => p.level < 100).length ? 4 : 0), - new WeightedModifierType(modifierTypes.OVAL_CHARM, (party: Pokemon[]) => party.filter(p => p.level < 100).length ? 2 : 0), + new WeightedModifierType(modifierTypes.EXP_CHARM, (party: Pokemon[]) => party.filter(p => p.level < maxExpLevel).length ? 4 : 0), + new WeightedModifierType(modifierTypes.OVAL_CHARM, (party: Pokemon[]) => party.filter(p => p.level < maxExpLevel).length ? 2 : 0), new WeightedModifierType(modifierTypes.EXP_BALANCE, - (party: Pokemon[]) => party.filter(p => p.level < 100).length && !party[0].scene.findModifier(m => m instanceof Modifiers.ExpBalanceModifier) ? 1 : 0) + (party: Pokemon[]) => party.filter(p => p.level < maxExpLevel).length && !party[0].scene.findModifier(m => m instanceof Modifiers.ExpBalanceModifier) ? 1 : 0) ].map(m => { m.setTier(ModifierTier.ULTRA); return m; }), [ModifierTier.MASTER]: [ new WeightedModifierType(modifierTypes.MASTER_BALL, 3), @@ -724,7 +725,7 @@ const modifierPool = { new WeightedModifierType(modifierTypes.MINI_BLACK_HOLE, (party: Pokemon[]) => party[0].scene.gameData.unlocks[Unlockables.MINI_BLACK_HOLE] ? 1 : 0) ].map(m => { m.setTier(ModifierTier.MASTER); return m; }), [ModifierTier.LUXURY]: [ - new WeightedModifierType(modifierTypes.GOLDEN_EXP_CHARM, (party: Pokemon[]) => party.filter(p => p.level < 100).length ? 1 : 0), + new WeightedModifierType(modifierTypes.GOLDEN_EXP_CHARM, (party: Pokemon[]) => party.filter(p => p.level < maxExpLevel).length ? 1 : 0), new WeightedModifierType(modifierTypes.GOLDEN_POKEBALL, 1), new WeightedModifierType(modifierTypes.RARER_CANDY, 1) ].map(m => { m.setTier(ModifierTier.LUXURY); return m; }), diff --git a/src/modifier/modifier.ts b/src/modifier/modifier.ts index bc5b1b6a0..80bc4b4c6 100644 --- a/src/modifier/modifier.ts +++ b/src/modifier/modifier.ts @@ -1,6 +1,6 @@ import * as ModifierTypes from './modifier-type'; import { LearnMovePhase, LevelUpPhase, PokemonHealPhase } from "../battle-phases"; -import BattleScene from "../battle-scene"; +import BattleScene, { maxExpLevel } from "../battle-scene"; import { getLevelTotalExp } from "../data/exp"; import { PokeballType } from "../data/pokeball"; import Pokemon, { PlayerPokemon } from "../pokemon"; @@ -735,7 +735,7 @@ export class PokemonLevelIncrementModifier extends ConsumablePokemonModifier { pokemon.scene.applyModifiers(LevelIncrementBoosterModifier, true, levelCount); pokemon.level += levelCount.value; - if (pokemon.level <= 100) { + if (pokemon.level <= maxExpLevel) { pokemon.exp = getLevelTotalExp(pokemon.level, pokemon.species.growthRate); pokemon.levelExp = 0; } diff --git a/src/ui/battle-info.ts b/src/ui/battle-info.ts index 556db7b88..0e2b1bcfa 100644 --- a/src/ui/battle-info.ts +++ b/src/ui/battle-info.ts @@ -4,7 +4,7 @@ import * as Utils from '../utils'; import { addTextObject, TextStyle } from './text'; import { getGenderSymbol, getGenderColor } from '../data/gender'; import { StatusEffect } from '../data/status-effect'; -import BattleScene from '../battle-scene'; +import BattleScene, { maxExpLevel } from '../battle-scene'; export default class BattleInfo extends Phaser.GameObjects.Container { private player: boolean; @@ -217,7 +217,7 @@ export default class BattleInfo extends Phaser.GameObjects.Container { const relLevelExp = getLevelRelExp(this.lastLevel + 1, battler.species.growthRate); const levelExp = levelUp ? relLevelExp : battler.levelExp; let ratio = relLevelExp ? levelExp / relLevelExp : 0; - if (this.lastLevel >= 100) { + if (this.lastLevel >= maxExpLevel) { if (levelUp) ratio = 1; instant = true; diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index 369539b12..533b05c36 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -1,4 +1,4 @@ -import BattleScene, { Button } from "../battle-scene"; +import BattleScene, { Button, maxExpLevel } from "../battle-scene"; import { Mode } from "./ui"; import UiHandler from "./uiHandler"; import * as Utils from "../utils"; @@ -482,7 +482,7 @@ export default class SummaryUiHandler extends UiHandler { }); const totalLvExp = getLevelTotalExp(this.pokemon.level, this.pokemon.species.growthRate); - const expRatio = this.pokemon.level < 100 ? this.pokemon.levelExp / totalLvExp : 0; + const expRatio = this.pokemon.level < maxExpLevel ? this.pokemon.levelExp / totalLvExp : 0; const expLabel = addTextObject(this.scene, 6, 112, 'EXP. POINTS', TextStyle.SUMMARY); expLabel.setOrigin(0, 0); @@ -496,7 +496,7 @@ export default class SummaryUiHandler extends UiHandler { expText.setOrigin(1, 0); statsContainer.add(expText); - const nextLvExp = this.pokemon.level < 100 + const nextLvExp = this.pokemon.level < maxExpLevel ? getLevelTotalExp(this.pokemon.level + 1, this.pokemon.species.growthRate) - this.pokemon.levelExp : 0; const nextLvExpText = addTextObject(this.scene, 208, 128, nextLvExp.toString(), TextStyle.WINDOW);