forked from semyon422/omppc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
PerformanceCalculator.lua
61 lines (50 loc) · 1.89 KB
/
PerformanceCalculator.lua
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
PerformanceCalculator = createClass()
PerformanceCalculator.computeTotalValue = function(self)
if self.mods.Relax or self.mods.Relax2 or self.mods.Autoplay then
self.totalValue = 0
return
end
local multiplier = 1.1
if self.mods.NoFail then
multiplier = multiplier * 0.90
end
if self.mods.SpunOut then
multiplier = multiplier * 0.95
end
if self.mods.Easy then
multiplier = multiplier * 0.50
end
self:computeStrainValue()
self:computeAccValue()
self.totalValue = math.pow(math.pow(self.strainValue, 1.1) + math.pow(self.accValue, 1.1), 1 / 1.1) * multiplier
end
PerformanceCalculator.computeStrainValue = function(self)
if self.mods.scoreMultiplier <= 0 then
self.strainValue = 0
return
end
self.realScore = self.score * (1 / self.mods.scoreMultiplier)
local score = self.realScore
self.strainValue = (((5 * math.max(1, self.starRate / 0.0825) - 4) ^ 3) / 110000) * (1 + 0.1 * math.min(1, self.noteCount / 1500))
if score <= 500000 then
self.strainValue = self.strainValue * ((score / 500000) * 0.1)
elseif score <= 600000 then
self.strainValue = self.strainValue * (0.1 + (score - 500000) / 100000 * 0.2)
elseif score <= 700000 then
self.strainValue = self.strainValue * (0.3 + (score - 600000) / 100000 * 0.35)
elseif score <= 800000 then
self.strainValue = self.strainValue * (0.65 + (score - 700000) / 100000 * 0.20)
elseif score <= 900000 then
self.strainValue = self.strainValue * (0.85 + (score - 800000) / 100000 * 0.1)
else
self.strainValue = self.strainValue * (0.95 + (score - 900000) / 100000 * 0.05)
end
end
PerformanceCalculator.computeAccValue = function(self)
local hitWindow300 = 34 + 3 * (math.min(10, math.max(0, 10 - self.overallDifficulty)))
if hitWindow300 <= 0 then
self.accValue = 0
return
end
self.accValue = math.pow((150 / hitWindow300) * math.pow(self.accuracy, 16), 1.8) * 2.5 * (math.min(1.15, math.pow(self.noteCount / 1500, 0.3)))
end