style(files): reorganize everything

This commit is contained in:
Anhgelus Morhtuuzh 2025-05-13 12:50:20 +02:00
parent 0a445aa1c7
commit c408afc879
Signed by: anhgelus
GPG key ID: CAD341EFA92DDDE5
13 changed files with 422 additions and 389 deletions

45
exp/functions.go Normal file
View file

@ -0,0 +1,45 @@
package exp
import (
"github.com/anhgelus/gokord"
"math"
)
func MessageXP(length uint, diversity uint) uint {
return uint(math.Floor(
0.025*math.Pow(float64(length), 1.25)*math.Sqrt(float64(diversity)) + 1,
))
}
func VocalXP(time uint) uint {
return uint(math.Floor(
0.01*math.Pow(float64(time), 1.3) + 1,
))
}
// Level gives the level with the given XP.
// See LevelXP to get the XP required to get a level.
func Level(xp uint) uint {
return uint(math.Floor(
0.2 * math.Sqrt(float64(xp)),
))
}
// LevelXP gives the XP required to get this level.
// See Level to get the level with the given XP.
func LevelXP(level uint) uint {
return uint(math.Floor(
math.Pow(float64(5*level), 2),
))
}
func Lose(time uint, xp uint) uint {
if gokord.Debug {
return uint(math.Floor(
math.Pow(float64(time), 3) * math.Pow(10, -2+math.Log(float64(time))) * math.Floor(float64(xp/500)+1),
)) // a little bit faster to lose exp
}
return uint(math.Floor(
math.Pow(float64(time), 2) * math.Pow(10, -2+math.Log(float64(time/85))) * math.Floor(float64(xp/500)+1),
))
}