aboutsummaryrefslogtreecommitdiff
path: root/xp
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <anhgelus.morhtuuzh@proton.me>2024-04-14 15:54:27 +0200
committerAnhgelus Morhtuuzh <anhgelus.morhtuuzh@proton.me>2024-04-14 15:57:14 +0200
commit1f68e698991d7bb1c9a5519536b2215185de0616 (patch)
treec361303b97a52b9a4ffdb3f4d5d2a8937fbbe574 /xp
parent55b25ef62d9ccd9c823885a4ac8633e60174e445 (diff)
feat(xp): functions
Diffstat (limited to 'xp')
-rw-r--r--xp/functions.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/xp/functions.go b/xp/functions.go
new file mode 100644
index 0000000..e6979c0
--- /dev/null
+++ b/xp/functions.go
@@ -0,0 +1,33 @@
+package xp
+
+import "math"
+
+func XPMessage(length uint, diversity uint) uint {
+ return uint(math.Floor(
+ 0.025*math.Pow(float64(length), 1.25)*math.Sqrt(float64(diversity)) + 1,
+ ))
+}
+
+func XPVocal(time uint) uint {
+ return uint(math.Floor(
+ 0.01*math.Pow(float64(time), 1.3) + 1,
+ ))
+}
+
+func Level(xp uint) uint {
+ return uint(math.Floor(
+ 0.2 * math.Sqrt(float64(xp)),
+ ))
+}
+
+func XPForLevel(level uint) uint {
+ return uint(math.Floor(
+ math.Pow(float64(5*level), 2),
+ ))
+}
+
+func Lose(time uint, xp uint) uint {
+ return uint(math.Floor(
+ math.Pow(float64(time), 2) * math.Pow(10, -2+math.Log(float64(time/85))) * math.Floor(float64(time/500)),
+ ))
+}