diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-07-15 17:40:40 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-07-15 17:40:40 -0400 |
commit | 5e88fbf7c78a5d81f2cb7f2265b16cbb7713d07c (patch) | |
tree | 8607bfd7fb57b928ef328bc3c254cd130574a8a1 /src/lib/models | |
parent | 9247fa8c65174eb35fbfe3cd9d4167f9cf9ce17a (diff) | |
parent | de106bb23746538aed6e5a0bf06b2d72deffd342 (diff) | |
download | tanzanite-5e88fbf7c78a5d81f2cb7f2265b16cbb7713d07c.tar.gz tanzanite-5e88fbf7c78a5d81f2cb7f2265b16cbb7713d07c.tar.bz2 tanzanite-5e88fbf7c78a5d81f2cb7f2265b16cbb7713d07c.zip |
Merge remote-tracking branch 'origin/master' into wip
Diffstat (limited to 'src/lib/models')
-rw-r--r-- | src/lib/models/instance/Level.ts | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/lib/models/instance/Level.ts b/src/lib/models/instance/Level.ts index 77bc3d4..d8d16f0 100644 --- a/src/lib/models/instance/Level.ts +++ b/src/lib/models/instance/Level.ts @@ -57,19 +57,11 @@ export class Level extends BaseModel<LevelModel, LevelModelCreationAttributes> i } public static convertXpToLevel(xp: number): number { - let i = 0; - while (Level.convertLevelToXp(i + 1) < xp) { - i++; - } - return i; + return Math.floor((-25 + Math.sqrt(625 + 200 * xp)) / 100); } public static convertLevelToXp(level: number): number { - let xp = 0; - for (let i = 0; i < level; i++) { - xp += 100 * i + 75; - } - return xp; + return 50 * level * level + 25 * level; // 50x² + 25x } public static genRandomizedXp(): number { |