feat(xp): functions

This commit is contained in:
Anhgelus Morhtuuzh 2024-04-14 15:54:27 +02:00
parent 55b25ef62d
commit 1f68e69899
No known key found for this signature in database
GPG key ID: CF4550297832A29F
2 changed files with 36 additions and 3 deletions

33
xp/functions.go Normal file
View file

@ -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)),
))
}