aboutsummaryrefslogtreecommitdiff
path: root/xp/functions.go
blob: 196c3d32281e494e62cb42b7ea5249334a23e6a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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(xp/500)),
	))
}