You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Nydaliv/Assets/Scripts/Utilities/NumberUtilities.cs

14 lines
440 B

5 years ago
using System;
namespace Exsersewo.Nydaliv.Utilities
{
public static class NumberUtilities
{
public static ulong GetXPLevelRequirement(ulong level, double growthmod)
=> (ulong)Math.Round(Math.Pow(level, 2) * 50 * growthmod, MidpointRounding.AwayFromZero);
public static ulong GetLevelFromTotalXP(ulong totalxp, double growthmod)
=> (ulong)(Math.Sqrt(totalxp / (50 * growthmod)));
}
}