mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
refactor(stats): Address PR comments
This commit is contained in:
@@ -4,9 +4,9 @@
|
||||
------------------------------------------------------
|
||||
*/
|
||||
|
||||
const maxLevel = 100;
|
||||
export const maxLevel = 100;
|
||||
|
||||
function capByLevel (lvl) {
|
||||
export function capByLevel (lvl) {
|
||||
if (lvl > maxLevel) {
|
||||
return maxLevel;
|
||||
} else {
|
||||
@@ -20,7 +20,7 @@ function capByLevel (lvl) {
|
||||
------------------------------------------------------
|
||||
*/
|
||||
|
||||
const maxHealth = 50;
|
||||
export const MAX_HEALTH = 50;
|
||||
|
||||
/*
|
||||
------------------------------------------------------
|
||||
@@ -28,7 +28,7 @@ const maxHealth = 50;
|
||||
------------------------------------------------------
|
||||
*/
|
||||
|
||||
function tnl (lvl) {
|
||||
export function toNextLevel (lvl) {
|
||||
return Math.round((Math.pow(lvl, 2) * 0.25 + 10 * lvl + 139.75) / 10) * 10;
|
||||
}
|
||||
|
||||
@@ -39,17 +39,6 @@ function tnl (lvl) {
|
||||
{halfway} (optional) the point at which the graph starts bending
|
||||
*/
|
||||
|
||||
function diminishingReturns (bonus, max, halfway) {
|
||||
if (!halfway) {
|
||||
halfway = max / 2;
|
||||
}
|
||||
export function diminishingReturns (bonus, max, halfway = max/2) {
|
||||
return max * (bonus / (bonus + halfway));
|
||||
}
|
||||
|
||||
export default {
|
||||
maxLevel,
|
||||
capByLevel,
|
||||
maxHealth,
|
||||
tnl,
|
||||
diminishingReturns,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user