-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(XPChart): Centralized forumla
- Loading branch information
1 parent
02ffe42
commit b5db2f7
Showing
4 changed files
with
20 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export const calculateXPForLevel = (level) => { | ||
if (level <= 30) { | ||
// Polynomial function for levels 1-30 | ||
const a = 3e6 / Math.pow(30, 2); // a = 3,000,000 / 900 | ||
return Math.round(a * Math.pow(level, 2)); | ||
} else { | ||
// Exponential function for levels 31-100 | ||
const C = 3e6; // XP at level 30 | ||
const D = (200e6 - C) / Math.pow(70, 2); // Growth rate for levels 31-100 | ||
return Math.round(C + D * Math.pow(level - 30, 2)); | ||
} | ||
}; |