@rian8337/osu-rebalance-difficulty-calculator 1.2.8 → 1.4.2
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 +56 -65
- package/dist/DroidStarRating.js +30 -8
- 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 +27 -1
- package/dist/skills/DroidVisual.js +58 -0
- package/package.json +3 -3
- package/typings/index.d.ts +110 -17
|
@@ -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,39 +60,15 @@ 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.
|
|
66
|
+
this.aim *=
|
|
67
|
+
0.97 *
|
|
68
|
+
Math.pow(1 - Math.pow(this.effectiveMissCount / objectCount, 0.775), this.effectiveMissCount);
|
|
57
69
|
}
|
|
58
70
|
// Combo scaling
|
|
59
71
|
this.aim *= this.comboPenalty;
|
|
60
|
-
// We want to give more reward for lower AR when it comes to aim and HD. This nerfs high AR and buffs lower AR.
|
|
61
|
-
if (this.stars.mods.some((m) => m instanceof osu_base_1.ModHidden)) {
|
|
62
|
-
// The bonus starts decreasing twice as fast
|
|
63
|
-
// beyond AR10 and reaches 1 at AR11.
|
|
64
|
-
if (calculatedAR > 10) {
|
|
65
|
-
this.aim *= 1 + Math.max(0, 0.08 * (11 - calculatedAR));
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
this.aim *= 1 + 0.04 * (12 - calculatedAR);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
// AR scaling
|
|
72
|
-
let arFactor = 0;
|
|
73
|
-
if (calculatedAR > 10.33) {
|
|
74
|
-
arFactor += 0.3 * (calculatedAR - 10.33);
|
|
75
|
-
}
|
|
76
|
-
else if (calculatedAR < 8) {
|
|
77
|
-
arFactor += 0.1 * (8 - calculatedAR);
|
|
78
|
-
}
|
|
79
|
-
// Buff for longer maps with high AR.
|
|
80
|
-
this.aim *=
|
|
81
|
-
1 +
|
|
82
|
-
arFactor *
|
|
83
|
-
(1.650668 +
|
|
84
|
-
(0.4845796 - 1.650668) /
|
|
85
|
-
(1 + Math.pow(objectCount / 817.9306, 1.147469)));
|
|
86
72
|
// Scale the aim value with slider factor to nerf very likely dropped sliderends.
|
|
87
73
|
this.aim *= this.sliderNerfFactor;
|
|
88
74
|
// Scale the aim value with accuracy.
|
|
@@ -98,24 +84,15 @@ class DroidPerformanceCalculator extends PerformanceCalculator_1.PerformanceCalc
|
|
|
98
84
|
calculateTapValue() {
|
|
99
85
|
// Global variables
|
|
100
86
|
const objectCount = this.stars.objects.length;
|
|
101
|
-
const calculatedAR = this.mapStatistics.ar;
|
|
102
87
|
this.tap = this.baseValue(this.stars.tap);
|
|
103
88
|
if (this.effectiveMissCount > 0) {
|
|
104
|
-
|
|
89
|
+
// Penalize misses by assessing # of misses relative to the total # of objects. Default a 3% reduction for any # of misses.
|
|
90
|
+
this.tap *=
|
|
91
|
+
0.97 *
|
|
92
|
+
Math.pow(1 - Math.pow(this.effectiveMissCount / objectCount, 0.775), Math.pow(this.effectiveMissCount, 0.875));
|
|
105
93
|
}
|
|
106
94
|
// Combo scaling
|
|
107
95
|
this.tap *= this.comboPenalty;
|
|
108
|
-
// AR scaling
|
|
109
|
-
if (calculatedAR > 10.33) {
|
|
110
|
-
// Buff for longer maps with high AR.
|
|
111
|
-
this.tap *=
|
|
112
|
-
1 +
|
|
113
|
-
0.3 *
|
|
114
|
-
(calculatedAR - 10.33) *
|
|
115
|
-
(1.650668 +
|
|
116
|
-
(0.4845796 - 1.650668) /
|
|
117
|
-
(1 + Math.pow(objectCount / 817.9306, 1.147469)));
|
|
118
|
-
}
|
|
119
96
|
// Calculate accuracy assuming the worst case scenario.
|
|
120
97
|
const countGreat = this.computedAccuracy.n300;
|
|
121
98
|
const countOk = this.computedAccuracy.n100;
|
|
@@ -211,6 +188,32 @@ class DroidPerformanceCalculator extends PerformanceCalculator_1.PerformanceCalc
|
|
|
211
188
|
this.flashlight *=
|
|
212
189
|
0.98 + (this.mapStatistics.od >= 0 ? odScaling : -odScaling);
|
|
213
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
|
+
}
|
|
214
217
|
toString() {
|
|
215
218
|
return (this.total.toFixed(2) +
|
|
216
219
|
" pp (" +
|
|
@@ -221,21 +224,9 @@ class DroidPerformanceCalculator extends PerformanceCalculator_1.PerformanceCalc
|
|
|
221
224
|
this.accuracy.toFixed(2) +
|
|
222
225
|
" acc, " +
|
|
223
226
|
this.flashlight.toFixed(2) +
|
|
224
|
-
" flashlight
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
* Calculates miss penalty.
|
|
228
|
-
*
|
|
229
|
-
* @param difficultStrainCount Difficult strain count from calculation.
|
|
230
|
-
* @returns The miss penalty.
|
|
231
|
-
*/
|
|
232
|
-
calculateMissPenalty(difficultStrainCount) {
|
|
233
|
-
// Miss penalty assumes that a player will miss on the hardest parts of a map,
|
|
234
|
-
// so we use the amount of relatively difficult sections to adjust miss penalty
|
|
235
|
-
// to make it more punishing on maps with lower amount of hard sections.
|
|
236
|
-
return (0.97 /
|
|
237
|
-
(this.effectiveMissCount / (2 * Math.sqrt(difficultStrainCount)) +
|
|
238
|
-
1));
|
|
227
|
+
" flashlight, " +
|
|
228
|
+
this.visual.toFixed(2) +
|
|
229
|
+
" visual)");
|
|
239
230
|
}
|
|
240
231
|
}
|
|
241
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
|
/**
|
|
@@ -167,11 +187,6 @@ class DroidStarRating extends StarRating_1.StarRating {
|
|
|
167
187
|
this.starValue(aimSkillWithoutSliders.difficultyValue()) /
|
|
168
188
|
this.aim;
|
|
169
189
|
}
|
|
170
|
-
const objectStrains = this.objects.map((v) => v.aimStrainWithSliders);
|
|
171
|
-
const maxStrain = Math.max(...objectStrains);
|
|
172
|
-
if (maxStrain) {
|
|
173
|
-
this.attributes.aimDifficultStrainCount = objectStrains.reduce((a, v) => a + Math.pow(v / maxStrain, 4), 0);
|
|
174
|
-
}
|
|
175
190
|
}
|
|
176
191
|
/**
|
|
177
192
|
* Called after tap skill calculation.
|
|
@@ -191,7 +206,6 @@ class DroidStarRating extends StarRating_1.StarRating {
|
|
|
191
206
|
const maxStrain = Math.max(...objectStrains);
|
|
192
207
|
if (maxStrain) {
|
|
193
208
|
this.attributes.speedNoteCount = objectStrains.reduce((total, next) => total + 1 / (1 + Math.exp(-((next / maxStrain) * 12 - 6))), 0);
|
|
194
|
-
this.attributes.speedDifficultStrainCount = objectStrains.reduce((a, v) => a + Math.pow(v / maxStrain, 4), 0);
|
|
195
209
|
}
|
|
196
210
|
}
|
|
197
211
|
/**
|
|
@@ -211,5 +225,13 @@ class DroidStarRating extends StarRating_1.StarRating {
|
|
|
211
225
|
this.strainPeaks.flashlight = flashlightSkill.strainPeaks;
|
|
212
226
|
this.flashlight = this.starValue(flashlightSkill.difficultyValue());
|
|
213
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
|
+
}
|
|
214
236
|
}
|
|
215
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,33 @@ 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
|
+
// Set delta time penalty cap to 150 BPM 1/2.
|
|
82
|
+
(1 +
|
|
83
|
+
49 /
|
|
84
|
+
(1 +
|
|
85
|
+
Math.exp(0.15 *
|
|
86
|
+
(Math.max(deltaTime, this.minDeltaTime) -
|
|
87
|
+
75))));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
64
90
|
if (object.object instanceof osu_base_1.Spinner ||
|
|
65
91
|
lastObject.object instanceof osu_base_1.Spinner) {
|
|
66
92
|
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
|
+
((this.isHidden ? 0.03 : 0.025) * (400 - this.preempt)) /
|
|
39
|
+
(1 + current.overlappingFactor);
|
|
40
|
+
}
|
|
41
|
+
else if (this.preempt > 750) {
|
|
42
|
+
strain +=
|
|
43
|
+
((this.isHidden ? 0.007 : 0.006) * (this.preempt - 750)) /
|
|
44
|
+
(1 + current.overlappingFactor);
|
|
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.2
|
|
3
|
+
"version": "1.4.2",
|
|
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": "5dee4c74e815dfee236e912ce40a6a7d363d62be"
|
|
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,14 +297,11 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
275
297
|
* Calculates the flashlight performance value of the beatmap.
|
|
276
298
|
*/
|
|
277
299
|
private calculateFlashlightValue(): void;
|
|
278
|
-
override toString(): string;
|
|
279
300
|
/**
|
|
280
|
-
* Calculates
|
|
281
|
-
*
|
|
282
|
-
* @param difficultStrainCount Difficult strain count from calculation.
|
|
283
|
-
* @returns The miss penalty.
|
|
301
|
+
* Calculates the visual performance value of the beatmap.
|
|
284
302
|
*/
|
|
285
|
-
private
|
|
303
|
+
private calculateVisualValue(): void;
|
|
304
|
+
override toString(): string;
|
|
286
305
|
}
|
|
287
306
|
|
|
288
307
|
/**
|
|
@@ -328,6 +347,10 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
328
347
|
* The flashlight star rating of the beatmap.
|
|
329
348
|
*/
|
|
330
349
|
flashlight: number;
|
|
350
|
+
/**
|
|
351
|
+
* The visual star rating of the beatmap.
|
|
352
|
+
*/
|
|
353
|
+
visual: number;
|
|
331
354
|
protected override readonly difficultyMultiplier: number;
|
|
332
355
|
/**
|
|
333
356
|
* Calculates the star rating of the specified beatmap.
|
|
@@ -377,6 +400,10 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
377
400
|
* Calculates the flashlight star rating of the beatmap and stores it in this instance.
|
|
378
401
|
*/
|
|
379
402
|
calculateFlashlight(): void;
|
|
403
|
+
/**
|
|
404
|
+
* Calculates the visual star rating of the beatmap and stores it in this instance.
|
|
405
|
+
*/
|
|
406
|
+
calculateVisual(): void;
|
|
380
407
|
/**
|
|
381
408
|
* Calculates the total star rating of the beatmap and stores it in this instance.
|
|
382
409
|
*/
|
|
@@ -425,6 +452,12 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
425
452
|
* @param flashlightSkill The flashlight skill.
|
|
426
453
|
*/
|
|
427
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;
|
|
428
461
|
}
|
|
429
462
|
|
|
430
463
|
/**
|
|
@@ -460,6 +493,32 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
460
493
|
protected override saveToHitObject(current: DifficultyHitObject): void;
|
|
461
494
|
}
|
|
462
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
|
+
|
|
463
522
|
/**
|
|
464
523
|
* A star rating calculator that configures which mode to calculate difficulty for and what mods are applied.
|
|
465
524
|
*/
|
|
@@ -594,6 +653,8 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
594
653
|
*/
|
|
595
654
|
stats?: MapStats;
|
|
596
655
|
}): this;
|
|
656
|
+
protected override calculateValues(): void;
|
|
657
|
+
protected override calculateTotalValue(): number;
|
|
597
658
|
/**
|
|
598
659
|
* Calculates the aim performance value of the beatmap.
|
|
599
660
|
*/
|
|
@@ -872,10 +933,6 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
872
933
|
* The amount of misses achieved in the score.
|
|
873
934
|
*/
|
|
874
935
|
miss?: number;
|
|
875
|
-
/**
|
|
876
|
-
* The gamemode to calculate.
|
|
877
|
-
*/
|
|
878
|
-
mode?: modes;
|
|
879
936
|
/**
|
|
880
937
|
* The tap penalty to apply for penalized scores. Only applies to droid gamemode.
|
|
881
938
|
*/
|
|
@@ -890,13 +947,53 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
890
947
|
*/
|
|
891
948
|
abstract toString(): string;
|
|
892
949
|
/**
|
|
893
|
-
*
|
|
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.
|
|
894
991
|
*/
|
|
895
992
|
protected baseValue(stars: number): number;
|
|
896
993
|
/**
|
|
897
994
|
* Processes given parameters for usage in performance calculation.
|
|
898
995
|
*/
|
|
899
|
-
|
|
996
|
+
private handleParams(
|
|
900
997
|
params: {
|
|
901
998
|
/**
|
|
902
999
|
* The star rating instance to calculate.
|
|
@@ -914,10 +1011,6 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
914
1011
|
* The amount of misses achieved in the score.
|
|
915
1012
|
*/
|
|
916
1013
|
miss?: number;
|
|
917
|
-
/**
|
|
918
|
-
* The gamemode to calculate.
|
|
919
|
-
*/
|
|
920
|
-
mode?: modes;
|
|
921
1014
|
/**
|
|
922
1015
|
* The tap penalty to apply for penalized scores.
|
|
923
1016
|
*/
|