@rian8337/osu-rebalance-difficulty-calculator 1.2.9 → 1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DroidPerformanceCalculator.js +48 -49
- package/dist/DroidStarRating.js +30 -2
- package/dist/OsuPerformanceCalculator.js +9 -7
- package/dist/base/PerformanceCalculator.js +10 -1
- package/dist/base/StarRating.js +1 -0
- package/dist/index.js +1 -0
- package/dist/preprocessing/DifficultyHitObject.js +14 -0
- package/dist/preprocessing/DifficultyHitObjectCreator.js +25 -1
- package/dist/skills/DroidVisual.js +58 -0
- package/package.json +3 -3
- package/typings/index.d.ts +111 -11
|
@@ -11,7 +11,7 @@ class DroidPerformanceCalculator extends PerformanceCalculator_1.PerformanceCalc
|
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
13
|
this.stars = new DroidStarRating_1.DroidStarRating();
|
|
14
|
-
this.finalMultiplier = 1.
|
|
14
|
+
this.finalMultiplier = 1.3;
|
|
15
15
|
/**
|
|
16
16
|
* The aim performance value.
|
|
17
17
|
*/
|
|
@@ -28,21 +28,31 @@ class DroidPerformanceCalculator extends PerformanceCalculator_1.PerformanceCalc
|
|
|
28
28
|
* The flashlight performance value.
|
|
29
29
|
*/
|
|
30
30
|
this.flashlight = 0;
|
|
31
|
+
/**
|
|
32
|
+
* The visual performance value.
|
|
33
|
+
*/
|
|
34
|
+
this.visual = 0;
|
|
35
|
+
this.tapPenalty = 1;
|
|
31
36
|
}
|
|
32
37
|
calculate(params) {
|
|
33
|
-
this.
|
|
38
|
+
this.tapPenalty = params.tapPenalty ?? 1;
|
|
39
|
+
return this.calculateInternal(params, osu_base_1.modes.droid);
|
|
40
|
+
}
|
|
41
|
+
calculateValues() {
|
|
34
42
|
this.calculateAimValue();
|
|
35
43
|
this.calculateTapValue();
|
|
36
44
|
this.calculateAccuracyValue();
|
|
37
45
|
this.calculateFlashlightValue();
|
|
46
|
+
this.calculateVisualValue();
|
|
38
47
|
// Apply tap penalty for penalized plays.
|
|
39
|
-
this.tap /=
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
this.tap /= this.tapPenalty;
|
|
49
|
+
}
|
|
50
|
+
calculateTotalValue() {
|
|
51
|
+
return (Math.pow(Math.pow(this.aim, 1.1) +
|
|
52
|
+
Math.pow(this.tap, 1.1) +
|
|
53
|
+
Math.pow(this.accuracy, 1.1) +
|
|
54
|
+
Math.pow(this.flashlight, 1.1) +
|
|
55
|
+
Math.pow(this.visual, 1.1), 1 / 1.1) * this.finalMultiplier);
|
|
46
56
|
}
|
|
47
57
|
/**
|
|
48
58
|
* Calculates the aim performance value of the beatmap.
|
|
@@ -50,7 +60,6 @@ class DroidPerformanceCalculator extends PerformanceCalculator_1.PerformanceCalc
|
|
|
50
60
|
calculateAimValue() {
|
|
51
61
|
// Global variables
|
|
52
62
|
const objectCount = this.stars.objects.length;
|
|
53
|
-
const calculatedAR = this.mapStatistics.ar;
|
|
54
63
|
this.aim = this.baseValue(Math.pow(this.stars.aim, 0.8));
|
|
55
64
|
if (this.effectiveMissCount > 0) {
|
|
56
65
|
// Penalize misses by assessing # of misses relative to the total # of objects. Default a 3% reduction for any # of misses.
|
|
@@ -60,32 +69,6 @@ class DroidPerformanceCalculator extends PerformanceCalculator_1.PerformanceCalc
|
|
|
60
69
|
}
|
|
61
70
|
// Combo scaling
|
|
62
71
|
this.aim *= this.comboPenalty;
|
|
63
|
-
// We want to give more reward for lower AR when it comes to aim and HD. This nerfs high AR and buffs lower AR.
|
|
64
|
-
if (this.stars.mods.some((m) => m instanceof osu_base_1.ModHidden)) {
|
|
65
|
-
// The bonus starts decreasing twice as fast
|
|
66
|
-
// beyond AR10 and reaches 1 at AR11.
|
|
67
|
-
if (calculatedAR > 10) {
|
|
68
|
-
this.aim *= 1 + Math.max(0, 0.08 * (11 - calculatedAR));
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
this.aim *= 1 + 0.04 * (12 - calculatedAR);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
// AR scaling
|
|
75
|
-
let arFactor = 0;
|
|
76
|
-
if (calculatedAR > 10.33) {
|
|
77
|
-
arFactor += 0.3 * (calculatedAR - 10.33);
|
|
78
|
-
}
|
|
79
|
-
else if (calculatedAR < 8) {
|
|
80
|
-
arFactor += 0.1 * (8 - calculatedAR);
|
|
81
|
-
}
|
|
82
|
-
// Buff for longer maps with high AR.
|
|
83
|
-
this.aim *=
|
|
84
|
-
1 +
|
|
85
|
-
arFactor *
|
|
86
|
-
(1.650668 +
|
|
87
|
-
(0.4845796 - 1.650668) /
|
|
88
|
-
(1 + Math.pow(objectCount / 817.9306, 1.147469)));
|
|
89
72
|
// Scale the aim value with slider factor to nerf very likely dropped sliderends.
|
|
90
73
|
this.aim *= this.sliderNerfFactor;
|
|
91
74
|
// Scale the aim value with accuracy.
|
|
@@ -101,7 +84,6 @@ class DroidPerformanceCalculator extends PerformanceCalculator_1.PerformanceCalc
|
|
|
101
84
|
calculateTapValue() {
|
|
102
85
|
// Global variables
|
|
103
86
|
const objectCount = this.stars.objects.length;
|
|
104
|
-
const calculatedAR = this.mapStatistics.ar;
|
|
105
87
|
this.tap = this.baseValue(this.stars.tap);
|
|
106
88
|
if (this.effectiveMissCount > 0) {
|
|
107
89
|
// Penalize misses by assessing # of misses relative to the total # of objects. Default a 3% reduction for any # of misses.
|
|
@@ -111,17 +93,6 @@ class DroidPerformanceCalculator extends PerformanceCalculator_1.PerformanceCalc
|
|
|
111
93
|
}
|
|
112
94
|
// Combo scaling
|
|
113
95
|
this.tap *= this.comboPenalty;
|
|
114
|
-
// AR scaling
|
|
115
|
-
if (calculatedAR > 10.33) {
|
|
116
|
-
// Buff for longer maps with high AR.
|
|
117
|
-
this.tap *=
|
|
118
|
-
1 +
|
|
119
|
-
0.3 *
|
|
120
|
-
(calculatedAR - 10.33) *
|
|
121
|
-
(1.650668 +
|
|
122
|
-
(0.4845796 - 1.650668) /
|
|
123
|
-
(1 + Math.pow(objectCount / 817.9306, 1.147469)));
|
|
124
|
-
}
|
|
125
96
|
// Calculate accuracy assuming the worst case scenario.
|
|
126
97
|
const countGreat = this.computedAccuracy.n300;
|
|
127
98
|
const countOk = this.computedAccuracy.n100;
|
|
@@ -217,6 +188,32 @@ class DroidPerformanceCalculator extends PerformanceCalculator_1.PerformanceCalc
|
|
|
217
188
|
this.flashlight *=
|
|
218
189
|
0.98 + (this.mapStatistics.od >= 0 ? odScaling : -odScaling);
|
|
219
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* Calculates the visual performance value of the beatmap.
|
|
193
|
+
*/
|
|
194
|
+
calculateVisualValue() {
|
|
195
|
+
// Global variables
|
|
196
|
+
const objectCount = this.stars.objects.length;
|
|
197
|
+
this.visual = Math.pow(Math.pow(this.stars.visual, 0.8), 2) * 25;
|
|
198
|
+
if (this.effectiveMissCount > 0) {
|
|
199
|
+
// Penalize misses by assessing # of misses relative to the total # of objects. Default a 3% reduction for any # of misses.
|
|
200
|
+
this.visual *=
|
|
201
|
+
0.97 *
|
|
202
|
+
Math.pow(1 - Math.pow(this.effectiveMissCount / objectCount, 0.775), this.effectiveMissCount);
|
|
203
|
+
}
|
|
204
|
+
// Combo scaling
|
|
205
|
+
this.visual *= this.comboPenalty;
|
|
206
|
+
// Scale the visual value with object count to penalize short maps.
|
|
207
|
+
this.visual *= Math.min(1, 1.650668 +
|
|
208
|
+
(0.4845796 - 1.650668) /
|
|
209
|
+
(1 + Math.pow(objectCount / 817.9306, 1.147469)));
|
|
210
|
+
// Scale the visual value with accuracy harshly.
|
|
211
|
+
this.visual *= Math.pow(this.computedAccuracy.value(), 4);
|
|
212
|
+
// It is also important to consider accuracy difficulty when doing that.
|
|
213
|
+
const odScaling = Math.pow(this.mapStatistics.od, 2) / 2500;
|
|
214
|
+
this.visual *=
|
|
215
|
+
0.98 + (this.mapStatistics.od >= 0 ? odScaling : -odScaling);
|
|
216
|
+
}
|
|
220
217
|
toString() {
|
|
221
218
|
return (this.total.toFixed(2) +
|
|
222
219
|
" pp (" +
|
|
@@ -227,7 +224,9 @@ class DroidPerformanceCalculator extends PerformanceCalculator_1.PerformanceCalc
|
|
|
227
224
|
this.accuracy.toFixed(2) +
|
|
228
225
|
" acc, " +
|
|
229
226
|
this.flashlight.toFixed(2) +
|
|
230
|
-
" flashlight
|
|
227
|
+
" flashlight, " +
|
|
228
|
+
this.visual.toFixed(2) +
|
|
229
|
+
" visual)");
|
|
231
230
|
}
|
|
232
231
|
}
|
|
233
232
|
exports.DroidPerformanceCalculator = DroidPerformanceCalculator;
|
package/dist/DroidStarRating.js
CHANGED
|
@@ -7,6 +7,7 @@ const StarRating_1 = require("./base/StarRating");
|
|
|
7
7
|
const DroidFlashlight_1 = require("./skills/DroidFlashlight");
|
|
8
8
|
const osu_base_1 = require("@rian8337/osu-base");
|
|
9
9
|
const DroidRhythm_1 = require("./skills/DroidRhythm");
|
|
10
|
+
const DroidVisual_1 = require("./skills/DroidVisual");
|
|
10
11
|
/**
|
|
11
12
|
* Difficulty calculator for osu!droid gamemode.
|
|
12
13
|
*/
|
|
@@ -29,6 +30,10 @@ class DroidStarRating extends StarRating_1.StarRating {
|
|
|
29
30
|
* The flashlight star rating of the beatmap.
|
|
30
31
|
*/
|
|
31
32
|
this.flashlight = 0;
|
|
33
|
+
/**
|
|
34
|
+
* The visual star rating of the beatmap.
|
|
35
|
+
*/
|
|
36
|
+
this.visual = 0;
|
|
32
37
|
this.difficultyMultiplier = 0.18;
|
|
33
38
|
}
|
|
34
39
|
/**
|
|
@@ -85,15 +90,25 @@ class DroidStarRating extends StarRating_1.StarRating {
|
|
|
85
90
|
this.calculateSkills(flashlightSkill);
|
|
86
91
|
this.postCalculateFlashlight(flashlightSkill);
|
|
87
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Calculates the visual star rating of the beatmap and stores it in this instance.
|
|
95
|
+
*/
|
|
96
|
+
calculateVisual() {
|
|
97
|
+
const visualSkill = new DroidVisual_1.DroidVisual(this.mods, osu_base_1.MapStats.arToMS(this.stats.ar));
|
|
98
|
+
this.calculateSkills(visualSkill);
|
|
99
|
+
this.postCalculateVisual(visualSkill);
|
|
100
|
+
}
|
|
88
101
|
calculateTotal() {
|
|
89
102
|
const aimPerformanceValue = this.basePerformanceValue(this.aim);
|
|
90
103
|
const tapPerformanceValue = this.basePerformanceValue(this.tap);
|
|
91
104
|
const flashlightPerformanceValue = this.mods.some((m) => m instanceof osu_base_1.ModFlashlight)
|
|
92
105
|
? Math.pow(this.flashlight, 2) * 25
|
|
93
106
|
: 0;
|
|
107
|
+
const visualPerformanceValue = Math.pow(this.visual, 2) * 25;
|
|
94
108
|
const basePerformanceValue = Math.pow(Math.pow(aimPerformanceValue, 1.1) +
|
|
95
109
|
Math.pow(tapPerformanceValue, 1.1) +
|
|
96
|
-
Math.pow(flashlightPerformanceValue, 1.1)
|
|
110
|
+
Math.pow(flashlightPerformanceValue, 1.1) +
|
|
111
|
+
Math.pow(visualPerformanceValue, 1.1), 1 / 1.1);
|
|
97
112
|
if (basePerformanceValue > 1e-5) {
|
|
98
113
|
this.total =
|
|
99
114
|
Math.cbrt(1.12) *
|
|
@@ -111,6 +126,7 @@ class DroidStarRating extends StarRating_1.StarRating {
|
|
|
111
126
|
const rhythmSkill = skills[2];
|
|
112
127
|
const tapSkill = skills[3];
|
|
113
128
|
const flashlightSkill = skills[4];
|
|
129
|
+
const visualSkill = skills[5];
|
|
114
130
|
this.postCalculateAim(aimSkill, aimSkillWithoutSliders);
|
|
115
131
|
if (!isRelax) {
|
|
116
132
|
this.postCalculateTap(tapSkill);
|
|
@@ -122,6 +138,7 @@ class DroidStarRating extends StarRating_1.StarRating {
|
|
|
122
138
|
this.postCalculateRhythm(rhythmSkill);
|
|
123
139
|
}
|
|
124
140
|
this.postCalculateFlashlight(flashlightSkill);
|
|
141
|
+
this.postCalculateVisual(visualSkill);
|
|
125
142
|
this.calculateTotal();
|
|
126
143
|
}
|
|
127
144
|
/**
|
|
@@ -137,7 +154,9 @@ class DroidStarRating extends StarRating_1.StarRating {
|
|
|
137
154
|
this.rhythm.toFixed(2) +
|
|
138
155
|
" rhythm, " +
|
|
139
156
|
this.flashlight.toFixed(2) +
|
|
140
|
-
" flashlight
|
|
157
|
+
" flashlight, " +
|
|
158
|
+
this.visual.toFixed(2) +
|
|
159
|
+
" visual)");
|
|
141
160
|
}
|
|
142
161
|
/**
|
|
143
162
|
* Creates skills to be calculated.
|
|
@@ -150,6 +169,7 @@ class DroidStarRating extends StarRating_1.StarRating {
|
|
|
150
169
|
new DroidRhythm_1.DroidRhythm(this.mods, this.stats.od),
|
|
151
170
|
new DroidTap_1.DroidTap(this.mods, this.stats.od),
|
|
152
171
|
new DroidFlashlight_1.DroidFlashlight(this.mods),
|
|
172
|
+
new DroidVisual_1.DroidVisual(this.mods, osu_base_1.MapStats.arToMS(this.stats.ar)),
|
|
153
173
|
];
|
|
154
174
|
}
|
|
155
175
|
/**
|
|
@@ -205,5 +225,13 @@ class DroidStarRating extends StarRating_1.StarRating {
|
|
|
205
225
|
this.strainPeaks.flashlight = flashlightSkill.strainPeaks;
|
|
206
226
|
this.flashlight = this.starValue(flashlightSkill.difficultyValue());
|
|
207
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* Called after visual skill calculation.
|
|
230
|
+
*
|
|
231
|
+
* @param visualSkill The visual skill.
|
|
232
|
+
*/
|
|
233
|
+
postCalculateVisual(visualSkill) {
|
|
234
|
+
this.visual = this.starValue(visualSkill.difficultyValue());
|
|
235
|
+
}
|
|
208
236
|
}
|
|
209
237
|
exports.DroidStarRating = DroidStarRating;
|
|
@@ -30,17 +30,19 @@ class OsuPerformanceCalculator extends PerformanceCalculator_1.PerformanceCalcul
|
|
|
30
30
|
this.flashlight = 0;
|
|
31
31
|
}
|
|
32
32
|
calculate(params) {
|
|
33
|
-
this.
|
|
33
|
+
return this.calculateInternal(params, osu_base_1.modes.osu);
|
|
34
|
+
}
|
|
35
|
+
calculateValues() {
|
|
34
36
|
this.calculateAimValue();
|
|
35
37
|
this.calculateSpeedValue();
|
|
36
38
|
this.calculateAccuracyValue();
|
|
37
39
|
this.calculateFlashlightValue();
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
}
|
|
41
|
+
calculateTotalValue() {
|
|
42
|
+
return (Math.pow(Math.pow(this.aim, 1.1) +
|
|
43
|
+
Math.pow(this.speed, 1.1) +
|
|
44
|
+
Math.pow(this.accuracy, 1.1) +
|
|
45
|
+
Math.pow(this.flashlight, 1.1), 1 / 1.1) * this.finalMultiplier);
|
|
44
46
|
}
|
|
45
47
|
/**
|
|
46
48
|
* Calculates the aim performance value of the beatmap.
|
|
@@ -33,7 +33,16 @@ class PerformanceCalculator {
|
|
|
33
33
|
this.sliderNerfFactor = 1;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* Internal calculation method, used to process calculation from implementations.
|
|
37
|
+
*/
|
|
38
|
+
calculateInternal(params, mode) {
|
|
39
|
+
this.handleParams(params, mode);
|
|
40
|
+
this.calculateValues();
|
|
41
|
+
this.total = this.calculateTotalValue();
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Calculates the base performance value of a star rating.
|
|
37
46
|
*/
|
|
38
47
|
baseValue(stars) {
|
|
39
48
|
return Math.pow(5 * Math.max(1, stars / 0.0675) - 4, 3) / 100000;
|
package/dist/base/StarRating.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -18,6 +18,7 @@ __exportStar(require("./DroidPerformanceCalculator"), exports);
|
|
|
18
18
|
__exportStar(require("./skills/DroidRhythm"), exports);
|
|
19
19
|
__exportStar(require("./DroidStarRating"), exports);
|
|
20
20
|
__exportStar(require("./skills/DroidTap"), exports);
|
|
21
|
+
__exportStar(require("./skills/DroidVisual"), exports);
|
|
21
22
|
__exportStar(require("./MapStars"), exports);
|
|
22
23
|
__exportStar(require("./skills/OsuAim"), exports);
|
|
23
24
|
__exportStar(require("./skills/OsuFlashlight"), exports);
|
|
@@ -40,6 +40,10 @@ class DifficultyHitObject {
|
|
|
40
40
|
* The flashlight strain generated by the hitobject.
|
|
41
41
|
*/
|
|
42
42
|
this.flashlightStrain = 0;
|
|
43
|
+
/**
|
|
44
|
+
* The visual strain generated by the hitobject.
|
|
45
|
+
*/
|
|
46
|
+
this.visualStrain = 0;
|
|
43
47
|
/**
|
|
44
48
|
* The normalized distance from the "lazy" end position of the previous hitobject to the start position of this hitobject.
|
|
45
49
|
*
|
|
@@ -89,6 +93,16 @@ class DifficultyHitObject {
|
|
|
89
93
|
* Adjusted start time of the hitobject, taking speed multiplier into account.
|
|
90
94
|
*/
|
|
91
95
|
this.startTime = 0;
|
|
96
|
+
/**
|
|
97
|
+
* The note density of the hitobject.
|
|
98
|
+
*/
|
|
99
|
+
this.noteDensity = 0;
|
|
100
|
+
/**
|
|
101
|
+
* The overlapping factor of the hitobject.
|
|
102
|
+
*
|
|
103
|
+
* This is used to scale visual skill.
|
|
104
|
+
*/
|
|
105
|
+
this.overlappingFactor = 0;
|
|
92
106
|
this.object = object;
|
|
93
107
|
}
|
|
94
108
|
}
|
|
@@ -32,6 +32,7 @@ class DifficultyHitObjectCreator {
|
|
|
32
32
|
* Generates difficulty hitobjects for difficulty calculation.
|
|
33
33
|
*/
|
|
34
34
|
generateDifficultyObjects(params) {
|
|
35
|
+
params.preempt ??= 600;
|
|
35
36
|
this.mode = params.mode;
|
|
36
37
|
const circleSize = params.circleSize;
|
|
37
38
|
const scale = (1 - (0.7 * (circleSize - 5)) / 5) / 2;
|
|
@@ -59,8 +60,31 @@ class DifficultyHitObjectCreator {
|
|
|
59
60
|
object.deltaTime =
|
|
60
61
|
(object.object.startTime - lastObject.object.startTime) /
|
|
61
62
|
params.speedMultiplier;
|
|
62
|
-
// Cap to 25ms to prevent difficulty calculation breaking from
|
|
63
|
+
// Cap to 25ms to prevent difficulty calculation breaking from simultaneous objects.
|
|
63
64
|
object.strainTime = Math.max(this.minDeltaTime, object.deltaTime);
|
|
65
|
+
const visibleObjects = params.objects.filter((o) => o.startTime / params.speedMultiplier > object.startTime &&
|
|
66
|
+
o.startTime / params.speedMultiplier <=
|
|
67
|
+
object.startTime + params.preempt);
|
|
68
|
+
object.noteDensity = 1;
|
|
69
|
+
for (const hitObject of visibleObjects) {
|
|
70
|
+
const deltaTime = Math.abs(hitObject.startTime / params.speedMultiplier -
|
|
71
|
+
object.startTime);
|
|
72
|
+
object.noteDensity += 1 - deltaTime / params.preempt;
|
|
73
|
+
if (!(hitObject instanceof osu_base_1.Spinner)) {
|
|
74
|
+
object.overlappingFactor +=
|
|
75
|
+
(0.8 *
|
|
76
|
+
// Penalize objects that are too close to the object in both distance
|
|
77
|
+
// and delta time to prevent stream maps from being overweighted.
|
|
78
|
+
Math.max(0, 1 -
|
|
79
|
+
object.object.stackedPosition.getDistance(hitObject.stackedEndPosition) /
|
|
80
|
+
(1.5 * object.object.radius)) *
|
|
81
|
+
50) /
|
|
82
|
+
(1 +
|
|
83
|
+
Math.exp(0.15 *
|
|
84
|
+
(Math.max(deltaTime, this.minDeltaTime) -
|
|
85
|
+
75)));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
64
88
|
if (object.object instanceof osu_base_1.Spinner ||
|
|
65
89
|
lastObject.object instanceof osu_base_1.Spinner) {
|
|
66
90
|
difficultyObjects.push(object);
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DroidVisual = void 0;
|
|
4
|
+
const osu_base_1 = require("@rian8337/osu-base");
|
|
5
|
+
const DroidSkill_1 = require("./DroidSkill");
|
|
6
|
+
/**
|
|
7
|
+
* Represents the skill required to read every object in the map.
|
|
8
|
+
*/
|
|
9
|
+
class DroidVisual extends DroidSkill_1.DroidSkill {
|
|
10
|
+
constructor(mods, preempt) {
|
|
11
|
+
super(mods);
|
|
12
|
+
this.historyLength = 16;
|
|
13
|
+
this.starsPerDouble = 1.025;
|
|
14
|
+
this.reducedSectionCount = 10;
|
|
15
|
+
this.reducedSectionBaseline = 0.75;
|
|
16
|
+
this.skillMultiplier = 20;
|
|
17
|
+
this.strainDecayBase = 0.1;
|
|
18
|
+
this.preempt = preempt;
|
|
19
|
+
this.isHidden = mods.some((m) => m instanceof osu_base_1.ModHidden);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @param current The hitobject to calculate.
|
|
23
|
+
*/
|
|
24
|
+
strainValueOf(current) {
|
|
25
|
+
if (current.object instanceof osu_base_1.Spinner) {
|
|
26
|
+
return 0;
|
|
27
|
+
}
|
|
28
|
+
// Start with base density and give minimum global bonus for Hidden.
|
|
29
|
+
let strain = (0.25 * current.noteDensity) / (1 + current.overlappingFactor * 5);
|
|
30
|
+
if (this.isHidden) {
|
|
31
|
+
strain +=
|
|
32
|
+
(0.1 * current.noteDensity) /
|
|
33
|
+
(1 + current.overlappingFactor * 2);
|
|
34
|
+
}
|
|
35
|
+
// Give bonus for AR higher than 10.33 or lower than 8.
|
|
36
|
+
if (this.preempt < 400) {
|
|
37
|
+
strain +=
|
|
38
|
+
(0.0225 * (400 - this.preempt)) /
|
|
39
|
+
(1 + current.overlappingFactor * 1.5);
|
|
40
|
+
}
|
|
41
|
+
else if (this.preempt > 750) {
|
|
42
|
+
strain +=
|
|
43
|
+
((this.isHidden ? 0.007 : 0.006) * (this.preempt - 750)) /
|
|
44
|
+
(1 + current.overlappingFactor * 2);
|
|
45
|
+
}
|
|
46
|
+
return strain;
|
|
47
|
+
}
|
|
48
|
+
strainValueAt(current) {
|
|
49
|
+
this.currentStrain *= this.strainDecay(current.deltaTime);
|
|
50
|
+
this.currentStrain +=
|
|
51
|
+
this.strainValueOf(current) * this.skillMultiplier;
|
|
52
|
+
return this.currentStrain;
|
|
53
|
+
}
|
|
54
|
+
saveToHitObject(current) {
|
|
55
|
+
current.visualStrain = this.currentStrain;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.DroidVisual = DroidVisual;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rian8337/osu-rebalance-difficulty-calculator",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"description": "A module for calculating osu!standard beatmap difficulty and performance value with respect to the latest osu!lazer difficulty and performance algorithm.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"osu",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"url": "https://github.com/Rian8337/osu-droid-module/issues"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@rian8337/osu-base": "^1.2
|
|
33
|
+
"@rian8337/osu-base": "^1.4.2"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "8338a2a1a34d7e83e77e98d1d54b0741c79c51f9"
|
|
39
39
|
}
|
package/typings/index.d.ts
CHANGED
|
@@ -52,6 +52,10 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
52
52
|
* The flashlight strain generated by the hitobject.
|
|
53
53
|
*/
|
|
54
54
|
flashlightStrain: number;
|
|
55
|
+
/**
|
|
56
|
+
* The visual strain generated by the hitobject.
|
|
57
|
+
*/
|
|
58
|
+
visualStrain: number;
|
|
55
59
|
/**
|
|
56
60
|
* The normalized distance from the "lazy" end position of the previous hitobject to the start position of this hitobject.
|
|
57
61
|
*
|
|
@@ -101,6 +105,16 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
101
105
|
* Adjusted start time of the hitobject, taking speed multiplier into account.
|
|
102
106
|
*/
|
|
103
107
|
startTime: number;
|
|
108
|
+
/**
|
|
109
|
+
* The note density of the hitobject.
|
|
110
|
+
*/
|
|
111
|
+
noteDensity: number;
|
|
112
|
+
/**
|
|
113
|
+
* The overlapping factor of the hitobject.
|
|
114
|
+
*
|
|
115
|
+
* This is used to scale visual skill.
|
|
116
|
+
*/
|
|
117
|
+
overlappingFactor: number;
|
|
104
118
|
/**
|
|
105
119
|
* @param object The underlying hitobject.
|
|
106
120
|
*/
|
|
@@ -135,6 +149,7 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
135
149
|
circleSize: number;
|
|
136
150
|
speedMultiplier: number;
|
|
137
151
|
mode: modes;
|
|
152
|
+
preempt?: number;
|
|
138
153
|
}): DifficultyHitObject[];
|
|
139
154
|
/**
|
|
140
155
|
* Calculates a slider's cursor position.
|
|
@@ -182,7 +197,7 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
182
197
|
*/
|
|
183
198
|
protected override strainValueAt(current: DifficultyHitObject): number;
|
|
184
199
|
/**
|
|
185
|
-
* @param
|
|
200
|
+
* @param current The hitobject to save to.
|
|
186
201
|
*/
|
|
187
202
|
protected override saveToHitObject(current: DifficultyHitObject): void;
|
|
188
203
|
}
|
|
@@ -233,6 +248,11 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
233
248
|
* The flashlight performance value.
|
|
234
249
|
*/
|
|
235
250
|
flashlight: number;
|
|
251
|
+
/**
|
|
252
|
+
* The visual performance value.
|
|
253
|
+
*/
|
|
254
|
+
visual: number;
|
|
255
|
+
private tapPenalty: number;
|
|
236
256
|
override calculate(params: {
|
|
237
257
|
/**
|
|
238
258
|
* The star rating instance to calculate.
|
|
@@ -259,6 +279,8 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
259
279
|
*/
|
|
260
280
|
stats?: MapStats;
|
|
261
281
|
}): this;
|
|
282
|
+
protected override calculateValues(): void;
|
|
283
|
+
protected override calculateTotalValue(): number;
|
|
262
284
|
/**
|
|
263
285
|
* Calculates the aim performance value of the beatmap.
|
|
264
286
|
*/
|
|
@@ -275,6 +297,10 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
275
297
|
* Calculates the flashlight performance value of the beatmap.
|
|
276
298
|
*/
|
|
277
299
|
private calculateFlashlightValue(): void;
|
|
300
|
+
/**
|
|
301
|
+
* Calculates the visual performance value of the beatmap.
|
|
302
|
+
*/
|
|
303
|
+
private calculateVisualValue(): void;
|
|
278
304
|
override toString(): string;
|
|
279
305
|
}
|
|
280
306
|
|
|
@@ -321,6 +347,10 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
321
347
|
* The flashlight star rating of the beatmap.
|
|
322
348
|
*/
|
|
323
349
|
flashlight: number;
|
|
350
|
+
/**
|
|
351
|
+
* The visual star rating of the beatmap.
|
|
352
|
+
*/
|
|
353
|
+
visual: number;
|
|
324
354
|
protected override readonly difficultyMultiplier: number;
|
|
325
355
|
/**
|
|
326
356
|
* Calculates the star rating of the specified beatmap.
|
|
@@ -370,6 +400,10 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
370
400
|
* Calculates the flashlight star rating of the beatmap and stores it in this instance.
|
|
371
401
|
*/
|
|
372
402
|
calculateFlashlight(): void;
|
|
403
|
+
/**
|
|
404
|
+
* Calculates the visual star rating of the beatmap and stores it in this instance.
|
|
405
|
+
*/
|
|
406
|
+
calculateVisual(): void;
|
|
373
407
|
/**
|
|
374
408
|
* Calculates the total star rating of the beatmap and stores it in this instance.
|
|
375
409
|
*/
|
|
@@ -418,6 +452,12 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
418
452
|
* @param flashlightSkill The flashlight skill.
|
|
419
453
|
*/
|
|
420
454
|
private postCalculateFlashlight(flashlightSkill: DroidFlashlight): void;
|
|
455
|
+
/**
|
|
456
|
+
* Called after visual skill calculation.
|
|
457
|
+
*
|
|
458
|
+
* @param visualSkill The visual skill.
|
|
459
|
+
*/
|
|
460
|
+
private postCalculateVisual(visualSkill: DroidVisual): void;
|
|
421
461
|
}
|
|
422
462
|
|
|
423
463
|
/**
|
|
@@ -453,6 +493,32 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
453
493
|
protected override saveToHitObject(current: DifficultyHitObject): void;
|
|
454
494
|
}
|
|
455
495
|
|
|
496
|
+
/**
|
|
497
|
+
* Represents the skill required to read every object in the map.
|
|
498
|
+
*/
|
|
499
|
+
export class DroidVisual extends DroidSkill {
|
|
500
|
+
protected override readonly skillMultiplier: number;
|
|
501
|
+
protected override readonly strainDecayBase: number;
|
|
502
|
+
protected override readonly reducedSectionBaseline: number;
|
|
503
|
+
protected override readonly reducedSectionCount: number;
|
|
504
|
+
protected override readonly starsPerDouble: number;
|
|
505
|
+
private readonly preempt: number;
|
|
506
|
+
private readonly isHidden: boolean;
|
|
507
|
+
constructor(mods: Mod[], preempt: number);
|
|
508
|
+
/**
|
|
509
|
+
* @param current The hitobject to calculate.
|
|
510
|
+
*/
|
|
511
|
+
protected strainValueOf(current: DifficultyHitObject): number;
|
|
512
|
+
/**
|
|
513
|
+
* @param current The hitobject to calculate.
|
|
514
|
+
*/
|
|
515
|
+
protected override strainValueAt(current: DifficultyHitObject): number;
|
|
516
|
+
/**
|
|
517
|
+
* @param current The hitobject to save to.
|
|
518
|
+
*/
|
|
519
|
+
protected override saveToHitObject(current: DifficultyHitObject): void;
|
|
520
|
+
}
|
|
521
|
+
|
|
456
522
|
/**
|
|
457
523
|
* A star rating calculator that configures which mode to calculate difficulty for and what mods are applied.
|
|
458
524
|
*/
|
|
@@ -587,6 +653,8 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
587
653
|
*/
|
|
588
654
|
stats?: MapStats;
|
|
589
655
|
}): this;
|
|
656
|
+
protected override calculateValues(): void;
|
|
657
|
+
protected override calculateTotalValue(): number;
|
|
590
658
|
/**
|
|
591
659
|
* Calculates the aim performance value of the beatmap.
|
|
592
660
|
*/
|
|
@@ -865,10 +933,6 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
865
933
|
* The amount of misses achieved in the score.
|
|
866
934
|
*/
|
|
867
935
|
miss?: number;
|
|
868
|
-
/**
|
|
869
|
-
* The gamemode to calculate.
|
|
870
|
-
*/
|
|
871
|
-
mode?: modes;
|
|
872
936
|
/**
|
|
873
937
|
* The tap penalty to apply for penalized scores. Only applies to droid gamemode.
|
|
874
938
|
*/
|
|
@@ -883,13 +947,53 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
883
947
|
*/
|
|
884
948
|
abstract toString(): string;
|
|
885
949
|
/**
|
|
886
|
-
*
|
|
950
|
+
* Internal calculation method, used to process calculation from implementations.
|
|
951
|
+
*/
|
|
952
|
+
protected calculateInternal(
|
|
953
|
+
params: {
|
|
954
|
+
/**
|
|
955
|
+
* The star rating instance to calculate.
|
|
956
|
+
*/
|
|
957
|
+
stars: StarRating;
|
|
958
|
+
/**
|
|
959
|
+
* The maximum combo achieved in the score.
|
|
960
|
+
*/
|
|
961
|
+
combo?: number;
|
|
962
|
+
/**
|
|
963
|
+
* The accuracy achieved in the score.
|
|
964
|
+
*/
|
|
965
|
+
accPercent?: Accuracy | number;
|
|
966
|
+
/**
|
|
967
|
+
* The amount of misses achieved in the score.
|
|
968
|
+
*/
|
|
969
|
+
miss?: number;
|
|
970
|
+
/**
|
|
971
|
+
* The tap penalty to apply for penalized scores. Only applies to droid gamemode.
|
|
972
|
+
*/
|
|
973
|
+
tapPenalty?: number;
|
|
974
|
+
/**
|
|
975
|
+
* Custom map statistics to apply custom speed multiplier and force AR values as well as old statistics.
|
|
976
|
+
*/
|
|
977
|
+
stats?: MapStats;
|
|
978
|
+
},
|
|
979
|
+
mode: modes
|
|
980
|
+
): this;
|
|
981
|
+
/**
|
|
982
|
+
* Calculates values that will be used for calculating the total performance value of the beatmap.
|
|
983
|
+
*/
|
|
984
|
+
protected abstract calculateValues(): void;
|
|
985
|
+
/**
|
|
986
|
+
* Calculates the total performance value of the beatmap.
|
|
987
|
+
*/
|
|
988
|
+
protected abstract calculateTotalValue(): number;
|
|
989
|
+
/**
|
|
990
|
+
* Calculates the base performance value of a star rating.
|
|
887
991
|
*/
|
|
888
992
|
protected baseValue(stars: number): number;
|
|
889
993
|
/**
|
|
890
994
|
* Processes given parameters for usage in performance calculation.
|
|
891
995
|
*/
|
|
892
|
-
|
|
996
|
+
private handleParams(
|
|
893
997
|
params: {
|
|
894
998
|
/**
|
|
895
999
|
* The star rating instance to calculate.
|
|
@@ -907,10 +1011,6 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
907
1011
|
* The amount of misses achieved in the score.
|
|
908
1012
|
*/
|
|
909
1013
|
miss?: number;
|
|
910
|
-
/**
|
|
911
|
-
* The gamemode to calculate.
|
|
912
|
-
*/
|
|
913
|
-
mode?: modes;
|
|
914
1014
|
/**
|
|
915
1015
|
* The tap penalty to apply for penalized scores.
|
|
916
1016
|
*/
|