@rian8337/osu-rebalance-difficulty-calculator 2.0.0-alpha.9 → 2.0.0
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/README.md +25 -42
- package/dist/index.js +993 -716
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/typings/index.d.ts +504 -438
package/dist/index.js
CHANGED
|
@@ -4,6 +4,32 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var osuBase = require('@rian8337/osu-base');
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* An evaluator for calculating aim skill.
|
|
9
|
+
*
|
|
10
|
+
* This class should be considered an "evaluating" class and not persisted.
|
|
11
|
+
*/
|
|
12
|
+
class AimEvaluator {
|
|
13
|
+
static wideAngleMultiplier = 1.5;
|
|
14
|
+
static acuteAngleMultiplier = 2;
|
|
15
|
+
static sliderMultiplier = 1.5;
|
|
16
|
+
static velocityChangeMultiplier = 0.75;
|
|
17
|
+
/**
|
|
18
|
+
* Calculates the bonus of wide angles.
|
|
19
|
+
*/
|
|
20
|
+
static calculateWideAngleBonus(angle) {
|
|
21
|
+
return Math.pow(Math.sin((3 / 4) *
|
|
22
|
+
(Math.min((5 / 6) * Math.PI, Math.max(Math.PI / 6, angle)) -
|
|
23
|
+
Math.PI / 6)), 2);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Calculates the bonus of acute angles.
|
|
27
|
+
*/
|
|
28
|
+
static calculateAcuteAngleBonus(angle) {
|
|
29
|
+
return 1 - this.calculateWideAngleBonus(angle);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
7
33
|
/**
|
|
8
34
|
* Represents an osu!standard hit object with difficulty calculation values.
|
|
9
35
|
*/
|
|
@@ -12,6 +38,20 @@ class DifficultyHitObject {
|
|
|
12
38
|
* The underlying hitobject.
|
|
13
39
|
*/
|
|
14
40
|
object;
|
|
41
|
+
/**
|
|
42
|
+
* The index of this hitobject in the list of all hitobjects.
|
|
43
|
+
*
|
|
44
|
+
* This is one less than the actual index of the hitobject in the beatmap.
|
|
45
|
+
*/
|
|
46
|
+
index = 0;
|
|
47
|
+
/**
|
|
48
|
+
* The preempt time of the hitobject.
|
|
49
|
+
*/
|
|
50
|
+
timePreempt = 600;
|
|
51
|
+
/**
|
|
52
|
+
* The fade in time of the hitobject.
|
|
53
|
+
*/
|
|
54
|
+
timeFadeIn = 450;
|
|
15
55
|
/**
|
|
16
56
|
* The aim strain generated by the hitobject if sliders are considered.
|
|
17
57
|
*/
|
|
@@ -103,7 +143,7 @@ class DifficultyHitObject {
|
|
|
103
143
|
/**
|
|
104
144
|
* The note density of the hitobject.
|
|
105
145
|
*/
|
|
106
|
-
noteDensity =
|
|
146
|
+
noteDensity = 1;
|
|
107
147
|
/**
|
|
108
148
|
* The overlapping factor of the hitobject.
|
|
109
149
|
*
|
|
@@ -114,11 +154,64 @@ class DifficultyHitObject {
|
|
|
114
154
|
* Adjusted velocity of the hitobject, taking speed multiplier into account.
|
|
115
155
|
*/
|
|
116
156
|
velocity = 0;
|
|
157
|
+
hitObjects;
|
|
117
158
|
/**
|
|
118
159
|
* @param object The underlying hitobject.
|
|
160
|
+
* @param hitObjects All difficulty hitobjects in the processed beatmap.
|
|
119
161
|
*/
|
|
120
|
-
constructor(object) {
|
|
162
|
+
constructor(object, hitObjects) {
|
|
121
163
|
this.object = object;
|
|
164
|
+
this.hitObjects = hitObjects;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Gets the difficulty hitobject at a specific index with respect to the current
|
|
168
|
+
* difficulty hitobject's index.
|
|
169
|
+
*
|
|
170
|
+
* Will return `null` if the index is out of range.
|
|
171
|
+
*
|
|
172
|
+
* @param backwardsIndex The index to move backwards for.
|
|
173
|
+
* @returns The difficulty hitobject at the index with respect to the current
|
|
174
|
+
* difficulty hitobject's index, `null` if the index is out of range.
|
|
175
|
+
*/
|
|
176
|
+
previous(backwardsIndex) {
|
|
177
|
+
return this.hitObjects[this.index - backwardsIndex] ?? null;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Gets the difficulty hitobject at a specific index with respect to the current
|
|
181
|
+
* difficulty hitobject's index.
|
|
182
|
+
*
|
|
183
|
+
* Will return `null` if the index is out of range.
|
|
184
|
+
*
|
|
185
|
+
* @param forwardsIndex The index to move forwards for.
|
|
186
|
+
* @returns The difficulty hitobject at the index with respect to the current
|
|
187
|
+
* difficulty hitobject's index, `null` if the index is out of range.
|
|
188
|
+
*/
|
|
189
|
+
next(forwardsIndex) {
|
|
190
|
+
return this.hitObjects[this.index + forwardsIndex + 2] ?? null;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Calculates the opacity of the hitobject at a given time.
|
|
194
|
+
*
|
|
195
|
+
* @param time The time to calculate the hitobject's opacity at.
|
|
196
|
+
* @param isHidden Whether Hidden mod is used.
|
|
197
|
+
* @returns The opacity of the hitobject at the given time.
|
|
198
|
+
*/
|
|
199
|
+
opacityAt(time, isHidden) {
|
|
200
|
+
if (time > this.object.startTime) {
|
|
201
|
+
// Consider a hitobject as being invisible when its start time is passed.
|
|
202
|
+
// In reality the hitobject will be visible beyond its start time up until its hittable window has passed,
|
|
203
|
+
// but this is an approximation and such a case is unlikely to be hit where this function is used.
|
|
204
|
+
return 0;
|
|
205
|
+
}
|
|
206
|
+
const fadeInStartTime = this.object.startTime - this.timePreempt;
|
|
207
|
+
const fadeInDuration = this.timeFadeIn;
|
|
208
|
+
if (isHidden) {
|
|
209
|
+
const fadeOutStartTime = fadeInStartTime + fadeInDuration;
|
|
210
|
+
const fadeOutDuration = this.timePreempt * osuBase.ModHidden.fadeOutDurationMultiplier;
|
|
211
|
+
return Math.min(osuBase.MathUtils.clamp((time - fadeInStartTime) / fadeInDuration, 0, 1), 1 -
|
|
212
|
+
osuBase.MathUtils.clamp((time - fadeOutStartTime) / fadeOutDuration, 0, 1));
|
|
213
|
+
}
|
|
214
|
+
return osuBase.MathUtils.clamp((time - fadeInStartTime) / fadeInDuration, 0, 1);
|
|
122
215
|
}
|
|
123
216
|
}
|
|
124
217
|
|
|
@@ -129,7 +222,7 @@ class DifficultyHitObjectCreator {
|
|
|
129
222
|
/**
|
|
130
223
|
* The threshold for small circle buff for osu!droid.
|
|
131
224
|
*/
|
|
132
|
-
DROID_CIRCLESIZE_BUFF_THRESHOLD =
|
|
225
|
+
DROID_CIRCLESIZE_BUFF_THRESHOLD = 70;
|
|
133
226
|
/**
|
|
134
227
|
* The threshold for small circle buff for osu!standard.
|
|
135
228
|
*/
|
|
@@ -156,9 +249,23 @@ class DifficultyHitObjectCreator {
|
|
|
156
249
|
params.objects[0].scale = scale;
|
|
157
250
|
const scalingFactor = this.getScalingFactor(params.objects[0].radius);
|
|
158
251
|
const difficultyObjects = [];
|
|
252
|
+
const preemptWithoutSpeedMultiplier = params.preempt / params.speedMultiplier;
|
|
159
253
|
for (let i = 0; i < params.objects.length; ++i) {
|
|
160
|
-
const object = new DifficultyHitObject(params.objects[i]);
|
|
254
|
+
const object = new DifficultyHitObject(params.objects[i], difficultyObjects);
|
|
255
|
+
object.index = difficultyObjects.length - 1;
|
|
161
256
|
object.object.scale = scale;
|
|
257
|
+
object.timePreempt = params.preempt;
|
|
258
|
+
// Preempt time can go below 450ms. Normally, this is achieved via the DT mod or a
|
|
259
|
+
// custom speed multiplier which uniformly speeds up all animations game wide regardless of AR.
|
|
260
|
+
//
|
|
261
|
+
// This uniform speedup is hard to match 1:1, however we can at least make AR>10 (via mods)
|
|
262
|
+
// feel good by extending the upper linear function above.
|
|
263
|
+
//
|
|
264
|
+
// Note that this doesn't exactly match the AR>10 visuals as they're classically known, but it feels good.
|
|
265
|
+
// This adjustment is necessary for AR>10, otherwise timePreempt can become smaller
|
|
266
|
+
// leading to hitcircles not fully fading in.
|
|
267
|
+
object.timeFadeIn =
|
|
268
|
+
400 * Math.min(1, object.timePreempt / osuBase.MapStats.arToMS(10));
|
|
162
269
|
if (object.object instanceof osuBase.Slider) {
|
|
163
270
|
object.velocity =
|
|
164
271
|
object.object.velocity * params.speedMultiplier;
|
|
@@ -182,10 +289,18 @@ class DifficultyHitObjectCreator {
|
|
|
182
289
|
params.speedMultiplier;
|
|
183
290
|
// Cap to 25ms to prevent difficulty calculation breaking from simultaneous objects.
|
|
184
291
|
object.strainTime = Math.max(this.minDeltaTime, object.deltaTime);
|
|
185
|
-
|
|
292
|
+
if (object.object instanceof osuBase.Spinner ||
|
|
293
|
+
lastObject.object instanceof osuBase.Spinner) {
|
|
294
|
+
difficultyObjects.push(object);
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
const visibleObjects = params.objects
|
|
298
|
+
.filter((o) => o.startTime / params.speedMultiplier >=
|
|
299
|
+
object.startTime &&
|
|
186
300
|
o.startTime / params.speedMultiplier <=
|
|
187
|
-
object.endTime +
|
|
188
|
-
|
|
301
|
+
object.endTime + preemptWithoutSpeedMultiplier)
|
|
302
|
+
// The current object will be included, so we need to exclude it.
|
|
303
|
+
.slice(1);
|
|
189
304
|
for (const hitObject of visibleObjects) {
|
|
190
305
|
// Calculate delta time assuming the current object is a circle.
|
|
191
306
|
let deltaTime = Math.abs(hitObject.startTime / params.speedMultiplier -
|
|
@@ -204,7 +319,8 @@ class DifficultyHitObjectCreator {
|
|
|
204
319
|
object.endTime));
|
|
205
320
|
}
|
|
206
321
|
}
|
|
207
|
-
object.noteDensity +=
|
|
322
|
+
object.noteDensity +=
|
|
323
|
+
1 - deltaTime / preemptWithoutSpeedMultiplier;
|
|
208
324
|
if (!(hitObject instanceof osuBase.Spinner)) {
|
|
209
325
|
object.overlappingFactor +=
|
|
210
326
|
// Penalize objects that are too close to the object in both distance
|
|
@@ -219,11 +335,6 @@ class DifficultyHitObjectCreator {
|
|
|
219
335
|
75))));
|
|
220
336
|
}
|
|
221
337
|
}
|
|
222
|
-
if (object.object instanceof osuBase.Spinner ||
|
|
223
|
-
lastObject.object instanceof osuBase.Spinner) {
|
|
224
|
-
difficultyObjects.push(object);
|
|
225
|
-
continue;
|
|
226
|
-
}
|
|
227
338
|
const lastCursorPosition = this.getEndCursorPosition(lastObject.object);
|
|
228
339
|
object.lazyJumpDistance = object.object.stackedPosition
|
|
229
340
|
.scale(scalingFactor)
|
|
@@ -280,9 +391,7 @@ class DifficultyHitObjectCreator {
|
|
|
280
391
|
if (this.mode === osuBase.modes.droid) {
|
|
281
392
|
slider.tail.startTime += osuBase.Slider.legacyLastTickOffset;
|
|
282
393
|
slider.tail.endTime += osuBase.Slider.legacyLastTickOffset;
|
|
283
|
-
slider.nestedHitObjects.sort((a, b) =>
|
|
284
|
-
return a.startTime - b.startTime;
|
|
285
|
-
});
|
|
394
|
+
slider.nestedHitObjects.sort((a, b) => a.startTime - b.startTime);
|
|
286
395
|
// Temporary lazy end position until a real result can be derived.
|
|
287
396
|
slider.lazyEndPosition = slider.stackedPosition;
|
|
288
397
|
// Stop here if the slider has too short duration due to float number limitation.
|
|
@@ -366,8 +475,8 @@ class DifficultyHitObjectCreator {
|
|
|
366
475
|
if (radius < this.DROID_CIRCLESIZE_BUFF_THRESHOLD) {
|
|
367
476
|
scalingFactor *=
|
|
368
477
|
1 +
|
|
369
|
-
Math.
|
|
370
|
-
|
|
478
|
+
Math.pow((this.DROID_CIRCLESIZE_BUFF_THRESHOLD - radius) /
|
|
479
|
+
50, 2);
|
|
371
480
|
}
|
|
372
481
|
break;
|
|
373
482
|
case osuBase.modes.osu:
|
|
@@ -394,179 +503,184 @@ class DifficultyHitObjectCreator {
|
|
|
394
503
|
}
|
|
395
504
|
|
|
396
505
|
/**
|
|
397
|
-
*
|
|
506
|
+
* The base of a difficulty calculator.
|
|
398
507
|
*/
|
|
399
|
-
class
|
|
508
|
+
class DifficultyCalculator {
|
|
400
509
|
/**
|
|
401
|
-
* The
|
|
402
|
-
*
|
|
403
|
-
* The latest hitobject is at index 0.
|
|
510
|
+
* The calculated beatmap.
|
|
404
511
|
*/
|
|
405
|
-
|
|
512
|
+
beatmap;
|
|
406
513
|
/**
|
|
407
|
-
*
|
|
514
|
+
* The difficulty objects of the beatmap.
|
|
408
515
|
*/
|
|
409
|
-
|
|
516
|
+
objects = [];
|
|
410
517
|
/**
|
|
411
|
-
* The
|
|
518
|
+
* The modifications applied.
|
|
412
519
|
*/
|
|
413
|
-
mods;
|
|
414
|
-
constructor(mods) {
|
|
415
|
-
this.mods = mods;
|
|
416
|
-
}
|
|
417
|
-
processInternal(current) {
|
|
418
|
-
while (this.previous.length > this.historyLength) {
|
|
419
|
-
this.previous.pop();
|
|
420
|
-
}
|
|
421
|
-
this.process(current);
|
|
422
|
-
this.previous.unshift(current);
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
/**
|
|
427
|
-
* Used to processes strain values of difficulty hitobjects, keep track of strain levels caused by the processed objects
|
|
428
|
-
* and to calculate a final difficulty value representing the difficulty of hitting all the processed objects.
|
|
429
|
-
*/
|
|
430
|
-
class StrainSkill extends Skill {
|
|
520
|
+
mods = [];
|
|
431
521
|
/**
|
|
432
|
-
* The
|
|
522
|
+
* The total star rating of the beatmap.
|
|
433
523
|
*/
|
|
434
|
-
|
|
524
|
+
total = 0;
|
|
435
525
|
/**
|
|
436
|
-
* The
|
|
526
|
+
* The map statistics of the beatmap after modifications are applied.
|
|
437
527
|
*/
|
|
438
|
-
|
|
528
|
+
stats = new osuBase.MapStats();
|
|
439
529
|
/**
|
|
440
|
-
*
|
|
530
|
+
* The strain peaks of various calculated difficulties.
|
|
441
531
|
*/
|
|
442
|
-
strainPeaks =
|
|
532
|
+
strainPeaks = {
|
|
533
|
+
aimWithSliders: [],
|
|
534
|
+
aimWithoutSliders: [],
|
|
535
|
+
speed: [],
|
|
536
|
+
flashlight: [],
|
|
537
|
+
};
|
|
538
|
+
/**
|
|
539
|
+
* Additional data that is used in performance calculation.
|
|
540
|
+
*/
|
|
541
|
+
attributes = {
|
|
542
|
+
speedNoteCount: 0,
|
|
543
|
+
sliderFactor: 1,
|
|
544
|
+
aimDifficultStrainCount: 0,
|
|
545
|
+
speedDifficultStrainCount: 0,
|
|
546
|
+
};
|
|
443
547
|
sectionLength = 400;
|
|
444
|
-
currentSectionEnd = 0;
|
|
445
548
|
/**
|
|
446
|
-
*
|
|
549
|
+
* Constructs a new instance of the calculator.
|
|
447
550
|
*
|
|
448
|
-
* @param
|
|
551
|
+
* @param beatmap The beatmap to calculate. This beatmap will be deep-cloned to prevent reference changes.
|
|
449
552
|
*/
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
if (this.previous.length === 0) {
|
|
453
|
-
this.currentSectionEnd =
|
|
454
|
-
Math.ceil(current.startTime / this.sectionLength) *
|
|
455
|
-
this.sectionLength;
|
|
456
|
-
}
|
|
457
|
-
while (current.startTime > this.currentSectionEnd) {
|
|
458
|
-
this.saveCurrentPeak();
|
|
459
|
-
this.startNewSectionFrom(this.currentSectionEnd);
|
|
460
|
-
this.currentSectionEnd += this.sectionLength;
|
|
461
|
-
}
|
|
462
|
-
this.currentStrain = this.strainValueAt(current);
|
|
463
|
-
this.saveToHitObject(current);
|
|
464
|
-
this.currentSectionPeak = Math.max(this.currentStrain, this.currentSectionPeak);
|
|
553
|
+
constructor(beatmap) {
|
|
554
|
+
this.beatmap = osuBase.Utils.deepCopy(beatmap);
|
|
465
555
|
}
|
|
466
556
|
/**
|
|
467
|
-
*
|
|
557
|
+
* Calculates the star rating of the specified beatmap.
|
|
558
|
+
*
|
|
559
|
+
* The beatmap is analyzed in chunks of `sectionLength` duration.
|
|
560
|
+
* For each chunk the highest hitobject strains are added to
|
|
561
|
+
* a list which is then collapsed into a weighted sum, much
|
|
562
|
+
* like scores are weighted on a user's profile.
|
|
563
|
+
*
|
|
564
|
+
* For subsequent chunks, the initial max strain is calculated
|
|
565
|
+
* by decaying the previous hitobject's strain until the
|
|
566
|
+
* beginning of the new chunk.
|
|
567
|
+
*
|
|
568
|
+
* @param options Options for the difficulty calculation.
|
|
468
569
|
*/
|
|
469
|
-
|
|
470
|
-
this.
|
|
570
|
+
calculate(options) {
|
|
571
|
+
this.mods = options?.mods ?? [];
|
|
572
|
+
this.stats = new osuBase.MapStats({
|
|
573
|
+
cs: this.beatmap.difficulty.cs,
|
|
574
|
+
ar: this.beatmap.difficulty.ar,
|
|
575
|
+
od: this.beatmap.difficulty.od,
|
|
576
|
+
hp: this.beatmap.difficulty.hp,
|
|
577
|
+
mods: options?.mods,
|
|
578
|
+
speedMultiplier: options?.stats?.speedMultiplier ?? 1,
|
|
579
|
+
oldStatistics: options?.stats?.oldStatistics ?? false,
|
|
580
|
+
}).calculate({ mode: this.mode });
|
|
581
|
+
this.generateDifficultyHitObjects();
|
|
582
|
+
this.calculateAll();
|
|
583
|
+
return this;
|
|
471
584
|
}
|
|
472
585
|
/**
|
|
473
|
-
*
|
|
586
|
+
* Generates difficulty hitobjects for this calculator.
|
|
587
|
+
*/
|
|
588
|
+
generateDifficultyHitObjects() {
|
|
589
|
+
this.objects.length = 0;
|
|
590
|
+
this.objects.push(...new DifficultyHitObjectCreator().generateDifficultyObjects({
|
|
591
|
+
objects: this.beatmap.hitObjects.objects,
|
|
592
|
+
circleSize: this.stats.cs,
|
|
593
|
+
speedMultiplier: this.stats.speedMultiplier,
|
|
594
|
+
mode: this.mode,
|
|
595
|
+
preempt: osuBase.MapStats.arToMS(this.stats.ar),
|
|
596
|
+
}));
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Calculates the skills provided.
|
|
474
600
|
*
|
|
475
|
-
* @param
|
|
601
|
+
* @param skills The skills to calculate.
|
|
476
602
|
*/
|
|
477
|
-
|
|
478
|
-
// The
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
603
|
+
calculateSkills(...skills) {
|
|
604
|
+
// The first object doesn't generate a strain, so we begin calculating from the second object.
|
|
605
|
+
this.objects.slice(1).forEach((h, i) => {
|
|
606
|
+
skills.forEach((skill) => {
|
|
607
|
+
skill.process(h);
|
|
608
|
+
if (i === this.objects.length - 2) {
|
|
609
|
+
// Don't forget to save the last strain peak, which would otherwise be ignored.
|
|
610
|
+
skill.saveCurrentPeak();
|
|
611
|
+
}
|
|
612
|
+
});
|
|
613
|
+
});
|
|
483
614
|
}
|
|
484
615
|
/**
|
|
485
|
-
* Calculates
|
|
616
|
+
* Calculates the star rating value of a difficulty.
|
|
486
617
|
*
|
|
487
|
-
* @param
|
|
618
|
+
* @param difficulty The difficulty to calculate.
|
|
488
619
|
*/
|
|
489
|
-
|
|
490
|
-
return Math.
|
|
620
|
+
starValue(difficulty) {
|
|
621
|
+
return Math.sqrt(difficulty) * this.difficultyMultiplier;
|
|
491
622
|
}
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
difficultyValue() {
|
|
500
|
-
const sortedStrains = this.strainPeaks
|
|
501
|
-
.slice()
|
|
502
|
-
.sort((a, b) => {
|
|
503
|
-
return b - a;
|
|
504
|
-
});
|
|
505
|
-
// We are reducing the highest strains first to account for extreme difficulty spikes.
|
|
506
|
-
for (let i = 0; i < Math.min(sortedStrains.length, this.reducedSectionCount); ++i) {
|
|
507
|
-
const scale = Math.log10(osuBase.Interpolation.lerp(1, 10, osuBase.MathUtils.clamp(i / this.reducedSectionCount, 0, 1)));
|
|
508
|
-
sortedStrains[i] *= osuBase.Interpolation.lerp(this.reducedSectionBaseline, 1, scale);
|
|
509
|
-
}
|
|
510
|
-
// Math here preserves the property that two notes of equal difficulty x, we have their summed difficulty = x * starsPerDouble.
|
|
511
|
-
// This also applies to two sets of notes with equal difficulty.
|
|
512
|
-
return Math.pow(sortedStrains.reduce((a, v) => {
|
|
513
|
-
if (v === 0) {
|
|
514
|
-
return a;
|
|
515
|
-
}
|
|
516
|
-
return a + Math.pow(v, 1 / Math.log2(this.starsPerDouble));
|
|
517
|
-
}, 0), Math.log2(this.starsPerDouble));
|
|
623
|
+
/**
|
|
624
|
+
* Calculates the base performance value of a difficulty rating.
|
|
625
|
+
*
|
|
626
|
+
* @param rating The difficulty rating.
|
|
627
|
+
*/
|
|
628
|
+
basePerformanceValue(rating) {
|
|
629
|
+
return Math.pow(5 * Math.max(1, rating / 0.0675) - 4, 3) / 100000;
|
|
518
630
|
}
|
|
519
631
|
}
|
|
520
632
|
|
|
521
633
|
/**
|
|
522
|
-
*
|
|
634
|
+
* An evaluator for calculating osu!droid Aim skill.
|
|
523
635
|
*/
|
|
524
|
-
class
|
|
525
|
-
skillMultiplier = 23.25;
|
|
526
|
-
strainDecayBase = 0.15;
|
|
527
|
-
reducedSectionCount = 10;
|
|
528
|
-
reducedSectionBaseline = 0.75;
|
|
529
|
-
starsPerDouble = 1.05;
|
|
636
|
+
class DroidAimEvaluator extends AimEvaluator {
|
|
530
637
|
/**
|
|
531
638
|
* Spacing threshold for a single hitobject spacing.
|
|
532
639
|
*/
|
|
533
|
-
SINGLE_SPACING_THRESHOLD = 175;
|
|
640
|
+
static SINGLE_SPACING_THRESHOLD = 175;
|
|
534
641
|
// ~200 1/2 BPM jumps
|
|
535
|
-
minSpeedBonus = 150;
|
|
536
|
-
wideAngleMultiplier = 1.5;
|
|
537
|
-
acuteAngleMultiplier = 2;
|
|
538
|
-
sliderMultiplier = 1.5;
|
|
539
|
-
velocityChangeMultiplier = 0.75;
|
|
540
|
-
withSliders;
|
|
541
|
-
constructor(mods, withSliders) {
|
|
542
|
-
super(mods);
|
|
543
|
-
this.withSliders = withSliders;
|
|
544
|
-
}
|
|
642
|
+
static minSpeedBonus = 150;
|
|
545
643
|
/**
|
|
546
|
-
*
|
|
644
|
+
* Evaluates the difficulty of aiming the current object, based on:
|
|
645
|
+
*
|
|
646
|
+
* - cursor velocity to the current object,
|
|
647
|
+
* - angle difficulty,
|
|
648
|
+
* - sharp velocity increases,
|
|
649
|
+
* - and slider difficulty.
|
|
650
|
+
*
|
|
651
|
+
* @param current The current object.
|
|
652
|
+
* @param withSliders Whether to take slider difficulty into account.
|
|
547
653
|
*/
|
|
548
|
-
|
|
549
|
-
|
|
654
|
+
static evaluateDifficultyOf(current, withSliders) {
|
|
655
|
+
const last = current.previous(0);
|
|
656
|
+
if (current.object instanceof osuBase.Spinner ||
|
|
657
|
+
// Exclude overlapping objects that can be tapped at once.
|
|
658
|
+
(current.deltaTime < 5 &&
|
|
659
|
+
((last?.object instanceof osuBase.Slider
|
|
660
|
+
? Math.min(last.object.stackedEndPosition.getDistance(current.object.stackedPosition), last.object.lazyEndPosition.getDistance(current.object.stackedPosition))
|
|
661
|
+
: last?.object.stackedEndPosition.getDistance(current.object.stackedPosition)) ?? Number.POSITIVE_INFINITY) <=
|
|
662
|
+
2 * current.object.radius)) {
|
|
550
663
|
return 0;
|
|
551
664
|
}
|
|
552
|
-
return this.aimStrainOf(current) +
|
|
665
|
+
return (this.aimStrainOf(current, withSliders) +
|
|
666
|
+
this.movementStrainOf(current));
|
|
553
667
|
}
|
|
554
668
|
/**
|
|
555
669
|
* Calculates the aim strain of a hitobject.
|
|
556
670
|
*/
|
|
557
|
-
aimStrainOf(current) {
|
|
558
|
-
if (
|
|
559
|
-
|
|
671
|
+
static aimStrainOf(current, withSliders) {
|
|
672
|
+
if (current.index <= 1 ||
|
|
673
|
+
current.previous(0)?.object instanceof osuBase.Spinner) {
|
|
560
674
|
return 0;
|
|
561
675
|
}
|
|
562
|
-
const last =
|
|
563
|
-
const lastLast =
|
|
676
|
+
const last = current.previous(0);
|
|
677
|
+
const lastLast = current.previous(1);
|
|
564
678
|
// Calculate the velocity to the current hitobject, which starts with a base distance / time assuming the last object is a hitcircle.
|
|
565
679
|
let currentVelocity = current.lazyJumpDistance / current.strainTime;
|
|
566
680
|
// But if the last object is a slider, then we extend the travel velocity through the slider into the current object.
|
|
567
681
|
if (last.object instanceof osuBase.Slider &&
|
|
568
682
|
last.object.ticks > 0 &&
|
|
569
|
-
|
|
683
|
+
withSliders) {
|
|
570
684
|
// Calculate the slider velocity from slider head to slider end.
|
|
571
685
|
const travelVelocity = last.travelDistance / last.travelTime;
|
|
572
686
|
// Calculate the movement velocity from slider end to current object.
|
|
@@ -580,7 +694,7 @@ class DroidAim extends DroidSkill {
|
|
|
580
694
|
let prevVelocity = last.lazyJumpDistance / last.strainTime;
|
|
581
695
|
if (lastLast.object instanceof osuBase.Slider &&
|
|
582
696
|
lastLast.object.ticks > 0 &&
|
|
583
|
-
|
|
697
|
+
withSliders) {
|
|
584
698
|
const travelVelocity = lastLast.travelDistance / lastLast.travelTime;
|
|
585
699
|
const movementVelocity = last.minimumJumpTime !== 0
|
|
586
700
|
? last.minimumJumpDistance / last.minimumJumpTime
|
|
@@ -669,7 +783,7 @@ class DroidAim extends DroidSkill {
|
|
|
669
783
|
strain += Math.max(acuteAngleBonus * this.acuteAngleMultiplier, wideAngleBonus * this.wideAngleMultiplier +
|
|
670
784
|
velocityChangeBonus * this.velocityChangeMultiplier);
|
|
671
785
|
// Add in additional slider velocity bonus.
|
|
672
|
-
if (
|
|
786
|
+
if (withSliders) {
|
|
673
787
|
strain += sliderBonus * this.sliderMultiplier;
|
|
674
788
|
}
|
|
675
789
|
return strain;
|
|
@@ -677,93 +791,145 @@ class DroidAim extends DroidSkill {
|
|
|
677
791
|
/**
|
|
678
792
|
* Calculates the movement strain of a hitobject.
|
|
679
793
|
*/
|
|
680
|
-
movementStrainOf(current) {
|
|
794
|
+
static movementStrainOf(current) {
|
|
681
795
|
let speedBonus = 1;
|
|
682
796
|
if (current.strainTime < this.minSpeedBonus) {
|
|
683
797
|
speedBonus +=
|
|
684
798
|
0.75 *
|
|
685
799
|
Math.pow((this.minSpeedBonus - current.strainTime) / 45, 2);
|
|
686
800
|
}
|
|
687
|
-
const travelDistance =
|
|
801
|
+
const travelDistance = current.previous(0)?.travelDistance ?? 0;
|
|
688
802
|
const distance = Math.min(this.SINGLE_SPACING_THRESHOLD, travelDistance + current.minimumJumpDistance);
|
|
689
803
|
return ((50 *
|
|
690
804
|
speedBonus *
|
|
691
805
|
Math.pow(distance / this.SINGLE_SPACING_THRESHOLD, 5)) /
|
|
692
806
|
current.strainTime);
|
|
693
807
|
}
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* A bare minimal abstract skill for fully custom skill implementations.
|
|
812
|
+
*/
|
|
813
|
+
class Skill {
|
|
694
814
|
/**
|
|
695
|
-
*
|
|
815
|
+
* The mods that this skill processes.
|
|
696
816
|
*/
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
this.
|
|
700
|
-
this.strainValueOf(current) * this.skillMultiplier;
|
|
701
|
-
return this.currentStrain;
|
|
817
|
+
mods;
|
|
818
|
+
constructor(mods) {
|
|
819
|
+
this.mods = mods;
|
|
702
820
|
}
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Used to processes strain values of difficulty hitobjects, keep track of strain levels caused by the processed objects
|
|
825
|
+
* and to calculate a final difficulty value representing the difficulty of hitting all the processed objects.
|
|
826
|
+
*/
|
|
827
|
+
class StrainSkill extends Skill {
|
|
703
828
|
/**
|
|
704
|
-
*
|
|
829
|
+
* The strain of currently calculated hitobject.
|
|
705
830
|
*/
|
|
706
|
-
|
|
707
|
-
if (this.withSliders) {
|
|
708
|
-
current.aimStrainWithSliders = this.currentStrain;
|
|
709
|
-
}
|
|
710
|
-
else {
|
|
711
|
-
current.aimStrainWithoutSliders = this.currentStrain;
|
|
712
|
-
}
|
|
713
|
-
}
|
|
831
|
+
currentStrain = 0;
|
|
714
832
|
/**
|
|
715
|
-
*
|
|
833
|
+
* The current section's strain peak.
|
|
716
834
|
*/
|
|
717
|
-
|
|
718
|
-
return Math.pow(Math.sin((3 / 4) *
|
|
719
|
-
(Math.min((5 / 6) * Math.PI, Math.max(Math.PI / 6, angle)) -
|
|
720
|
-
Math.PI / 6)), 2);
|
|
721
|
-
}
|
|
835
|
+
currentSectionPeak = 0;
|
|
722
836
|
/**
|
|
723
|
-
*
|
|
837
|
+
* Strain peaks are stored here.
|
|
724
838
|
*/
|
|
725
|
-
|
|
726
|
-
|
|
839
|
+
strainPeaks = [];
|
|
840
|
+
sectionLength = 400;
|
|
841
|
+
currentSectionEnd = 0;
|
|
842
|
+
isFirstObject = true;
|
|
843
|
+
/**
|
|
844
|
+
* Calculates the strain value of a hitobject and stores the value in it. This value is affected by previously processed objects.
|
|
845
|
+
*
|
|
846
|
+
* @param current The hitobject to process.
|
|
847
|
+
*/
|
|
848
|
+
process(current) {
|
|
849
|
+
// The first object doesn't generate a strain, so we begin with an incremented section end
|
|
850
|
+
if (this.isFirstObject) {
|
|
851
|
+
this.currentSectionEnd =
|
|
852
|
+
Math.ceil(current.startTime / this.sectionLength) *
|
|
853
|
+
this.sectionLength;
|
|
854
|
+
this.isFirstObject = false;
|
|
855
|
+
}
|
|
856
|
+
while (current.startTime > this.currentSectionEnd) {
|
|
857
|
+
this.saveCurrentPeak();
|
|
858
|
+
this.startNewSectionFrom(this.currentSectionEnd, current);
|
|
859
|
+
this.currentSectionEnd += this.sectionLength;
|
|
860
|
+
}
|
|
861
|
+
// Ignore the first hitobject.
|
|
862
|
+
this.currentStrain = this.strainValueAt(current);
|
|
863
|
+
this.saveToHitObject(current);
|
|
864
|
+
this.currentSectionPeak = Math.max(this.currentStrain, this.currentSectionPeak);
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* Saves the current peak strain level to the list of strain peaks, which will be used to calculate an overall difficulty.
|
|
868
|
+
*/
|
|
869
|
+
saveCurrentPeak() {
|
|
870
|
+
this.strainPeaks.push(this.currentSectionPeak);
|
|
871
|
+
}
|
|
872
|
+
/**
|
|
873
|
+
* Calculates strain decay for a specified time frame.
|
|
874
|
+
*
|
|
875
|
+
* @param ms The time frame to calculate.
|
|
876
|
+
*/
|
|
877
|
+
strainDecay(ms) {
|
|
878
|
+
return Math.pow(this.strainDecayBase, ms / 1000);
|
|
879
|
+
}
|
|
880
|
+
/**
|
|
881
|
+
* Sets the initial strain level for a new section.
|
|
882
|
+
*
|
|
883
|
+
* @param offset The beginning of the new section in milliseconds, adjusted by speed multiplier.
|
|
884
|
+
* @param current The current hitobject.
|
|
885
|
+
*/
|
|
886
|
+
startNewSectionFrom(offset, current) {
|
|
887
|
+
// The maximum strain of the new section is not zero by default, strain decays as usual regardless of section boundaries.
|
|
888
|
+
// This means we need to capture the strain level at the beginning of the new section, and use that as the initial peak level.
|
|
889
|
+
this.currentSectionPeak =
|
|
890
|
+
this.currentStrain *
|
|
891
|
+
this.strainDecay(offset - current.previous(0).startTime);
|
|
727
892
|
}
|
|
728
893
|
}
|
|
729
894
|
|
|
730
895
|
/**
|
|
731
|
-
*
|
|
896
|
+
* Used to processes strain values of difficulty hitobjects, keep track of strain levels caused by the processed objects
|
|
897
|
+
* and to calculate a final difficulty value representing the difficulty of hitting all the processed objects.
|
|
732
898
|
*/
|
|
733
|
-
class
|
|
734
|
-
|
|
735
|
-
|
|
899
|
+
class DroidSkill extends StrainSkill {
|
|
900
|
+
difficultyValue() {
|
|
901
|
+
const sortedStrains = this.strainPeaks
|
|
902
|
+
.slice()
|
|
903
|
+
.sort((a, b) => b - a);
|
|
904
|
+
// We are reducing the highest strains first to account for extreme difficulty spikes.
|
|
905
|
+
for (let i = 0; i < Math.min(sortedStrains.length, this.reducedSectionCount); ++i) {
|
|
906
|
+
const scale = Math.log10(osuBase.Interpolation.lerp(1, 10, osuBase.MathUtils.clamp(i / this.reducedSectionCount, 0, 1)));
|
|
907
|
+
sortedStrains[i] *= osuBase.Interpolation.lerp(this.reducedSectionBaseline, 1, scale);
|
|
908
|
+
}
|
|
909
|
+
// Math here preserves the property that two notes of equal difficulty x, we have their summed difficulty = x * starsPerDouble.
|
|
910
|
+
// This also applies to two sets of notes with equal difficulty.
|
|
911
|
+
return Math.pow(sortedStrains.reduce((a, v) => {
|
|
912
|
+
if (v <= 0) {
|
|
913
|
+
return a;
|
|
914
|
+
}
|
|
915
|
+
return a + Math.pow(v, 1 / Math.log2(this.starsPerDouble));
|
|
916
|
+
}, 0), Math.log2(this.starsPerDouble));
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* Represents the skill required to correctly aim at every object in the map with a uniform CircleSize and normalized distances.
|
|
922
|
+
*/
|
|
923
|
+
class DroidAim extends DroidSkill {
|
|
924
|
+
skillMultiplier = 23.25;
|
|
736
925
|
strainDecayBase = 0.15;
|
|
737
926
|
reducedSectionCount = 10;
|
|
738
927
|
reducedSectionBaseline = 0.75;
|
|
739
928
|
starsPerDouble = 1.05;
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
const scalingFactor = 52 / current.object.radius;
|
|
745
|
-
let smallDistNerf = 1;
|
|
746
|
-
let cumulativeStrainTime = 0;
|
|
747
|
-
let result = 0;
|
|
748
|
-
let last = current;
|
|
749
|
-
for (let i = 0; i < this.previous.length; ++i) {
|
|
750
|
-
const currentObject = this.previous[i];
|
|
751
|
-
if (!(currentObject.object instanceof osuBase.Spinner)) {
|
|
752
|
-
const jumpDistance = current.object.stackedPosition.subtract(currentObject.object.endPosition).length;
|
|
753
|
-
cumulativeStrainTime += last.strainTime;
|
|
754
|
-
// We want to nerf objects that can be easily seen within the Flashlight circle radius.
|
|
755
|
-
if (i === 0) {
|
|
756
|
-
smallDistNerf = Math.min(1, jumpDistance / 75);
|
|
757
|
-
}
|
|
758
|
-
// We also want to nerf stacks so that only the first object of the stack is accounted for.
|
|
759
|
-
const stackNerf = Math.min(1, currentObject.lazyJumpDistance / scalingFactor / 25);
|
|
760
|
-
result +=
|
|
761
|
-
(stackNerf * scalingFactor * jumpDistance) /
|
|
762
|
-
cumulativeStrainTime;
|
|
763
|
-
}
|
|
764
|
-
last = currentObject;
|
|
765
|
-
}
|
|
766
|
-
return Math.pow(smallDistNerf * result, 2);
|
|
929
|
+
withSliders;
|
|
930
|
+
constructor(mods, withSliders) {
|
|
931
|
+
super(mods);
|
|
932
|
+
this.withSliders = withSliders;
|
|
767
933
|
}
|
|
768
934
|
/**
|
|
769
935
|
* @param current The hitobject to calculate.
|
|
@@ -771,11 +937,79 @@ class DroidFlashlight extends DroidSkill {
|
|
|
771
937
|
strainValueAt(current) {
|
|
772
938
|
this.currentStrain *= this.strainDecay(current.deltaTime);
|
|
773
939
|
this.currentStrain +=
|
|
774
|
-
|
|
940
|
+
DroidAimEvaluator.evaluateDifficultyOf(current, this.withSliders) *
|
|
941
|
+
this.skillMultiplier;
|
|
775
942
|
return this.currentStrain;
|
|
776
943
|
}
|
|
944
|
+
/**
|
|
945
|
+
* @param current The hitobject to save to.
|
|
946
|
+
*/
|
|
777
947
|
saveToHitObject(current) {
|
|
778
|
-
|
|
948
|
+
if (this.withSliders) {
|
|
949
|
+
current.aimStrainWithSliders = this.currentStrain;
|
|
950
|
+
}
|
|
951
|
+
else {
|
|
952
|
+
current.aimStrainWithoutSliders = this.currentStrain;
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
/**
|
|
958
|
+
* An evaluator for calculating speed or tap skill.
|
|
959
|
+
*
|
|
960
|
+
* This class should be considered an "evaluating" class and not persisted.
|
|
961
|
+
*/
|
|
962
|
+
class SpeedEvaluator {
|
|
963
|
+
// ~200 1/4 BPM streams
|
|
964
|
+
static minSpeedBonus = 75;
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
/**
|
|
968
|
+
* An evaluator for calculating osu!droid tap skill.
|
|
969
|
+
*/
|
|
970
|
+
class DroidTapEvaluator extends SpeedEvaluator {
|
|
971
|
+
/**
|
|
972
|
+
* Evaluates the difficulty of tapping the current object, based on:
|
|
973
|
+
*
|
|
974
|
+
* - time between pressing the previous and current object,
|
|
975
|
+
* - distance between those objects,
|
|
976
|
+
* - and how easily they can be cheesed.
|
|
977
|
+
*
|
|
978
|
+
* @param current The current object.
|
|
979
|
+
* @param greatWindow The great hit window of the current object.
|
|
980
|
+
* @param considerCheesability Whether to consider cheesability.
|
|
981
|
+
*/
|
|
982
|
+
static evaluateDifficultyOf(current, greatWindow, considerCheesability) {
|
|
983
|
+
if (current.object instanceof osuBase.Spinner ||
|
|
984
|
+
// Exclude overlapping objects that can be tapped at once.
|
|
985
|
+
current.deltaTime < 5) {
|
|
986
|
+
return 0;
|
|
987
|
+
}
|
|
988
|
+
let strainTime = current.strainTime;
|
|
989
|
+
let doubletapness = 1;
|
|
990
|
+
if (considerCheesability) {
|
|
991
|
+
const greatWindowFull = greatWindow * 2;
|
|
992
|
+
// Nerf doubletappable doubles.
|
|
993
|
+
const next = current.next(0);
|
|
994
|
+
if (next) {
|
|
995
|
+
const currentDeltaTime = Math.max(1, current.deltaTime);
|
|
996
|
+
const nextDeltaTime = Math.max(1, next.deltaTime);
|
|
997
|
+
const deltaDifference = Math.abs(nextDeltaTime - currentDeltaTime);
|
|
998
|
+
const speedRatio = currentDeltaTime /
|
|
999
|
+
Math.max(currentDeltaTime, deltaDifference);
|
|
1000
|
+
const windowRatio = Math.pow(Math.min(1, currentDeltaTime / greatWindowFull), 2);
|
|
1001
|
+
doubletapness = Math.pow(speedRatio, 1 - windowRatio);
|
|
1002
|
+
}
|
|
1003
|
+
// Cap deltatime to the OD 300 hitwindow.
|
|
1004
|
+
// 0.58 is derived from making sure 260 BPM 1/4 OD5 streams aren't nerfed harshly, whilst 0.91 limits the effect of the cap.
|
|
1005
|
+
strainTime /= osuBase.MathUtils.clamp(strainTime / greatWindowFull / 0.58, 0.91, 1);
|
|
1006
|
+
}
|
|
1007
|
+
let speedBonus = 1;
|
|
1008
|
+
if (strainTime < this.minSpeedBonus) {
|
|
1009
|
+
speedBonus +=
|
|
1010
|
+
0.75 * Math.pow((this.minSpeedBonus - strainTime) / 40, 2);
|
|
1011
|
+
}
|
|
1012
|
+
return (speedBonus * doubletapness) / strainTime;
|
|
779
1013
|
}
|
|
780
1014
|
}
|
|
781
1015
|
|
|
@@ -792,63 +1026,25 @@ class DroidTap extends DroidSkill {
|
|
|
792
1026
|
minSpeedBonus = 75;
|
|
793
1027
|
currentTapStrain = 0;
|
|
794
1028
|
currentOriginalTapStrain = 0;
|
|
795
|
-
|
|
1029
|
+
greatWindow;
|
|
796
1030
|
constructor(mods, overallDifficulty) {
|
|
797
1031
|
super(mods);
|
|
798
|
-
this.
|
|
1032
|
+
this.greatWindow = new osuBase.OsuHitWindow(overallDifficulty).hitWindowFor300();
|
|
799
1033
|
}
|
|
800
1034
|
/**
|
|
801
1035
|
* @param current The hitobject to calculate.
|
|
802
1036
|
*/
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
return 0;
|
|
806
|
-
}
|
|
807
|
-
let strainTime = current.strainTime;
|
|
808
|
-
const greatWindowFull = this.hitWindow.hitWindowFor300() * 2;
|
|
809
|
-
// Aim to nerf cheesy rhythms (very fast consecutive doubles with large deltatimes between).
|
|
810
|
-
if (this.previous[0] &&
|
|
811
|
-
strainTime < greatWindowFull &&
|
|
812
|
-
this.previous[0].strainTime > strainTime) {
|
|
813
|
-
strainTime = osuBase.Interpolation.lerp(this.previous[0].strainTime, strainTime, strainTime / greatWindowFull);
|
|
814
|
-
}
|
|
815
|
-
// Cap deltatime to the OD 300 hitwindow.
|
|
816
|
-
// 0.58 is derived from making sure 260 BPM 1/4 OD5 streams aren't nerfed harshly, whilst 0.91 limits the effect of the cap.
|
|
817
|
-
strainTime /= osuBase.MathUtils.clamp(strainTime / greatWindowFull / 0.58, 0.91, 1);
|
|
818
|
-
let speedBonus = 1;
|
|
819
|
-
if (strainTime < this.minSpeedBonus) {
|
|
820
|
-
speedBonus +=
|
|
821
|
-
0.75 * Math.pow((this.minSpeedBonus - strainTime) / 40, 2);
|
|
822
|
-
}
|
|
823
|
-
let originalSpeedBonus = 1;
|
|
824
|
-
if (current.strainTime < this.minSpeedBonus) {
|
|
825
|
-
originalSpeedBonus +=
|
|
826
|
-
0.75 *
|
|
827
|
-
Math.pow((this.minSpeedBonus - current.strainTime) / 40, 2);
|
|
828
|
-
}
|
|
829
|
-
const decay = this.strainDecay(current.deltaTime);
|
|
1037
|
+
strainValueAt(current) {
|
|
1038
|
+
const decay = this.strainDecay(current.strainTime);
|
|
830
1039
|
this.currentTapStrain *= decay;
|
|
831
1040
|
this.currentTapStrain +=
|
|
832
|
-
|
|
1041
|
+
DroidTapEvaluator.evaluateDifficultyOf(current, this.greatWindow, true) * this.skillMultiplier;
|
|
833
1042
|
this.currentOriginalTapStrain *= decay;
|
|
834
1043
|
this.currentOriginalTapStrain +=
|
|
835
|
-
|
|
836
|
-
this.skillMultiplier;
|
|
1044
|
+
DroidTapEvaluator.evaluateDifficultyOf(current, this.greatWindow, false) * this.skillMultiplier;
|
|
837
1045
|
this.currentOriginalTapStrain *= current.rhythmMultiplier;
|
|
838
1046
|
return this.currentTapStrain * current.rhythmMultiplier;
|
|
839
1047
|
}
|
|
840
|
-
/**
|
|
841
|
-
* Calculates the tap strain of a hitobject given a specific speed bonus and strain time.
|
|
842
|
-
*/
|
|
843
|
-
tapStrainOf(speedBonus, strainTime) {
|
|
844
|
-
return speedBonus / strainTime;
|
|
845
|
-
}
|
|
846
|
-
/**
|
|
847
|
-
* @param current The hitobject to calculate.
|
|
848
|
-
*/
|
|
849
|
-
strainValueAt(current) {
|
|
850
|
-
return this.strainValueOf(current);
|
|
851
|
-
}
|
|
852
1048
|
/**
|
|
853
1049
|
* @param current The hitobject to save to.
|
|
854
1050
|
*/
|
|
@@ -859,158 +1055,129 @@ class DroidTap extends DroidSkill {
|
|
|
859
1055
|
}
|
|
860
1056
|
|
|
861
1057
|
/**
|
|
862
|
-
*
|
|
1058
|
+
* An evaluator for calculating flashlight skill.
|
|
1059
|
+
*
|
|
1060
|
+
* This class should be considered an "evaluating" class and not persisted.
|
|
863
1061
|
*/
|
|
864
|
-
class
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
/**
|
|
874
|
-
* The modifications applied.
|
|
875
|
-
*/
|
|
876
|
-
mods = [];
|
|
877
|
-
/**
|
|
878
|
-
* The total star rating of the beatmap.
|
|
879
|
-
*/
|
|
880
|
-
total = 0;
|
|
881
|
-
/**
|
|
882
|
-
* The map statistics of the beatmap after modifications are applied.
|
|
883
|
-
*/
|
|
884
|
-
stats = new osuBase.MapStats();
|
|
885
|
-
/**
|
|
886
|
-
* The strain peaks of various calculated difficulties.
|
|
887
|
-
*/
|
|
888
|
-
strainPeaks = {
|
|
889
|
-
aimWithSliders: [],
|
|
890
|
-
aimWithoutSliders: [],
|
|
891
|
-
speed: [],
|
|
892
|
-
flashlight: [],
|
|
893
|
-
};
|
|
894
|
-
/**
|
|
895
|
-
* Additional data that is used in performance calculation.
|
|
896
|
-
*/
|
|
897
|
-
attributes = {
|
|
898
|
-
speedNoteCount: 0,
|
|
899
|
-
sliderFactor: 1,
|
|
900
|
-
aimDifficultStrainCount: 0,
|
|
901
|
-
speedDifficultStrainCount: 0,
|
|
902
|
-
};
|
|
903
|
-
sectionLength = 400;
|
|
904
|
-
/**
|
|
905
|
-
* Calculates the star rating of the specified beatmap.
|
|
906
|
-
*
|
|
907
|
-
* The beatmap is analyzed in chunks of `sectionLength` duration.
|
|
908
|
-
* For each chunk the highest hitobject strains are added to
|
|
909
|
-
* a list which is then collapsed into a weighted sum, much
|
|
910
|
-
* like scores are weighted on a user's profile.
|
|
911
|
-
*
|
|
912
|
-
* For subsequent chunks, the initial max strain is calculated
|
|
913
|
-
* by decaying the previous hitobject's strain until the
|
|
914
|
-
* beginning of the new chunk.
|
|
915
|
-
*
|
|
916
|
-
* The first object doesn't generate a strain
|
|
917
|
-
* so we begin calculating from the second object.
|
|
918
|
-
*
|
|
919
|
-
* Also don't forget to manually add the peak strain for the last
|
|
920
|
-
* section which would otherwise be ignored.
|
|
921
|
-
*/
|
|
922
|
-
calculate(params, mode) {
|
|
923
|
-
const map = (this.map = osuBase.Utils.deepCopy(params.map));
|
|
924
|
-
const mod = (this.mods = params.mods ?? this.mods);
|
|
925
|
-
this.stats = new osuBase.MapStats({
|
|
926
|
-
cs: map.difficulty.cs,
|
|
927
|
-
ar: map.difficulty.ar,
|
|
928
|
-
od: map.difficulty.od,
|
|
929
|
-
hp: map.difficulty.hp,
|
|
930
|
-
mods: mod,
|
|
931
|
-
speedMultiplier: params.stats?.speedMultiplier ?? 1,
|
|
932
|
-
oldStatistics: params.stats?.oldStatistics ?? false,
|
|
933
|
-
}).calculate({ mode: mode });
|
|
934
|
-
this.generateDifficultyHitObjects(mode);
|
|
935
|
-
this.calculateAll();
|
|
936
|
-
return this;
|
|
937
|
-
}
|
|
1062
|
+
class FlashlightEvaluator {
|
|
1063
|
+
static maxOpacityBonus = 0.4;
|
|
1064
|
+
static hiddenBonus = 0.2;
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
/**
|
|
1068
|
+
* An evaluator for calculating osu!droid Flashlight skill.
|
|
1069
|
+
*/
|
|
1070
|
+
class DroidFlashlightEvaluator extends FlashlightEvaluator {
|
|
938
1071
|
/**
|
|
939
|
-
*
|
|
1072
|
+
* Evaluates the difficulty of memorizing and hitting the current object, based on:
|
|
940
1073
|
*
|
|
941
|
-
*
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
this.objects.length = 0;
|
|
945
|
-
this.objects.push(...new DifficultyHitObjectCreator().generateDifficultyObjects({
|
|
946
|
-
objects: this.map.hitObjects.objects,
|
|
947
|
-
circleSize: this.stats.cs,
|
|
948
|
-
speedMultiplier: this.stats.speedMultiplier,
|
|
949
|
-
mode: mode,
|
|
950
|
-
preempt: osuBase.MapStats.arToMS(this.stats.ar),
|
|
951
|
-
}));
|
|
952
|
-
}
|
|
953
|
-
/**
|
|
954
|
-
* Calculates the skills provided.
|
|
1074
|
+
* - distance between the previous and the current object,
|
|
1075
|
+
* - the visual opacity of the current object,
|
|
1076
|
+
* - and whether Hidden mod is enabled.
|
|
955
1077
|
*
|
|
956
|
-
* @param
|
|
1078
|
+
* @param current The current object.
|
|
1079
|
+
* @param isHiddenMod Whether the Hidden mod is enabled.
|
|
957
1080
|
*/
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
1081
|
+
static evaluateDifficultyOf(current, isHiddenMod) {
|
|
1082
|
+
const actualLast = current.previous(0);
|
|
1083
|
+
if (current.object instanceof osuBase.Spinner ||
|
|
1084
|
+
// Exclude overlapping objects that can be tapped at once.
|
|
1085
|
+
(current.deltaTime < 5 &&
|
|
1086
|
+
((actualLast?.object instanceof osuBase.Slider
|
|
1087
|
+
? Math.min(actualLast.object.stackedEndPosition.getDistance(current.object.stackedPosition), actualLast.object.lazyEndPosition.getDistance(current.object.stackedPosition))
|
|
1088
|
+
: actualLast?.object.stackedEndPosition.getDistance(current.object.stackedPosition)) ?? Number.POSITIVE_INFINITY) <=
|
|
1089
|
+
2 * current.object.radius)) {
|
|
1090
|
+
return 0;
|
|
1091
|
+
}
|
|
1092
|
+
const scalingFactor = 52 / current.object.radius;
|
|
1093
|
+
let smallDistNerf = 1;
|
|
1094
|
+
let cumulativeStrainTime = 0;
|
|
1095
|
+
let result = 0;
|
|
1096
|
+
let last = current;
|
|
1097
|
+
for (let i = 0; i < Math.min(current.index, 10); ++i) {
|
|
1098
|
+
const currentObject = current.previous(i);
|
|
1099
|
+
if (!(currentObject.object instanceof osuBase.Spinner) &&
|
|
1100
|
+
// Exclude overlapping objects that can be tapped at once.
|
|
1101
|
+
currentObject.deltaTime >= 5) {
|
|
1102
|
+
const jumpDistance = current.object.stackedPosition.subtract(currentObject.object.endPosition).length;
|
|
1103
|
+
cumulativeStrainTime += last.strainTime;
|
|
1104
|
+
// We want to nerf objects that can be easily seen within the Flashlight circle radius.
|
|
1105
|
+
if (i === 0) {
|
|
1106
|
+
smallDistNerf = Math.min(1, jumpDistance / 75);
|
|
965
1107
|
}
|
|
966
|
-
|
|
967
|
-
|
|
1108
|
+
// We also want to nerf stacks so that only the first object of the stack is accounted for.
|
|
1109
|
+
const stackNerf = Math.min(1, currentObject.lazyJumpDistance / scalingFactor / 25);
|
|
1110
|
+
// Bonus based on how visible the object is.
|
|
1111
|
+
const opacityBonus = 1 +
|
|
1112
|
+
this.maxOpacityBonus *
|
|
1113
|
+
(1.0 -
|
|
1114
|
+
current.opacityAt(currentObject.startTime, isHiddenMod));
|
|
1115
|
+
result +=
|
|
1116
|
+
(stackNerf * opacityBonus * scalingFactor * jumpDistance) /
|
|
1117
|
+
cumulativeStrainTime;
|
|
1118
|
+
}
|
|
1119
|
+
last = currentObject;
|
|
1120
|
+
}
|
|
1121
|
+
// Additional bonus for Hidden due to there being no approach circles.
|
|
1122
|
+
if (isHiddenMod) {
|
|
1123
|
+
result *= 1 + this.hiddenBonus;
|
|
1124
|
+
}
|
|
1125
|
+
return Math.pow(smallDistNerf * result, 2);
|
|
968
1126
|
}
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
* Represents the skill required to memorize and hit every object in a beatmap with the Flashlight mod enabled.
|
|
1131
|
+
*/
|
|
1132
|
+
class DroidFlashlight extends DroidSkill {
|
|
1133
|
+
skillMultiplier = 0.1;
|
|
1134
|
+
strainDecayBase = 0.15;
|
|
1135
|
+
reducedSectionCount = 10;
|
|
1136
|
+
reducedSectionBaseline = 0.75;
|
|
1137
|
+
starsPerDouble = 1.05;
|
|
1138
|
+
isHidden;
|
|
1139
|
+
constructor(mods) {
|
|
1140
|
+
super(mods);
|
|
1141
|
+
this.isHidden = mods.some((m) => m instanceof osuBase.ModHidden);
|
|
976
1142
|
}
|
|
977
1143
|
/**
|
|
978
|
-
*
|
|
979
|
-
*
|
|
980
|
-
* @param rating The difficulty rating.
|
|
1144
|
+
* @param current The hitobject to calculate.
|
|
981
1145
|
*/
|
|
982
|
-
|
|
983
|
-
|
|
1146
|
+
strainValueAt(current) {
|
|
1147
|
+
this.currentStrain *= this.strainDecay(current.deltaTime);
|
|
1148
|
+
this.currentStrain +=
|
|
1149
|
+
DroidFlashlightEvaluator.evaluateDifficultyOf(current, this.isHidden) * this.skillMultiplier;
|
|
1150
|
+
return this.currentStrain;
|
|
1151
|
+
}
|
|
1152
|
+
saveToHitObject(current) {
|
|
1153
|
+
current.flashlightStrain = this.currentStrain;
|
|
984
1154
|
}
|
|
985
1155
|
}
|
|
986
1156
|
|
|
987
1157
|
/**
|
|
988
|
-
*
|
|
1158
|
+
* An evaluator for calculating rhythm skill.
|
|
1159
|
+
*
|
|
1160
|
+
* This class should be considered an "evaluating" class and not persisted.
|
|
989
1161
|
*/
|
|
990
|
-
class
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
historyTimeMax = 5000; // 5 seconds of calculateRhythmBonus max.
|
|
999
|
-
currentRhythm = 1;
|
|
1000
|
-
hitWindow;
|
|
1001
|
-
constructor(mods, overallDifficulty) {
|
|
1002
|
-
super(mods);
|
|
1003
|
-
this.hitWindow = new osuBase.OsuHitWindow(overallDifficulty);
|
|
1004
|
-
const odScaling = Math.pow(this.hitWindow.overallDifficulty, 2) / 400;
|
|
1005
|
-
this.rhythmMultiplier =
|
|
1006
|
-
0.75 +
|
|
1007
|
-
(this.hitWindow.overallDifficulty >= 0 ? odScaling : -odScaling);
|
|
1008
|
-
}
|
|
1162
|
+
class RhythmEvaluator {
|
|
1163
|
+
static historyTimeMax = 5000; // 5 seconds of calculateRhythmBonus max.
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
/**
|
|
1167
|
+
* An evaluator for calculating osu!droid Rhythm skill.
|
|
1168
|
+
*/
|
|
1169
|
+
class DroidRhythmEvaluator extends RhythmEvaluator {
|
|
1009
1170
|
/**
|
|
1010
|
-
* Calculates a rhythm multiplier for the difficulty of the tap associated
|
|
1171
|
+
* Calculates a rhythm multiplier for the difficulty of the tap associated
|
|
1172
|
+
* with historic data of the current object.
|
|
1173
|
+
*
|
|
1174
|
+
* @param current The current object.
|
|
1175
|
+
* @param greatWindow The great hit window of the current object.
|
|
1011
1176
|
*/
|
|
1012
|
-
|
|
1013
|
-
if (current.object instanceof osuBase.Spinner
|
|
1177
|
+
static evaluateDifficultyOf(current, greatWindow) {
|
|
1178
|
+
if (current.object instanceof osuBase.Spinner ||
|
|
1179
|
+
// Exclude overlapping objects that can be tapped at once.
|
|
1180
|
+
current.deltaTime < 5) {
|
|
1014
1181
|
return 1;
|
|
1015
1182
|
}
|
|
1016
1183
|
let previousIslandSize = 0;
|
|
@@ -1020,29 +1187,40 @@ class DroidRhythm extends DroidSkill {
|
|
|
1020
1187
|
let startRatio = 0;
|
|
1021
1188
|
let firstDeltaSwitch = false;
|
|
1022
1189
|
let rhythmStart = 0;
|
|
1023
|
-
|
|
1024
|
-
|
|
1190
|
+
const historicalNoteCount = Math.min(current.index, 32);
|
|
1191
|
+
// Exclude overlapping objects that can be tapped at once.
|
|
1192
|
+
const validPrevious = [];
|
|
1193
|
+
for (let i = 0; i < historicalNoteCount; ++i) {
|
|
1194
|
+
const object = current.previous(i);
|
|
1195
|
+
if (!object) {
|
|
1196
|
+
break;
|
|
1197
|
+
}
|
|
1198
|
+
if (object.deltaTime >= 5) {
|
|
1199
|
+
validPrevious.push(object);
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
while (rhythmStart < validPrevious.length - 2 &&
|
|
1203
|
+
current.startTime - validPrevious[rhythmStart].startTime <
|
|
1025
1204
|
this.historyTimeMax) {
|
|
1026
1205
|
++rhythmStart;
|
|
1027
1206
|
}
|
|
1028
1207
|
for (let i = rhythmStart; i > 0; --i) {
|
|
1029
1208
|
// Scale note 0 to 1 from history to now.
|
|
1030
1209
|
let currentHistoricalDecay = (this.historyTimeMax -
|
|
1031
|
-
(current.startTime -
|
|
1210
|
+
(current.startTime - validPrevious[i - 1].startTime)) /
|
|
1032
1211
|
this.historyTimeMax;
|
|
1033
1212
|
// Either we're limited by time or limited by object count.
|
|
1034
|
-
currentHistoricalDecay = Math.min(currentHistoricalDecay, (
|
|
1035
|
-
const currentDelta =
|
|
1036
|
-
const prevDelta =
|
|
1037
|
-
const lastDelta =
|
|
1213
|
+
currentHistoricalDecay = Math.min(currentHistoricalDecay, (validPrevious.length - i) / validPrevious.length);
|
|
1214
|
+
const currentDelta = validPrevious[i - 1].strainTime;
|
|
1215
|
+
const prevDelta = validPrevious[i].strainTime;
|
|
1216
|
+
const lastDelta = validPrevious[i + 1].strainTime;
|
|
1038
1217
|
const currentRatio = 1 +
|
|
1039
1218
|
6 *
|
|
1040
1219
|
Math.min(0.5, Math.pow(Math.sin(Math.PI /
|
|
1041
1220
|
(Math.min(prevDelta, currentDelta) /
|
|
1042
1221
|
Math.max(prevDelta, currentDelta))), 2));
|
|
1043
|
-
const windowPenalty = Math.min(1, Math.max(0, Math.abs(prevDelta - currentDelta) -
|
|
1044
|
-
|
|
1045
|
-
(this.hitWindow.hitWindowFor300() * 0.4));
|
|
1222
|
+
const windowPenalty = Math.min(1, Math.max(0, Math.abs(prevDelta - currentDelta) - greatWindow * 0.4) /
|
|
1223
|
+
(greatWindow * 0.4));
|
|
1046
1224
|
let effectiveRatio = windowPenalty * currentRatio;
|
|
1047
1225
|
if (firstDeltaSwitch) {
|
|
1048
1226
|
if (prevDelta <= 1.25 * currentDelta &&
|
|
@@ -1053,11 +1231,11 @@ class DroidRhythm extends DroidSkill {
|
|
|
1053
1231
|
}
|
|
1054
1232
|
}
|
|
1055
1233
|
else {
|
|
1056
|
-
if (
|
|
1234
|
+
if (validPrevious[i - 1].object instanceof osuBase.Slider) {
|
|
1057
1235
|
// BPM change is into slider, this is easy acc window.
|
|
1058
1236
|
effectiveRatio /= 8;
|
|
1059
1237
|
}
|
|
1060
|
-
if (
|
|
1238
|
+
if (validPrevious[i].object instanceof osuBase.Slider) {
|
|
1061
1239
|
// BPM change was from a slider, this is typically easier than circle -> circle.
|
|
1062
1240
|
effectiveRatio /= 4;
|
|
1063
1241
|
}
|
|
@@ -1100,10 +1278,39 @@ class DroidRhythm extends DroidSkill {
|
|
|
1100
1278
|
islandSize = 1;
|
|
1101
1279
|
}
|
|
1102
1280
|
}
|
|
1103
|
-
return Math.sqrt(4 +
|
|
1281
|
+
return (Math.sqrt(4 +
|
|
1282
|
+
rhythmComplexitySum *
|
|
1283
|
+
this.calculateRhythmMultiplier(greatWindow)) / 2);
|
|
1284
|
+
}
|
|
1285
|
+
/**
|
|
1286
|
+
* Calculates the rhythm multiplier of a given hit window.
|
|
1287
|
+
*
|
|
1288
|
+
* @param greatWindow The great hit window.
|
|
1289
|
+
*/
|
|
1290
|
+
static calculateRhythmMultiplier(greatWindow) {
|
|
1291
|
+
const od = osuBase.OsuHitWindow.hitWindow300ToOD(greatWindow);
|
|
1292
|
+
const odScaling = Math.pow(od, 2) / 400;
|
|
1293
|
+
return 0.75 + (od >= 0 ? odScaling : -odScaling);
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
/**
|
|
1298
|
+
* Represents the skill required to properly follow a beatmap's rhythm.
|
|
1299
|
+
*/
|
|
1300
|
+
class DroidRhythm extends DroidSkill {
|
|
1301
|
+
skillMultiplier = 1;
|
|
1302
|
+
reducedSectionCount = 5;
|
|
1303
|
+
reducedSectionBaseline = 0.75;
|
|
1304
|
+
strainDecayBase = 0.3;
|
|
1305
|
+
starsPerDouble = 1.75;
|
|
1306
|
+
currentRhythm = 1;
|
|
1307
|
+
hitWindow;
|
|
1308
|
+
constructor(mods, overallDifficulty) {
|
|
1309
|
+
super(mods);
|
|
1310
|
+
this.hitWindow = new osuBase.OsuHitWindow(overallDifficulty);
|
|
1104
1311
|
}
|
|
1105
1312
|
strainValueAt(current) {
|
|
1106
|
-
this.currentRhythm = this.
|
|
1313
|
+
this.currentRhythm = DroidRhythmEvaluator.evaluateDifficultyOf(current, this.hitWindow.hitWindowFor300());
|
|
1107
1314
|
this.currentStrain *= this.strainDecay(current.deltaTime);
|
|
1108
1315
|
this.currentStrain += this.currentRhythm - 1;
|
|
1109
1316
|
return this.currentStrain;
|
|
@@ -1115,27 +1322,31 @@ class DroidRhythm extends DroidSkill {
|
|
|
1115
1322
|
}
|
|
1116
1323
|
|
|
1117
1324
|
/**
|
|
1118
|
-
*
|
|
1325
|
+
* An evaluator for calculating osu!droid Rhythm skill.
|
|
1119
1326
|
*/
|
|
1120
|
-
class
|
|
1121
|
-
historyLength = 4;
|
|
1122
|
-
starsPerDouble = 1.025;
|
|
1123
|
-
reducedSectionCount = 10;
|
|
1124
|
-
reducedSectionBaseline = 0.75;
|
|
1125
|
-
skillMultiplier = 20;
|
|
1126
|
-
strainDecayBase = 0.1;
|
|
1127
|
-
preempt;
|
|
1128
|
-
isHidden;
|
|
1129
|
-
constructor(mods, preempt) {
|
|
1130
|
-
super(mods);
|
|
1131
|
-
this.preempt = preempt;
|
|
1132
|
-
this.isHidden = mods.some((m) => m instanceof osuBase.ModHidden);
|
|
1133
|
-
}
|
|
1327
|
+
class DroidVisualEvaluator {
|
|
1134
1328
|
/**
|
|
1135
|
-
*
|
|
1329
|
+
* Evaluates the difficulty of reading the current object, based on:
|
|
1330
|
+
*
|
|
1331
|
+
* - note density of the current object,
|
|
1332
|
+
* - overlapping factor of the current object,
|
|
1333
|
+
* - the preempt time of the current object,
|
|
1334
|
+
* - the velocity of the current object if it's a slider,
|
|
1335
|
+
* - past objects' velocity if they are sliders,
|
|
1336
|
+
* - and whether the Hidden mod is enabled.
|
|
1337
|
+
*
|
|
1338
|
+
* @param current The current object.
|
|
1339
|
+
* @param isHiddenMod Whether the Hidden mod is enabled.
|
|
1136
1340
|
*/
|
|
1137
|
-
|
|
1138
|
-
|
|
1341
|
+
static evaluateDifficultyOf(current, isHiddenMod) {
|
|
1342
|
+
const last = current.previous(0);
|
|
1343
|
+
if (current.object instanceof osuBase.Spinner ||
|
|
1344
|
+
// Exclude overlapping objects that can be tapped at once.
|
|
1345
|
+
(current.deltaTime < 5 &&
|
|
1346
|
+
((last?.object instanceof osuBase.Slider
|
|
1347
|
+
? Math.min(last.object.stackedEndPosition.getDistance(current.object.stackedPosition), last.object.lazyEndPosition.getDistance(current.object.stackedPosition))
|
|
1348
|
+
: last?.object.stackedEndPosition.getDistance(current.object.stackedPosition)) ?? Number.POSITIVE_INFINITY) <=
|
|
1349
|
+
2 * current.object.radius)) {
|
|
1139
1350
|
return 0;
|
|
1140
1351
|
}
|
|
1141
1352
|
// Start with base density and give global bonus for Hidden.
|
|
@@ -1143,15 +1354,20 @@ class DroidVisual extends DroidSkill {
|
|
|
1143
1354
|
let strain = Math.min(20, Math.pow(current.noteDensity, 2)) /
|
|
1144
1355
|
10 /
|
|
1145
1356
|
(1 + current.overlappingFactor);
|
|
1146
|
-
if (
|
|
1357
|
+
if (isHiddenMod) {
|
|
1147
1358
|
strain +=
|
|
1148
1359
|
Math.min(25, Math.pow(current.noteDensity, 1.25)) /
|
|
1149
1360
|
10 /
|
|
1150
1361
|
(1 + current.overlappingFactor / 1.25);
|
|
1151
1362
|
}
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
strain += Math.pow(400 -
|
|
1363
|
+
if (current.timePreempt < 400) {
|
|
1364
|
+
// Give bonus for AR higher than 10.33.
|
|
1365
|
+
strain += Math.pow(400 - current.timePreempt, 1.3) / 135;
|
|
1366
|
+
}
|
|
1367
|
+
else if (current.timePreempt < 525) {
|
|
1368
|
+
// Give bonus for AR between 9.5 and 10 to not make higher non-DT value less than NM.
|
|
1369
|
+
strain +=
|
|
1370
|
+
Math.pow(525 - Math.max(current.timePreempt, 450), 1.1) / 500;
|
|
1155
1371
|
}
|
|
1156
1372
|
if (current.object instanceof osuBase.Slider) {
|
|
1157
1373
|
const scalingFactor = 50 / current.object.radius;
|
|
@@ -1163,10 +1379,14 @@ class DroidVisual extends DroidSkill {
|
|
|
1163
1379
|
Math.min(1, current.travelDistance / scalingFactor / 125);
|
|
1164
1380
|
let cumulativeStrainTime = 0;
|
|
1165
1381
|
// Reward for velocity changes based on last few sliders.
|
|
1166
|
-
for (let i = 0; i <
|
|
1167
|
-
const last =
|
|
1382
|
+
for (let i = 0; i < Math.min(current.index, 4); ++i) {
|
|
1383
|
+
const last = current.previous(i);
|
|
1168
1384
|
cumulativeStrainTime += last.strainTime;
|
|
1169
|
-
if (!(last.object instanceof osuBase.Slider)
|
|
1385
|
+
if (!(last.object instanceof osuBase.Slider) ||
|
|
1386
|
+
// Exclude overlapping objects that can be tapped at once.
|
|
1387
|
+
(last.deltaTime < 5 &&
|
|
1388
|
+
Math.min(last.object.stackedEndPosition.getDistance(current.object.stackedPosition), last.object.lazyEndPosition.getDistance(current.object.stackedPosition)) <=
|
|
1389
|
+
2 * current.object.radius)) {
|
|
1170
1390
|
continue;
|
|
1171
1391
|
}
|
|
1172
1392
|
strain +=
|
|
@@ -1180,11 +1400,28 @@ class DroidVisual extends DroidSkill {
|
|
|
1180
1400
|
}
|
|
1181
1401
|
return strain;
|
|
1182
1402
|
}
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
/**
|
|
1406
|
+
* Represents the skill required to read every object in the map.
|
|
1407
|
+
*/
|
|
1408
|
+
class DroidVisual extends DroidSkill {
|
|
1409
|
+
starsPerDouble = 1.025;
|
|
1410
|
+
reducedSectionCount = 10;
|
|
1411
|
+
reducedSectionBaseline = 0.75;
|
|
1412
|
+
skillMultiplier = 20;
|
|
1413
|
+
strainDecayBase = 0.1;
|
|
1414
|
+
isHidden;
|
|
1415
|
+
constructor(mods) {
|
|
1416
|
+
super(mods);
|
|
1417
|
+
this.isHidden = mods.some((m) => m instanceof osuBase.ModHidden);
|
|
1418
|
+
}
|
|
1183
1419
|
strainValueAt(current) {
|
|
1184
1420
|
this.currentStrain *= this.strainDecay(current.deltaTime);
|
|
1185
1421
|
this.currentStrain +=
|
|
1186
|
-
|
|
1187
|
-
|
|
1422
|
+
DroidVisualEvaluator.evaluateDifficultyOf(current, this.isHidden) *
|
|
1423
|
+
this.skillMultiplier;
|
|
1424
|
+
return this.currentStrain * (1 + (current.rhythmMultiplier - 1) / 5);
|
|
1188
1425
|
}
|
|
1189
1426
|
saveToHitObject(current) {
|
|
1190
1427
|
current.visualStrain = this.currentStrain;
|
|
@@ -1192,9 +1429,9 @@ class DroidVisual extends DroidSkill {
|
|
|
1192
1429
|
}
|
|
1193
1430
|
|
|
1194
1431
|
/**
|
|
1195
|
-
*
|
|
1432
|
+
* A difficulty calculator for osu!droid gamemode.
|
|
1196
1433
|
*/
|
|
1197
|
-
class
|
|
1434
|
+
class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
1198
1435
|
/**
|
|
1199
1436
|
* The aim star rating of the beatmap.
|
|
1200
1437
|
*/
|
|
@@ -1216,33 +1453,7 @@ class DroidStarRating extends StarRating {
|
|
|
1216
1453
|
*/
|
|
1217
1454
|
visual = 0;
|
|
1218
1455
|
difficultyMultiplier = 0.18;
|
|
1219
|
-
|
|
1220
|
-
* Calculates the star rating of the specified beatmap.
|
|
1221
|
-
*
|
|
1222
|
-
* The beatmap is analyzed in chunks of `sectionLength` duration.
|
|
1223
|
-
* For each chunk the highest hitobject strains are added to
|
|
1224
|
-
* a list which is then collapsed into a weighted sum, much
|
|
1225
|
-
* like scores are weighted on a user's profile.
|
|
1226
|
-
*
|
|
1227
|
-
* For subsequent chunks, the initial max strain is calculated
|
|
1228
|
-
* by decaying the previous hitobject's strain until the
|
|
1229
|
-
* beginning of the new chunk.
|
|
1230
|
-
*
|
|
1231
|
-
* The first object doesn't generate a strain
|
|
1232
|
-
* so we begin calculating from the second object.
|
|
1233
|
-
*
|
|
1234
|
-
* Also don't forget to manually add the peak strain for the last
|
|
1235
|
-
* section which would otherwise be ignored.
|
|
1236
|
-
*/
|
|
1237
|
-
calculate(params) {
|
|
1238
|
-
return super.calculate(params, osuBase.modes.droid);
|
|
1239
|
-
}
|
|
1240
|
-
/**
|
|
1241
|
-
* Generates difficulty hitobjects for this calculator.
|
|
1242
|
-
*/
|
|
1243
|
-
generateDifficultyHitObjects() {
|
|
1244
|
-
super.generateDifficultyHitObjects(osuBase.modes.droid);
|
|
1245
|
-
}
|
|
1456
|
+
mode = osuBase.modes.droid;
|
|
1246
1457
|
/**
|
|
1247
1458
|
* Calculates the aim star rating of the beatmap and stores it in this instance.
|
|
1248
1459
|
*/
|
|
@@ -1253,7 +1464,7 @@ class DroidStarRating extends StarRating {
|
|
|
1253
1464
|
this.postCalculateAim(aimSkill, aimSkillWithoutSliders);
|
|
1254
1465
|
}
|
|
1255
1466
|
/**
|
|
1256
|
-
* Calculates the
|
|
1467
|
+
* Calculates the tap star rating of the beatmap and stores it in this instance.
|
|
1257
1468
|
*/
|
|
1258
1469
|
calculateTap() {
|
|
1259
1470
|
const tapSkill = new DroidTap(this.mods, this.stats.od);
|
|
@@ -1261,9 +1472,7 @@ class DroidStarRating extends StarRating {
|
|
|
1261
1472
|
if (!this.mods.some((m) => m instanceof osuBase.ModRelax)) {
|
|
1262
1473
|
this.postCalculateTap(tapSkill);
|
|
1263
1474
|
}
|
|
1264
|
-
|
|
1265
|
-
this.calculateSpeedAttributes();
|
|
1266
|
-
}
|
|
1475
|
+
this.calculateSpeedAttributes();
|
|
1267
1476
|
}
|
|
1268
1477
|
/**
|
|
1269
1478
|
* Calculates the rhythm star rating of the beatmap and stores it in this instance.
|
|
@@ -1288,7 +1497,7 @@ class DroidStarRating extends StarRating {
|
|
|
1288
1497
|
* Calculates the visual star rating of the beatmap and stores it in this instance.
|
|
1289
1498
|
*/
|
|
1290
1499
|
calculateVisual() {
|
|
1291
|
-
const visualSkill = new DroidVisual(this.mods
|
|
1500
|
+
const visualSkill = new DroidVisual(this.mods);
|
|
1292
1501
|
this.calculateSkills(visualSkill);
|
|
1293
1502
|
this.postCalculateVisual(visualSkill);
|
|
1294
1503
|
}
|
|
@@ -1325,9 +1534,7 @@ class DroidStarRating extends StarRating {
|
|
|
1325
1534
|
if (!isRelax) {
|
|
1326
1535
|
this.postCalculateTap(tapSkill);
|
|
1327
1536
|
}
|
|
1328
|
-
|
|
1329
|
-
this.calculateSpeedAttributes();
|
|
1330
|
-
}
|
|
1537
|
+
this.calculateSpeedAttributes();
|
|
1331
1538
|
if (!isRelax) {
|
|
1332
1539
|
this.postCalculateRhythm(rhythmSkill);
|
|
1333
1540
|
}
|
|
@@ -1363,7 +1570,7 @@ class DroidStarRating extends StarRating {
|
|
|
1363
1570
|
new DroidRhythm(this.mods, this.stats.od),
|
|
1364
1571
|
new DroidTap(this.mods, this.stats.od),
|
|
1365
1572
|
new DroidFlashlight(this.mods),
|
|
1366
|
-
new DroidVisual(this.mods
|
|
1573
|
+
new DroidVisual(this.mods),
|
|
1367
1574
|
];
|
|
1368
1575
|
}
|
|
1369
1576
|
/**
|
|
@@ -1390,7 +1597,6 @@ class DroidStarRating extends StarRating {
|
|
|
1390
1597
|
postCalculateTap(tapSkill) {
|
|
1391
1598
|
this.strainPeaks.speed = tapSkill.strainPeaks;
|
|
1392
1599
|
this.tap = this.starValue(tapSkill.difficultyValue());
|
|
1393
|
-
this.calculateSpeedAttributes();
|
|
1394
1600
|
}
|
|
1395
1601
|
/**
|
|
1396
1602
|
* Calculates speed-related attributes.
|
|
@@ -1441,6 +1647,10 @@ class PerformanceCalculator {
|
|
|
1441
1647
|
* The calculated accuracy.
|
|
1442
1648
|
*/
|
|
1443
1649
|
computedAccuracy = new osuBase.Accuracy({});
|
|
1650
|
+
/**
|
|
1651
|
+
* The difficulty calculator that is being calculated.
|
|
1652
|
+
*/
|
|
1653
|
+
difficultyCalculator;
|
|
1444
1654
|
/**
|
|
1445
1655
|
* The map statistics after applying modifications.
|
|
1446
1656
|
*/
|
|
@@ -1458,12 +1668,21 @@ class PerformanceCalculator {
|
|
|
1458
1668
|
*/
|
|
1459
1669
|
sliderNerfFactor = 1;
|
|
1460
1670
|
/**
|
|
1461
|
-
*
|
|
1671
|
+
* @param difficultyCalculator The difficulty calculator to calculate.
|
|
1672
|
+
*/
|
|
1673
|
+
constructor(difficultyCalculator) {
|
|
1674
|
+
this.difficultyCalculator = difficultyCalculator;
|
|
1675
|
+
}
|
|
1676
|
+
/**
|
|
1677
|
+
* Calculates the performance points of the beatmap.
|
|
1678
|
+
*
|
|
1679
|
+
* @param options Options for performance calculation.
|
|
1680
|
+
* @returns The current instance.
|
|
1462
1681
|
*/
|
|
1463
|
-
|
|
1464
|
-
this.
|
|
1682
|
+
calculate(options) {
|
|
1683
|
+
this.handleOptions(options);
|
|
1465
1684
|
this.calculateValues();
|
|
1466
|
-
this.
|
|
1685
|
+
this.calculateTotalValue();
|
|
1467
1686
|
return this;
|
|
1468
1687
|
}
|
|
1469
1688
|
/**
|
|
@@ -1473,45 +1692,44 @@ class PerformanceCalculator {
|
|
|
1473
1692
|
return Math.pow(5 * Math.max(1, stars / 0.0675) - 4, 3) / 100000;
|
|
1474
1693
|
}
|
|
1475
1694
|
/**
|
|
1476
|
-
* Processes given
|
|
1695
|
+
* Processes given options for usage in performance calculation.
|
|
1477
1696
|
*/
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
const maxCombo = this.stars.map.maxCombo;
|
|
1697
|
+
handleOptions(options) {
|
|
1698
|
+
const maxCombo = this.difficultyCalculator.beatmap.maxCombo;
|
|
1481
1699
|
const miss = this.computedAccuracy.nmiss;
|
|
1482
|
-
const combo =
|
|
1483
|
-
const mod = this.
|
|
1484
|
-
const baseAR = this.
|
|
1485
|
-
const baseOD = this.
|
|
1700
|
+
const combo = options?.combo ?? maxCombo - miss;
|
|
1701
|
+
const mod = this.difficultyCalculator.mods;
|
|
1702
|
+
const baseAR = this.difficultyCalculator.beatmap.difficulty.ar;
|
|
1703
|
+
const baseOD = this.difficultyCalculator.beatmap.difficulty.od;
|
|
1486
1704
|
// Penalize misses by assessing # of misses relative to the total # of objects. Default a 3% reduction for any # of misses.
|
|
1487
1705
|
this.comboPenalty = Math.min(Math.pow(combo / maxCombo, 0.8), 1);
|
|
1488
|
-
if (
|
|
1706
|
+
if (options?.accPercent instanceof osuBase.Accuracy) {
|
|
1489
1707
|
// Copy into new instance to not modify the original
|
|
1490
|
-
this.computedAccuracy = new osuBase.Accuracy(
|
|
1708
|
+
this.computedAccuracy = new osuBase.Accuracy(options?.accPercent);
|
|
1491
1709
|
}
|
|
1492
1710
|
else {
|
|
1493
1711
|
this.computedAccuracy = new osuBase.Accuracy({
|
|
1494
|
-
percent:
|
|
1495
|
-
nobjects: this.
|
|
1496
|
-
nmiss:
|
|
1712
|
+
percent: options?.accPercent,
|
|
1713
|
+
nobjects: this.difficultyCalculator.objects.length,
|
|
1714
|
+
nmiss: options?.miss || 0,
|
|
1497
1715
|
});
|
|
1498
1716
|
}
|
|
1499
1717
|
this.effectiveMissCount = this.calculateEffectiveMissCount(combo, maxCombo);
|
|
1500
|
-
if (this.
|
|
1718
|
+
if (this.difficultyCalculator.mods.some((m) => m instanceof osuBase.ModNoFail)) {
|
|
1501
1719
|
this.finalMultiplier *= Math.max(0.9, 1 - 0.02 * this.effectiveMissCount);
|
|
1502
1720
|
}
|
|
1503
|
-
if (this.
|
|
1721
|
+
if (this.difficultyCalculator.mods.some((m) => m instanceof osuBase.ModSpunOut)) {
|
|
1504
1722
|
this.finalMultiplier *=
|
|
1505
1723
|
1 -
|
|
1506
|
-
Math.pow(this.
|
|
1507
|
-
this.
|
|
1724
|
+
Math.pow(this.difficultyCalculator.beatmap.hitObjects.spinners /
|
|
1725
|
+
this.difficultyCalculator.objects.length, 0.85);
|
|
1508
1726
|
}
|
|
1509
|
-
if (this.
|
|
1727
|
+
if (this.difficultyCalculator.mods.some((m) => m instanceof osuBase.ModRelax)) {
|
|
1510
1728
|
// As we're adding 100s and 50s to an approximated number of combo breaks, the result can be higher
|
|
1511
1729
|
// than total hits in specific scenarios (which breaks some calculations), so we need to clamp it.
|
|
1512
1730
|
this.effectiveMissCount = Math.min(this.effectiveMissCount +
|
|
1513
1731
|
this.computedAccuracy.n100 +
|
|
1514
|
-
this.computedAccuracy.n50, this.
|
|
1732
|
+
this.computedAccuracy.n50, this.difficultyCalculator.objects.length);
|
|
1515
1733
|
this.finalMultiplier *= 0.6;
|
|
1516
1734
|
}
|
|
1517
1735
|
this.mapStatistics = new osuBase.MapStats({
|
|
@@ -1519,42 +1737,44 @@ class PerformanceCalculator {
|
|
|
1519
1737
|
od: baseOD,
|
|
1520
1738
|
mods: mod,
|
|
1521
1739
|
});
|
|
1522
|
-
if (this.
|
|
1740
|
+
if (this.difficultyCalculator.beatmap.hitObjects.sliders > 0) {
|
|
1523
1741
|
// We assume 15% of sliders in a beatmap are difficult since there's no way to tell from the performance calculator.
|
|
1524
|
-
const estimateDifficultSliders = this.
|
|
1742
|
+
const estimateDifficultSliders = this.difficultyCalculator.beatmap.hitObjects.sliders * 0.15;
|
|
1525
1743
|
const estimateSliderEndsDropped = osuBase.MathUtils.clamp(Math.min(this.computedAccuracy.n300 +
|
|
1526
1744
|
this.computedAccuracy.n50 +
|
|
1527
1745
|
this.computedAccuracy.nmiss, maxCombo - combo), 0, estimateDifficultSliders);
|
|
1528
1746
|
this.sliderNerfFactor =
|
|
1529
|
-
(1 - this.
|
|
1747
|
+
(1 - this.difficultyCalculator.attributes.sliderFactor) *
|
|
1530
1748
|
Math.pow(1 -
|
|
1531
1749
|
estimateSliderEndsDropped /
|
|
1532
1750
|
estimateDifficultSliders, 3) +
|
|
1533
|
-
this.
|
|
1751
|
+
this.difficultyCalculator.attributes.sliderFactor;
|
|
1534
1752
|
}
|
|
1535
|
-
if (
|
|
1536
|
-
this.mapStatistics.ar =
|
|
1753
|
+
if (options?.stats) {
|
|
1754
|
+
this.mapStatistics.ar = options?.stats.ar ?? this.mapStatistics.ar;
|
|
1537
1755
|
this.mapStatistics.isForceAR =
|
|
1538
|
-
|
|
1756
|
+
options?.stats.isForceAR ?? this.mapStatistics.isForceAR;
|
|
1539
1757
|
this.mapStatistics.speedMultiplier =
|
|
1540
|
-
|
|
1758
|
+
options?.stats.speedMultiplier ??
|
|
1541
1759
|
this.mapStatistics.speedMultiplier;
|
|
1542
1760
|
this.mapStatistics.oldStatistics =
|
|
1543
|
-
|
|
1761
|
+
options?.stats.oldStatistics ??
|
|
1762
|
+
this.mapStatistics.oldStatistics;
|
|
1544
1763
|
}
|
|
1545
|
-
this.mapStatistics.calculate({ mode: mode });
|
|
1764
|
+
this.mapStatistics.calculate({ mode: this.mode });
|
|
1546
1765
|
}
|
|
1547
1766
|
/**
|
|
1548
1767
|
* Calculates the amount of misses + sliderbreaks from combo.
|
|
1549
1768
|
*/
|
|
1550
1769
|
calculateEffectiveMissCount(combo, maxCombo) {
|
|
1551
1770
|
let comboBasedMissCount = 0;
|
|
1552
|
-
if (this.
|
|
1553
|
-
const fullComboThreshold = maxCombo -
|
|
1771
|
+
if (this.difficultyCalculator.beatmap.hitObjects.sliders > 0) {
|
|
1772
|
+
const fullComboThreshold = maxCombo -
|
|
1773
|
+
0.1 * this.difficultyCalculator.beatmap.hitObjects.sliders;
|
|
1554
1774
|
if (combo < fullComboThreshold) {
|
|
1555
1775
|
// We're clamping miss count because since it's derived from combo, it can
|
|
1556
1776
|
// be higher than the amount of objects and that breaks some calculations.
|
|
1557
|
-
comboBasedMissCount = Math.min(fullComboThreshold / Math.max(1, combo), this.
|
|
1777
|
+
comboBasedMissCount = Math.min(fullComboThreshold / Math.max(1, combo), this.difficultyCalculator.objects.length);
|
|
1558
1778
|
}
|
|
1559
1779
|
}
|
|
1560
1780
|
return Math.max(this.computedAccuracy.nmiss, comboBasedMissCount);
|
|
@@ -1565,8 +1785,6 @@ class PerformanceCalculator {
|
|
|
1565
1785
|
* A performance points calculator that calculates performance points for osu!droid gamemode.
|
|
1566
1786
|
*/
|
|
1567
1787
|
class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
1568
|
-
stars = new DroidStarRating();
|
|
1569
|
-
finalMultiplier = 1.24;
|
|
1570
1788
|
/**
|
|
1571
1789
|
* The aim performance value.
|
|
1572
1790
|
*/
|
|
@@ -1587,36 +1805,38 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
1587
1805
|
* The visual performance value.
|
|
1588
1806
|
*/
|
|
1589
1807
|
visual = 0;
|
|
1808
|
+
finalMultiplier = 1.24;
|
|
1809
|
+
mode = osuBase.modes.droid;
|
|
1590
1810
|
tapPenalty = 1;
|
|
1591
|
-
calculate(params) {
|
|
1592
|
-
this.tapPenalty = params.tapPenalty ?? 1;
|
|
1593
|
-
return this.calculateInternal(params, osuBase.modes.droid);
|
|
1594
|
-
}
|
|
1595
1811
|
calculateValues() {
|
|
1596
1812
|
this.calculateAimValue();
|
|
1597
1813
|
this.calculateTapValue();
|
|
1598
1814
|
this.calculateAccuracyValue();
|
|
1599
1815
|
this.calculateFlashlightValue();
|
|
1600
1816
|
this.calculateVisualValue();
|
|
1601
|
-
// Apply tap penalty for penalized plays.
|
|
1602
|
-
this.tap /= this.tapPenalty;
|
|
1603
1817
|
}
|
|
1604
1818
|
calculateTotalValue() {
|
|
1605
|
-
|
|
1606
|
-
Math.pow(this.
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1819
|
+
this.total =
|
|
1820
|
+
Math.pow(Math.pow(this.aim, 1.1) +
|
|
1821
|
+
Math.pow(this.tap, 1.1) +
|
|
1822
|
+
Math.pow(this.accuracy, 1.1) +
|
|
1823
|
+
Math.pow(this.flashlight, 1.1) +
|
|
1824
|
+
Math.pow(this.visual, 1.1), 1 / 1.1) * this.finalMultiplier;
|
|
1825
|
+
}
|
|
1826
|
+
handleOptions(options) {
|
|
1827
|
+
this.tapPenalty = options?.tapPenalty ?? 1;
|
|
1828
|
+
super.handleOptions(options);
|
|
1610
1829
|
}
|
|
1611
1830
|
/**
|
|
1612
1831
|
* Calculates the aim performance value of the beatmap.
|
|
1613
1832
|
*/
|
|
1614
1833
|
calculateAimValue() {
|
|
1615
1834
|
// Global variables
|
|
1616
|
-
const objectCount = this.
|
|
1617
|
-
this.aim = this.baseValue(Math.pow(this.
|
|
1835
|
+
const objectCount = this.difficultyCalculator.objects.length;
|
|
1836
|
+
this.aim = this.baseValue(Math.pow(this.difficultyCalculator.aim, 0.8));
|
|
1618
1837
|
if (this.effectiveMissCount > 0) {
|
|
1619
|
-
// Penalize misses by assessing # of misses relative to the total # of objects.
|
|
1838
|
+
// Penalize misses by assessing # of misses relative to the total # of objects.
|
|
1839
|
+
// Default a 3% reduction for any # of misses.
|
|
1620
1840
|
this.aim *=
|
|
1621
1841
|
0.97 *
|
|
1622
1842
|
Math.pow(1 - Math.pow(this.effectiveMissCount / objectCount, 0.775), this.effectiveMissCount);
|
|
@@ -1637,10 +1857,11 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
1637
1857
|
*/
|
|
1638
1858
|
calculateTapValue() {
|
|
1639
1859
|
// Global variables
|
|
1640
|
-
const objectCount = this.
|
|
1641
|
-
this.tap = this.baseValue(this.
|
|
1860
|
+
const objectCount = this.difficultyCalculator.objects.length;
|
|
1861
|
+
this.tap = this.baseValue(this.difficultyCalculator.tap);
|
|
1642
1862
|
if (this.effectiveMissCount > 0) {
|
|
1643
|
-
// Penalize misses by assessing # of misses relative to the total # of objects.
|
|
1863
|
+
// Penalize misses by assessing # of misses relative to the total # of objects.
|
|
1864
|
+
// Default a 3% reduction for any # of misses.
|
|
1644
1865
|
this.tap *=
|
|
1645
1866
|
0.97 *
|
|
1646
1867
|
Math.pow(1 - Math.pow(this.effectiveMissCount / objectCount, 0.775), Math.pow(this.effectiveMissCount, 0.875));
|
|
@@ -1651,36 +1872,39 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
1651
1872
|
const countGreat = this.computedAccuracy.n300;
|
|
1652
1873
|
const countOk = this.computedAccuracy.n100;
|
|
1653
1874
|
const countMeh = this.computedAccuracy.n50;
|
|
1654
|
-
const relevantTotalDiff = objectCount - this.
|
|
1875
|
+
const relevantTotalDiff = objectCount - this.difficultyCalculator.attributes.speedNoteCount;
|
|
1655
1876
|
const relevantAccuracy = new osuBase.Accuracy({
|
|
1656
1877
|
n300: Math.max(0, countGreat - relevantTotalDiff),
|
|
1657
1878
|
n100: Math.max(0, countOk - Math.max(0, relevantTotalDiff - countGreat)),
|
|
1658
1879
|
n50: Math.max(0, countMeh - Math.max(0, relevantTotalDiff - countGreat - countOk)),
|
|
1659
1880
|
nmiss: this.effectiveMissCount,
|
|
1660
1881
|
});
|
|
1661
|
-
// Scale the
|
|
1882
|
+
// Scale the tap value with accuracy and OD.
|
|
1662
1883
|
const od = this.mapStatistics.od;
|
|
1663
1884
|
const odScaling = Math.pow(od, 2) / 750;
|
|
1664
1885
|
this.tap *=
|
|
1665
1886
|
(0.95 + (od > 0 ? odScaling : -odScaling)) *
|
|
1666
1887
|
Math.pow((this.computedAccuracy.value(objectCount) +
|
|
1667
|
-
relevantAccuracy.value(this.
|
|
1888
|
+
relevantAccuracy.value(this.difficultyCalculator.attributes.speedNoteCount)) /
|
|
1668
1889
|
2, (14 - Math.max(od, 2.5)) / 2);
|
|
1669
|
-
// Scale the
|
|
1890
|
+
// Scale the tap value with # of 50s to punish doubletapping.
|
|
1670
1891
|
this.tap *= Math.pow(0.98, Math.max(0, this.computedAccuracy.n50 - objectCount / 500));
|
|
1892
|
+
// Scale the tap value with three-fingered penalty.
|
|
1893
|
+
this.tap /= this.tapPenalty;
|
|
1671
1894
|
}
|
|
1672
1895
|
/**
|
|
1673
1896
|
* Calculates the accuracy performance value of the beatmap.
|
|
1674
1897
|
*/
|
|
1675
1898
|
calculateAccuracyValue() {
|
|
1676
|
-
if (this.
|
|
1899
|
+
if (this.difficultyCalculator.mods.some((m) => m instanceof osuBase.ModRelax)) {
|
|
1677
1900
|
return;
|
|
1678
1901
|
}
|
|
1679
1902
|
// Global variables
|
|
1680
|
-
const objectCount = this.
|
|
1681
|
-
const ncircles = this.
|
|
1682
|
-
? objectCount -
|
|
1683
|
-
|
|
1903
|
+
const objectCount = this.difficultyCalculator.objects.length;
|
|
1904
|
+
const ncircles = this.difficultyCalculator.mods.some((m) => m instanceof osuBase.ModScoreV2)
|
|
1905
|
+
? objectCount -
|
|
1906
|
+
this.difficultyCalculator.beatmap.hitObjects.spinners
|
|
1907
|
+
: this.difficultyCalculator.beatmap.hitObjects.circles;
|
|
1684
1908
|
if (ncircles === 0) {
|
|
1685
1909
|
return;
|
|
1686
1910
|
}
|
|
@@ -1697,11 +1921,12 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
1697
1921
|
// Bonus for many hitcircles - it's harder to keep good accuracy up for longer
|
|
1698
1922
|
this.accuracy *= Math.min(1.15, Math.pow(ncircles / 1000, 0.3));
|
|
1699
1923
|
// Scale the accuracy value with rhythm complexity.
|
|
1700
|
-
this.accuracy *=
|
|
1701
|
-
|
|
1924
|
+
this.accuracy *=
|
|
1925
|
+
1.5 / (1 + Math.exp(-(this.difficultyCalculator.rhythm - 1) / 2));
|
|
1926
|
+
if (this.difficultyCalculator.mods.some((m) => m instanceof osuBase.ModHidden)) {
|
|
1702
1927
|
this.accuracy *= 1.08;
|
|
1703
1928
|
}
|
|
1704
|
-
if (this.
|
|
1929
|
+
if (this.difficultyCalculator.mods.some((m) => m instanceof osuBase.ModFlashlight)) {
|
|
1705
1930
|
this.accuracy *= 1.02;
|
|
1706
1931
|
}
|
|
1707
1932
|
}
|
|
@@ -1709,17 +1934,14 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
1709
1934
|
* Calculates the flashlight performance value of the beatmap.
|
|
1710
1935
|
*/
|
|
1711
1936
|
calculateFlashlightValue() {
|
|
1712
|
-
if (!this.
|
|
1937
|
+
if (!this.difficultyCalculator.mods.some((m) => m instanceof osuBase.ModFlashlight)) {
|
|
1713
1938
|
return;
|
|
1714
1939
|
}
|
|
1715
1940
|
// Global variables
|
|
1716
|
-
const objectCount = this.
|
|
1941
|
+
const objectCount = this.difficultyCalculator.objects.length;
|
|
1717
1942
|
this.flashlight =
|
|
1718
|
-
Math.pow(Math.pow(this.
|
|
1719
|
-
|
|
1720
|
-
if (this.stars.mods.some((m) => m instanceof osuBase.ModHidden)) {
|
|
1721
|
-
this.flashlight *= 1.3;
|
|
1722
|
-
}
|
|
1943
|
+
Math.pow(Math.pow(this.difficultyCalculator.flashlight, 0.8), 2) *
|
|
1944
|
+
25;
|
|
1723
1945
|
// Combo scaling
|
|
1724
1946
|
this.flashlight *= this.comboPenalty;
|
|
1725
1947
|
if (this.effectiveMissCount > 0) {
|
|
@@ -1747,8 +1969,9 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
1747
1969
|
*/
|
|
1748
1970
|
calculateVisualValue() {
|
|
1749
1971
|
// Global variables
|
|
1750
|
-
const objectCount = this.
|
|
1751
|
-
this.visual =
|
|
1972
|
+
const objectCount = this.difficultyCalculator.objects.length;
|
|
1973
|
+
this.visual =
|
|
1974
|
+
Math.pow(Math.pow(this.difficultyCalculator.visual, 0.8), 2) * 25;
|
|
1752
1975
|
if (this.effectiveMissCount > 0) {
|
|
1753
1976
|
// Penalize misses by assessing # of misses relative to the total # of objects. Default a 3% reduction for any # of misses.
|
|
1754
1977
|
this.visual *=
|
|
@@ -1792,9 +2015,7 @@ class OsuSkill extends StrainSkill {
|
|
|
1792
2015
|
difficultyValue() {
|
|
1793
2016
|
const sortedStrains = this.strainPeaks
|
|
1794
2017
|
.slice()
|
|
1795
|
-
.sort((a, b) =>
|
|
1796
|
-
return b - a;
|
|
1797
|
-
});
|
|
2018
|
+
.sort((a, b) => b - a);
|
|
1798
2019
|
// We are reducing the highest strains first to account for extreme difficulty spikes.
|
|
1799
2020
|
for (let i = 0; i < Math.min(sortedStrains.length, this.reducedSectionCount); ++i) {
|
|
1800
2021
|
const scale = Math.log10(osuBase.Interpolation.lerp(1, 10, osuBase.MathUtils.clamp(i / this.reducedSectionCount, 0, 1)));
|
|
@@ -1802,9 +2023,7 @@ class OsuSkill extends StrainSkill {
|
|
|
1802
2023
|
}
|
|
1803
2024
|
// Difficulty is the weighted sum of the highest strains from every section.
|
|
1804
2025
|
// We're sorting from highest to lowest strain.
|
|
1805
|
-
sortedStrains.sort((a, b) =>
|
|
1806
|
-
return b - a;
|
|
1807
|
-
});
|
|
2026
|
+
sortedStrains.sort((a, b) => b - a);
|
|
1808
2027
|
let difficulty = 0;
|
|
1809
2028
|
let weight = 1;
|
|
1810
2029
|
for (const strain of sortedStrains) {
|
|
@@ -1820,39 +2039,32 @@ class OsuSkill extends StrainSkill {
|
|
|
1820
2039
|
}
|
|
1821
2040
|
|
|
1822
2041
|
/**
|
|
1823
|
-
*
|
|
2042
|
+
* An evaluator for calculating osu!standard Aim skill.
|
|
1824
2043
|
*/
|
|
1825
|
-
class
|
|
1826
|
-
skillMultiplier = 23.25;
|
|
1827
|
-
strainDecayBase = 0.15;
|
|
1828
|
-
reducedSectionCount = 10;
|
|
1829
|
-
reducedSectionBaseline = 0.75;
|
|
1830
|
-
difficultyMultiplier = 1.06;
|
|
1831
|
-
decayWeight = 0.9;
|
|
1832
|
-
wideAngleMultiplier = 1.5;
|
|
1833
|
-
acuteAngleMultiplier = 2;
|
|
1834
|
-
sliderMultiplier = 1.5;
|
|
1835
|
-
velocityChangeMultiplier = 0.75;
|
|
1836
|
-
withSliders;
|
|
1837
|
-
constructor(mods, withSliders) {
|
|
1838
|
-
super(mods);
|
|
1839
|
-
this.withSliders = withSliders;
|
|
1840
|
-
}
|
|
2044
|
+
class OsuAimEvaluator extends AimEvaluator {
|
|
1841
2045
|
/**
|
|
1842
|
-
*
|
|
2046
|
+
* Evaluates the difficulty of aiming the current object, based on:
|
|
2047
|
+
*
|
|
2048
|
+
* - cursor velocity to the current object,
|
|
2049
|
+
* - angle difficulty,
|
|
2050
|
+
* - sharp velocity increases,
|
|
2051
|
+
* - and slider difficulty.
|
|
2052
|
+
*
|
|
2053
|
+
* @param current The current object.
|
|
2054
|
+
* @param withSliders Whether to take slider difficulty into account.
|
|
1843
2055
|
*/
|
|
1844
|
-
|
|
2056
|
+
static evaluateDifficultyOf(current, withSliders) {
|
|
2057
|
+
const last = current.previous(0);
|
|
1845
2058
|
if (current.object instanceof osuBase.Spinner ||
|
|
1846
|
-
|
|
1847
|
-
|
|
2059
|
+
current.index <= 1 ||
|
|
2060
|
+
last?.object instanceof osuBase.Spinner) {
|
|
1848
2061
|
return 0;
|
|
1849
2062
|
}
|
|
1850
|
-
const
|
|
1851
|
-
const lastLast = this.previous[1];
|
|
2063
|
+
const lastLast = current.previous(1);
|
|
1852
2064
|
// Calculate the velocity to the current hitobject, which starts with a base distance / time assuming the last object is a hitcircle.
|
|
1853
2065
|
let currentVelocity = current.lazyJumpDistance / current.strainTime;
|
|
1854
2066
|
// But if the last object is a slider, then we extend the travel velocity through the slider into the current object.
|
|
1855
|
-
if (last.object instanceof osuBase.Slider &&
|
|
2067
|
+
if (last.object instanceof osuBase.Slider && withSliders) {
|
|
1856
2068
|
// Calculate the slider velocity from slider head to slider end.
|
|
1857
2069
|
const travelVelocity = last.travelDistance / last.travelTime;
|
|
1858
2070
|
// Calculate the movement velocity from slider end to current object.
|
|
@@ -1862,7 +2074,7 @@ class OsuAim extends OsuSkill {
|
|
|
1862
2074
|
}
|
|
1863
2075
|
// As above, do the same for the previous hitobject.
|
|
1864
2076
|
let prevVelocity = last.lazyJumpDistance / last.strainTime;
|
|
1865
|
-
if (lastLast.object instanceof osuBase.Slider &&
|
|
2077
|
+
if (lastLast.object instanceof osuBase.Slider && withSliders) {
|
|
1866
2078
|
const travelVelocity = lastLast.travelDistance / lastLast.travelTime;
|
|
1867
2079
|
const movementVelocity = last.minimumJumpDistance / last.minimumJumpTime;
|
|
1868
2080
|
prevVelocity = Math.max(prevVelocity, movementVelocity + travelVelocity);
|
|
@@ -1949,18 +2161,36 @@ class OsuAim extends OsuSkill {
|
|
|
1949
2161
|
strain += Math.max(acuteAngleBonus * this.acuteAngleMultiplier, wideAngleBonus * this.wideAngleMultiplier +
|
|
1950
2162
|
velocityChangeBonus * this.velocityChangeMultiplier);
|
|
1951
2163
|
// Add in additional slider velocity bonus.
|
|
1952
|
-
if (
|
|
2164
|
+
if (withSliders) {
|
|
1953
2165
|
strain += sliderBonus * this.sliderMultiplier;
|
|
1954
2166
|
}
|
|
1955
2167
|
return strain;
|
|
1956
2168
|
}
|
|
2169
|
+
}
|
|
2170
|
+
|
|
2171
|
+
/**
|
|
2172
|
+
* Represents the skill required to correctly aim at every object in the map with a uniform CircleSize and normalized distances.
|
|
2173
|
+
*/
|
|
2174
|
+
class OsuAim extends OsuSkill {
|
|
2175
|
+
skillMultiplier = 23.25;
|
|
2176
|
+
strainDecayBase = 0.15;
|
|
2177
|
+
reducedSectionCount = 10;
|
|
2178
|
+
reducedSectionBaseline = 0.75;
|
|
2179
|
+
difficultyMultiplier = 1.06;
|
|
2180
|
+
decayWeight = 0.9;
|
|
2181
|
+
withSliders;
|
|
2182
|
+
constructor(mods, withSliders) {
|
|
2183
|
+
super(mods);
|
|
2184
|
+
this.withSliders = withSliders;
|
|
2185
|
+
}
|
|
1957
2186
|
/**
|
|
1958
2187
|
* @param current The hitobject to calculate.
|
|
1959
2188
|
*/
|
|
1960
2189
|
strainValueAt(current) {
|
|
1961
2190
|
this.currentStrain *= this.strainDecay(current.deltaTime);
|
|
1962
2191
|
this.currentStrain +=
|
|
1963
|
-
|
|
2192
|
+
OsuAimEvaluator.evaluateDifficultyOf(current, this.withSliders) *
|
|
2193
|
+
this.skillMultiplier;
|
|
1964
2194
|
return this.currentStrain;
|
|
1965
2195
|
}
|
|
1966
2196
|
/**
|
|
@@ -1974,63 +2204,43 @@ class OsuAim extends OsuSkill {
|
|
|
1974
2204
|
current.aimStrainWithoutSliders = this.currentStrain;
|
|
1975
2205
|
}
|
|
1976
2206
|
}
|
|
1977
|
-
/**
|
|
1978
|
-
* Calculates the bonus of wide angles.
|
|
1979
|
-
*/
|
|
1980
|
-
calculateWideAngleBonus(angle) {
|
|
1981
|
-
return Math.pow(Math.sin((3 / 4) *
|
|
1982
|
-
(Math.min((5 / 6) * Math.PI, Math.max(Math.PI / 6, angle)) -
|
|
1983
|
-
Math.PI / 6)), 2);
|
|
1984
|
-
}
|
|
1985
|
-
/**
|
|
1986
|
-
* Calculates the bonus of acute angles.
|
|
1987
|
-
*/
|
|
1988
|
-
calculateAcuteAngleBonus(angle) {
|
|
1989
|
-
return 1 - this.calculateWideAngleBonus(angle);
|
|
1990
|
-
}
|
|
1991
2207
|
}
|
|
1992
2208
|
|
|
1993
2209
|
/**
|
|
1994
|
-
*
|
|
2210
|
+
* An evaluator for calculating osu!standard speed skill.
|
|
1995
2211
|
*/
|
|
1996
|
-
class
|
|
2212
|
+
class OsuSpeedEvaluator extends SpeedEvaluator {
|
|
1997
2213
|
/**
|
|
1998
2214
|
* Spacing threshold for a single hitobject spacing.
|
|
1999
2215
|
*/
|
|
2000
|
-
SINGLE_SPACING_THRESHOLD = 125;
|
|
2001
|
-
historyLength = 32;
|
|
2002
|
-
skillMultiplier = 1375;
|
|
2003
|
-
strainDecayBase = 0.3;
|
|
2004
|
-
reducedSectionCount = 5;
|
|
2005
|
-
reducedSectionBaseline = 0.75;
|
|
2006
|
-
difficultyMultiplier = 1.04;
|
|
2007
|
-
decayWeight = 0.9;
|
|
2008
|
-
rhythmMultiplier = 0.75;
|
|
2009
|
-
historyTimeMax = 5000; // 5 seconds of calculateRhythmBonus max.
|
|
2010
|
-
currentSpeedStrain = 0;
|
|
2011
|
-
currentRhythm = 0;
|
|
2012
|
-
// ~200 1/4 BPM streams
|
|
2013
|
-
minSpeedBonus = 75;
|
|
2014
|
-
greatWindow;
|
|
2015
|
-
constructor(mods, greatWindow) {
|
|
2016
|
-
super(mods);
|
|
2017
|
-
this.greatWindow = greatWindow;
|
|
2018
|
-
}
|
|
2216
|
+
static SINGLE_SPACING_THRESHOLD = 125;
|
|
2019
2217
|
/**
|
|
2020
|
-
*
|
|
2218
|
+
* Evaluates the difficulty of tapping the current object, based on:
|
|
2219
|
+
*
|
|
2220
|
+
* - time between pressing the previous and current object,
|
|
2221
|
+
* - distance between those objects,
|
|
2222
|
+
* - and how easily they can be cheesed.
|
|
2223
|
+
*
|
|
2224
|
+
* @param current The current object.
|
|
2225
|
+
* @param greatWindow The great hit window of the current object.
|
|
2021
2226
|
*/
|
|
2022
|
-
|
|
2227
|
+
static evaluateDifficultyOf(current, greatWindow) {
|
|
2023
2228
|
if (current.object instanceof osuBase.Spinner) {
|
|
2024
2229
|
return 0;
|
|
2025
2230
|
}
|
|
2231
|
+
const prev = current.previous(0);
|
|
2026
2232
|
let strainTime = current.strainTime;
|
|
2027
|
-
const greatWindowFull =
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2233
|
+
const greatWindowFull = greatWindow * 2;
|
|
2234
|
+
// Nerf doubletappable doubles.
|
|
2235
|
+
const next = current.next(0);
|
|
2236
|
+
let doubletapness = 1;
|
|
2237
|
+
if (next) {
|
|
2238
|
+
const currentDeltaTime = Math.max(1, current.deltaTime);
|
|
2239
|
+
const nextDeltaTime = Math.max(1, next.deltaTime);
|
|
2240
|
+
const deltaDifference = Math.abs(nextDeltaTime - currentDeltaTime);
|
|
2241
|
+
const speedRatio = currentDeltaTime / Math.max(currentDeltaTime, deltaDifference);
|
|
2242
|
+
const windowRatio = Math.pow(Math.min(1, currentDeltaTime / greatWindowFull), 2);
|
|
2243
|
+
doubletapness = Math.pow(speedRatio, 1 - windowRatio);
|
|
2034
2244
|
}
|
|
2035
2245
|
// Cap deltatime to the OD 300 hitwindow.
|
|
2036
2246
|
// 0.93 is derived from making sure 260 BPM 1/4 OD8 streams aren't nerfed harshly, whilst 0.92 limits the effect of the cap.
|
|
@@ -2040,27 +2250,29 @@ class OsuSpeed extends OsuSkill {
|
|
|
2040
2250
|
speedBonus +=
|
|
2041
2251
|
0.75 * Math.pow((this.minSpeedBonus - strainTime) / 40, 2);
|
|
2042
2252
|
}
|
|
2043
|
-
const travelDistance =
|
|
2253
|
+
const travelDistance = prev?.travelDistance ?? 0;
|
|
2044
2254
|
const distance = Math.min(this.SINGLE_SPACING_THRESHOLD, travelDistance + current.minimumJumpDistance);
|
|
2045
|
-
return ((speedBonus +
|
|
2255
|
+
return (((speedBonus +
|
|
2046
2256
|
speedBonus *
|
|
2047
|
-
Math.pow(distance / this.SINGLE_SPACING_THRESHOLD, 3.5))
|
|
2257
|
+
Math.pow(distance / this.SINGLE_SPACING_THRESHOLD, 3.5)) *
|
|
2258
|
+
doubletapness) /
|
|
2048
2259
|
strainTime);
|
|
2049
2260
|
}
|
|
2261
|
+
}
|
|
2262
|
+
|
|
2263
|
+
/**
|
|
2264
|
+
* An evaluator for calculating osu!standard Rhythm skill.
|
|
2265
|
+
*/
|
|
2266
|
+
class OsuRhythmEvaluator extends RhythmEvaluator {
|
|
2267
|
+
static rhythmMultiplier = 0.75;
|
|
2050
2268
|
/**
|
|
2051
|
-
*
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
this.strainValueOf(current) * this.skillMultiplier;
|
|
2057
|
-
this.currentRhythm = this.calculateRhythmBonus(current);
|
|
2058
|
-
return this.currentSpeedStrain * this.currentRhythm;
|
|
2059
|
-
}
|
|
2060
|
-
/**
|
|
2061
|
-
* Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current object.
|
|
2269
|
+
* Calculates a rhythm multiplier for the difficulty of the tap associated
|
|
2270
|
+
* with historic data of the current object.
|
|
2271
|
+
*
|
|
2272
|
+
* @param current The current object.
|
|
2273
|
+
* @param greatWindow The great hit window of the current object.
|
|
2062
2274
|
*/
|
|
2063
|
-
|
|
2275
|
+
static evaluateDifficultyOf(current, greatWindow) {
|
|
2064
2276
|
if (current.object instanceof osuBase.Spinner) {
|
|
2065
2277
|
return 0;
|
|
2066
2278
|
}
|
|
@@ -2070,29 +2282,33 @@ class OsuSpeed extends OsuSkill {
|
|
|
2070
2282
|
// Store the ratio of the current start of an island to buff for tighter rhythms.
|
|
2071
2283
|
let startRatio = 0;
|
|
2072
2284
|
let firstDeltaSwitch = false;
|
|
2285
|
+
const historicalNoteCount = Math.min(current.index, 32);
|
|
2073
2286
|
let rhythmStart = 0;
|
|
2074
|
-
while (rhythmStart <
|
|
2075
|
-
current.startTime -
|
|
2287
|
+
while (rhythmStart < historicalNoteCount - 2 &&
|
|
2288
|
+
current.startTime - current.previous(rhythmStart).startTime <
|
|
2076
2289
|
this.historyTimeMax) {
|
|
2077
2290
|
++rhythmStart;
|
|
2078
2291
|
}
|
|
2079
2292
|
for (let i = rhythmStart; i > 0; --i) {
|
|
2293
|
+
const currentObject = current.previous(i - 1);
|
|
2294
|
+
const prevObject = current.previous(i);
|
|
2295
|
+
const lastObject = current.previous(i + 1);
|
|
2080
2296
|
// Scale note 0 to 1 from history to now.
|
|
2081
2297
|
let currentHistoricalDecay = (this.historyTimeMax -
|
|
2082
|
-
(current.startTime -
|
|
2298
|
+
(current.startTime - currentObject.startTime)) /
|
|
2083
2299
|
this.historyTimeMax;
|
|
2084
2300
|
// Either we're limited by time or limited by object count.
|
|
2085
|
-
currentHistoricalDecay = Math.min(currentHistoricalDecay, (
|
|
2086
|
-
const currentDelta =
|
|
2087
|
-
const prevDelta =
|
|
2088
|
-
const lastDelta =
|
|
2301
|
+
currentHistoricalDecay = Math.min(currentHistoricalDecay, (historicalNoteCount - i) / historicalNoteCount);
|
|
2302
|
+
const currentDelta = currentObject.strainTime;
|
|
2303
|
+
const prevDelta = prevObject.strainTime;
|
|
2304
|
+
const lastDelta = lastObject.strainTime;
|
|
2089
2305
|
const currentRatio = 1 +
|
|
2090
2306
|
6 *
|
|
2091
2307
|
Math.min(0.5, Math.pow(Math.sin(Math.PI /
|
|
2092
2308
|
(Math.min(prevDelta, currentDelta) /
|
|
2093
2309
|
Math.max(prevDelta, currentDelta))), 2));
|
|
2094
|
-
const windowPenalty = Math.min(1, Math.max(0, Math.abs(prevDelta - currentDelta) -
|
|
2095
|
-
(
|
|
2310
|
+
const windowPenalty = Math.min(1, Math.max(0, Math.abs(prevDelta - currentDelta) - greatWindow * 0.6) /
|
|
2311
|
+
(greatWindow * 0.6));
|
|
2096
2312
|
let effectiveRatio = windowPenalty * currentRatio;
|
|
2097
2313
|
if (firstDeltaSwitch) {
|
|
2098
2314
|
if (prevDelta <= 1.25 * currentDelta &&
|
|
@@ -2103,11 +2319,11 @@ class OsuSpeed extends OsuSkill {
|
|
|
2103
2319
|
}
|
|
2104
2320
|
}
|
|
2105
2321
|
else {
|
|
2106
|
-
if (
|
|
2322
|
+
if (currentObject.object instanceof osuBase.Slider) {
|
|
2107
2323
|
// BPM change is into slider, this is easy acc window.
|
|
2108
2324
|
effectiveRatio /= 8;
|
|
2109
2325
|
}
|
|
2110
|
-
if (
|
|
2326
|
+
if (prevObject.object instanceof osuBase.Slider) {
|
|
2111
2327
|
// BPM change was from a slider, this is typically easier than circle -> circle.
|
|
2112
2328
|
effectiveRatio /= 4;
|
|
2113
2329
|
}
|
|
@@ -2152,6 +2368,38 @@ class OsuSpeed extends OsuSkill {
|
|
|
2152
2368
|
}
|
|
2153
2369
|
return Math.sqrt(4 + rhythmComplexitySum * this.rhythmMultiplier) / 2;
|
|
2154
2370
|
}
|
|
2371
|
+
}
|
|
2372
|
+
|
|
2373
|
+
/**
|
|
2374
|
+
* Represents the skill required to press keys or tap with regards to keeping up with the speed at which objects need to be hit.
|
|
2375
|
+
*/
|
|
2376
|
+
class OsuSpeed extends OsuSkill {
|
|
2377
|
+
skillMultiplier = 1375;
|
|
2378
|
+
strainDecayBase = 0.3;
|
|
2379
|
+
reducedSectionCount = 5;
|
|
2380
|
+
reducedSectionBaseline = 0.75;
|
|
2381
|
+
difficultyMultiplier = 1.04;
|
|
2382
|
+
decayWeight = 0.9;
|
|
2383
|
+
currentSpeedStrain = 0;
|
|
2384
|
+
currentRhythm = 0;
|
|
2385
|
+
// ~200 1/4 BPM streams
|
|
2386
|
+
minSpeedBonus = 75;
|
|
2387
|
+
greatWindow;
|
|
2388
|
+
constructor(mods, greatWindow) {
|
|
2389
|
+
super(mods);
|
|
2390
|
+
this.greatWindow = greatWindow;
|
|
2391
|
+
}
|
|
2392
|
+
/**
|
|
2393
|
+
* @param current The hitobject to calculate.
|
|
2394
|
+
*/
|
|
2395
|
+
strainValueAt(current) {
|
|
2396
|
+
this.currentSpeedStrain *= this.strainDecay(current.strainTime);
|
|
2397
|
+
this.currentSpeedStrain +=
|
|
2398
|
+
OsuSpeedEvaluator.evaluateDifficultyOf(current, this.greatWindow) *
|
|
2399
|
+
this.skillMultiplier;
|
|
2400
|
+
this.currentRhythm = OsuRhythmEvaluator.evaluateDifficultyOf(current, this.greatWindow);
|
|
2401
|
+
return this.currentSpeedStrain * this.currentRhythm;
|
|
2402
|
+
}
|
|
2155
2403
|
/**
|
|
2156
2404
|
* @param current The hitobject to save to.
|
|
2157
2405
|
*/
|
|
@@ -2162,17 +2410,20 @@ class OsuSpeed extends OsuSkill {
|
|
|
2162
2410
|
}
|
|
2163
2411
|
|
|
2164
2412
|
/**
|
|
2165
|
-
*
|
|
2413
|
+
* An evaluator for calculating osu!standard Flashlight skill.
|
|
2166
2414
|
*/
|
|
2167
|
-
class
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2415
|
+
class OsuFlashlightEvaluator extends FlashlightEvaluator {
|
|
2416
|
+
/**
|
|
2417
|
+
* Evaluates the difficulty of memorizing and hitting the current object, based on:
|
|
2418
|
+
*
|
|
2419
|
+
* - distance between the previous and the current object,
|
|
2420
|
+
* - the visual opacity of the current object,
|
|
2421
|
+
* - and whether Hidden mod is enabled.
|
|
2422
|
+
*
|
|
2423
|
+
* @param current The current object.
|
|
2424
|
+
* @param isHiddenMod Whether the Hidden mod is enabled.
|
|
2425
|
+
*/
|
|
2426
|
+
static evaluateDifficultyOf(current, isHiddenMod) {
|
|
2176
2427
|
if (current.object instanceof osuBase.Spinner) {
|
|
2177
2428
|
return 0;
|
|
2178
2429
|
}
|
|
@@ -2181,8 +2432,8 @@ class OsuFlashlight extends OsuSkill {
|
|
|
2181
2432
|
let cumulativeStrainTime = 0;
|
|
2182
2433
|
let result = 0;
|
|
2183
2434
|
let last = current;
|
|
2184
|
-
for (let i = 0; i <
|
|
2185
|
-
const currentObject =
|
|
2435
|
+
for (let i = 0; i < Math.min(current.index, 10); ++i) {
|
|
2436
|
+
const currentObject = current.previous(i);
|
|
2186
2437
|
if (!(currentObject.object instanceof osuBase.Spinner)) {
|
|
2187
2438
|
const jumpDistance = current.object.stackedPosition.subtract(currentObject.object.endPosition).length;
|
|
2188
2439
|
cumulativeStrainTime += last.strainTime;
|
|
@@ -2192,21 +2443,47 @@ class OsuFlashlight extends OsuSkill {
|
|
|
2192
2443
|
}
|
|
2193
2444
|
// We also want to nerf stacks so that only the first object of the stack is accounted for.
|
|
2194
2445
|
const stackNerf = Math.min(1, currentObject.lazyJumpDistance / scalingFactor / 25);
|
|
2446
|
+
// Bonus based on how visible the object is.
|
|
2447
|
+
const opacityBonus = 1 +
|
|
2448
|
+
this.maxOpacityBonus *
|
|
2449
|
+
(1.0 -
|
|
2450
|
+
current.opacityAt(currentObject.startTime, isHiddenMod));
|
|
2195
2451
|
result +=
|
|
2196
|
-
(stackNerf * scalingFactor * jumpDistance) /
|
|
2452
|
+
(stackNerf * opacityBonus * scalingFactor * jumpDistance) /
|
|
2197
2453
|
cumulativeStrainTime;
|
|
2198
2454
|
}
|
|
2199
2455
|
last = currentObject;
|
|
2200
2456
|
}
|
|
2457
|
+
// Additional bonus for Hidden due to there being no approach circles.
|
|
2458
|
+
if (isHiddenMod) {
|
|
2459
|
+
result *= 1 + this.hiddenBonus;
|
|
2460
|
+
}
|
|
2201
2461
|
return Math.pow(smallDistNerf * result, 2);
|
|
2202
2462
|
}
|
|
2463
|
+
}
|
|
2464
|
+
|
|
2465
|
+
/**
|
|
2466
|
+
* Represents the skill required to memorize and hit every object in a beatmap with the Flashlight mod enabled.
|
|
2467
|
+
*/
|
|
2468
|
+
class OsuFlashlight extends OsuSkill {
|
|
2469
|
+
skillMultiplier = 0.05;
|
|
2470
|
+
strainDecayBase = 0.15;
|
|
2471
|
+
reducedSectionCount = 10;
|
|
2472
|
+
reducedSectionBaseline = 0.75;
|
|
2473
|
+
difficultyMultiplier = 1.06;
|
|
2474
|
+
decayWeight = 1;
|
|
2475
|
+
isHidden;
|
|
2476
|
+
constructor(mods) {
|
|
2477
|
+
super(mods);
|
|
2478
|
+
this.isHidden = mods.some((m) => m instanceof osuBase.ModHidden);
|
|
2479
|
+
}
|
|
2203
2480
|
/**
|
|
2204
2481
|
* @param current The hitobject to calculate.
|
|
2205
2482
|
*/
|
|
2206
2483
|
strainValueAt(current) {
|
|
2207
2484
|
this.currentStrain *= this.strainDecay(current.deltaTime);
|
|
2208
2485
|
this.currentStrain +=
|
|
2209
|
-
|
|
2486
|
+
OsuFlashlightEvaluator.evaluateDifficultyOf(current, this.isHidden) * this.skillMultiplier;
|
|
2210
2487
|
return this.currentStrain;
|
|
2211
2488
|
}
|
|
2212
2489
|
saveToHitObject(current) {
|
|
@@ -2215,9 +2492,9 @@ class OsuFlashlight extends OsuSkill {
|
|
|
2215
2492
|
}
|
|
2216
2493
|
|
|
2217
2494
|
/**
|
|
2218
|
-
*
|
|
2495
|
+
* A difficulty calculator for osu!standard gamemode.
|
|
2219
2496
|
*/
|
|
2220
|
-
class
|
|
2497
|
+
class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
2221
2498
|
/**
|
|
2222
2499
|
* The aim star rating of the beatmap.
|
|
2223
2500
|
*/
|
|
@@ -2231,15 +2508,7 @@ class OsuStarRating extends StarRating {
|
|
|
2231
2508
|
*/
|
|
2232
2509
|
flashlight = 0;
|
|
2233
2510
|
difficultyMultiplier = 0.0675;
|
|
2234
|
-
|
|
2235
|
-
return super.calculate(params, osuBase.modes.osu);
|
|
2236
|
-
}
|
|
2237
|
-
/**
|
|
2238
|
-
* Generates difficulty hitobjects for this calculator.
|
|
2239
|
-
*/
|
|
2240
|
-
generateDifficultyHitObjects() {
|
|
2241
|
-
super.generateDifficultyHitObjects(osuBase.modes.osu);
|
|
2242
|
-
}
|
|
2511
|
+
mode = osuBase.modes.osu;
|
|
2243
2512
|
/**
|
|
2244
2513
|
* Calculates the aim star rating of the beatmap and stores it in this instance.
|
|
2245
2514
|
*/
|
|
@@ -2374,44 +2643,43 @@ class OsuStarRating extends StarRating {
|
|
|
2374
2643
|
}
|
|
2375
2644
|
|
|
2376
2645
|
/**
|
|
2377
|
-
* A
|
|
2646
|
+
* A difficulty calculator that calculates for both osu!droid and osu!standard gamemode.
|
|
2378
2647
|
*/
|
|
2379
2648
|
class MapStars {
|
|
2380
2649
|
/**
|
|
2381
|
-
* The osu!droid
|
|
2650
|
+
* The osu!droid difficulty calculator of the beatmap.
|
|
2382
2651
|
*/
|
|
2383
|
-
|
|
2652
|
+
droid;
|
|
2384
2653
|
/**
|
|
2385
|
-
* The osu!standard
|
|
2654
|
+
* The osu!standard difficulty calculator of the beatmap.
|
|
2386
2655
|
*/
|
|
2387
|
-
|
|
2656
|
+
osu;
|
|
2388
2657
|
/**
|
|
2389
|
-
*
|
|
2658
|
+
* Constructs this instance and calculates the given beatmap's osu!droid and osu!standard difficulty.
|
|
2659
|
+
*
|
|
2660
|
+
* @param beatmap The beatmap to calculate.
|
|
2661
|
+
* @param options Options for the difficulty calculation.
|
|
2390
2662
|
*/
|
|
2391
|
-
|
|
2392
|
-
const mod = params.mods ?? [];
|
|
2663
|
+
constructor(beatmap, options) {
|
|
2393
2664
|
const stats = new osuBase.MapStats({
|
|
2394
|
-
speedMultiplier:
|
|
2395
|
-
isForceAR:
|
|
2396
|
-
oldStatistics:
|
|
2665
|
+
speedMultiplier: options?.stats?.speedMultiplier ?? 1,
|
|
2666
|
+
isForceAR: options?.stats?.isForceAR ?? false,
|
|
2667
|
+
oldStatistics: options?.stats?.oldStatistics ?? false,
|
|
2397
2668
|
});
|
|
2398
|
-
this.
|
|
2399
|
-
|
|
2400
|
-
mods: mod,
|
|
2669
|
+
this.droid = new DroidDifficultyCalculator(beatmap).calculate({
|
|
2670
|
+
...options,
|
|
2401
2671
|
stats,
|
|
2402
2672
|
});
|
|
2403
|
-
this.
|
|
2404
|
-
|
|
2405
|
-
mods: mod,
|
|
2673
|
+
this.osu = new OsuDifficultyCalculator(beatmap).calculate({
|
|
2674
|
+
...options,
|
|
2406
2675
|
stats,
|
|
2407
2676
|
});
|
|
2408
|
-
return this;
|
|
2409
2677
|
}
|
|
2410
2678
|
/**
|
|
2411
2679
|
* Returns a string representative of the class.
|
|
2412
2680
|
*/
|
|
2413
2681
|
toString() {
|
|
2414
|
-
return `${this.
|
|
2682
|
+
return `${this.droid.toString()}\n${this.osu.toString()}`;
|
|
2415
2683
|
}
|
|
2416
2684
|
}
|
|
2417
2685
|
|
|
@@ -2419,8 +2687,6 @@ class MapStars {
|
|
|
2419
2687
|
* A performance points calculator that calculates performance points for osu!standard gamemode.
|
|
2420
2688
|
*/
|
|
2421
2689
|
class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
2422
|
-
stars = new OsuStarRating();
|
|
2423
|
-
finalMultiplier = 1.12;
|
|
2424
2690
|
/**
|
|
2425
2691
|
* The aim performance value.
|
|
2426
2692
|
*/
|
|
@@ -2437,9 +2703,8 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
2437
2703
|
* The flashlight performance value.
|
|
2438
2704
|
*/
|
|
2439
2705
|
flashlight = 0;
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
}
|
|
2706
|
+
finalMultiplier = 1.12;
|
|
2707
|
+
mode = osuBase.modes.osu;
|
|
2443
2708
|
calculateValues() {
|
|
2444
2709
|
this.calculateAimValue();
|
|
2445
2710
|
this.calculateSpeedValue();
|
|
@@ -2447,19 +2712,20 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
2447
2712
|
this.calculateFlashlightValue();
|
|
2448
2713
|
}
|
|
2449
2714
|
calculateTotalValue() {
|
|
2450
|
-
|
|
2451
|
-
Math.pow(this.
|
|
2452
|
-
|
|
2453
|
-
|
|
2715
|
+
this.total =
|
|
2716
|
+
Math.pow(Math.pow(this.aim, 1.1) +
|
|
2717
|
+
Math.pow(this.speed, 1.1) +
|
|
2718
|
+
Math.pow(this.accuracy, 1.1) +
|
|
2719
|
+
Math.pow(this.flashlight, 1.1), 1 / 1.1) * this.finalMultiplier;
|
|
2454
2720
|
}
|
|
2455
2721
|
/**
|
|
2456
2722
|
* Calculates the aim performance value of the beatmap.
|
|
2457
2723
|
*/
|
|
2458
2724
|
calculateAimValue() {
|
|
2459
2725
|
// Global variables
|
|
2460
|
-
const objectCount = this.
|
|
2726
|
+
const objectCount = this.difficultyCalculator.objects.length;
|
|
2461
2727
|
const calculatedAR = this.mapStatistics.ar;
|
|
2462
|
-
this.aim = this.baseValue(Math.pow(this.
|
|
2728
|
+
this.aim = this.baseValue(Math.pow(this.difficultyCalculator.aim, this.difficultyCalculator.mods.some((m) => m instanceof osuBase.ModTouchDevice)
|
|
2463
2729
|
? 0.8
|
|
2464
2730
|
: 1));
|
|
2465
2731
|
// Longer maps are worth more
|
|
@@ -2469,7 +2735,8 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
2469
2735
|
}
|
|
2470
2736
|
this.aim *= lengthBonus;
|
|
2471
2737
|
if (this.effectiveMissCount > 0) {
|
|
2472
|
-
// Penalize misses by assessing # of misses relative to the total # of objects.
|
|
2738
|
+
// Penalize misses by assessing # of misses relative to the total # of objects.
|
|
2739
|
+
// Default a 3% reduction for any # of misses.
|
|
2473
2740
|
this.aim *=
|
|
2474
2741
|
0.97 *
|
|
2475
2742
|
Math.pow(1 - Math.pow(this.effectiveMissCount / objectCount, 0.775), this.effectiveMissCount);
|
|
@@ -2487,7 +2754,7 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
2487
2754
|
// Buff for longer maps with high AR.
|
|
2488
2755
|
this.aim *= 1 + arFactor * lengthBonus;
|
|
2489
2756
|
// We want to give more reward for lower AR when it comes to aim and HD. This nerfs high AR and buffs lower AR.
|
|
2490
|
-
if (this.
|
|
2757
|
+
if (this.difficultyCalculator.mods.some((m) => m instanceof osuBase.ModHidden)) {
|
|
2491
2758
|
this.aim *= 1 + 0.04 * (12 - calculatedAR);
|
|
2492
2759
|
}
|
|
2493
2760
|
// Scale the aim value with slider factor to nerf very likely dropped sliderends.
|
|
@@ -2503,10 +2770,10 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
2503
2770
|
*/
|
|
2504
2771
|
calculateSpeedValue() {
|
|
2505
2772
|
// Global variables
|
|
2506
|
-
const objectCount = this.
|
|
2773
|
+
const objectCount = this.difficultyCalculator.objects.length;
|
|
2507
2774
|
const calculatedAR = this.mapStatistics.ar;
|
|
2508
2775
|
const n50 = this.computedAccuracy.n50;
|
|
2509
|
-
this.speed = this.baseValue(this.
|
|
2776
|
+
this.speed = this.baseValue(this.difficultyCalculator.speed);
|
|
2510
2777
|
// Longer maps are worth more
|
|
2511
2778
|
let lengthBonus = 0.95 + 0.4 * Math.min(1, objectCount / 2000);
|
|
2512
2779
|
if (objectCount > 2000) {
|
|
@@ -2514,7 +2781,8 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
2514
2781
|
}
|
|
2515
2782
|
this.speed *= lengthBonus;
|
|
2516
2783
|
if (this.effectiveMissCount > 0) {
|
|
2517
|
-
// Penalize misses by assessing # of misses relative to the total # of objects.
|
|
2784
|
+
// Penalize misses by assessing # of misses relative to the total # of objects.
|
|
2785
|
+
// Default a 3% reduction for any # of misses.
|
|
2518
2786
|
this.speed *=
|
|
2519
2787
|
0.97 *
|
|
2520
2788
|
Math.pow(1 - Math.pow(this.effectiveMissCount / objectCount, 0.775), Math.pow(this.effectiveMissCount, 0.875));
|
|
@@ -2526,7 +2794,7 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
2526
2794
|
// Buff for longer maps with high AR.
|
|
2527
2795
|
this.speed *= 1 + 0.3 * (calculatedAR - 10.33) * lengthBonus;
|
|
2528
2796
|
}
|
|
2529
|
-
if (this.
|
|
2797
|
+
if (this.difficultyCalculator.mods.some((m) => m instanceof osuBase.ModHidden)) {
|
|
2530
2798
|
this.speed *= 1 + 0.04 * (12 - calculatedAR);
|
|
2531
2799
|
}
|
|
2532
2800
|
// Scale the speed value with accuracy and OD.
|
|
@@ -2540,21 +2808,21 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
2540
2808
|
* Calculates the accuracy performance value of the beatmap.
|
|
2541
2809
|
*/
|
|
2542
2810
|
calculateAccuracyValue() {
|
|
2543
|
-
if (this.
|
|
2811
|
+
if (this.difficultyCalculator.mods.some((m) => m instanceof osuBase.ModRelax)) {
|
|
2544
2812
|
return;
|
|
2545
2813
|
}
|
|
2546
2814
|
// Global variables
|
|
2547
|
-
const nobjects = this.
|
|
2548
|
-
const ncircles = this.
|
|
2549
|
-
? nobjects - this.
|
|
2550
|
-
: this.
|
|
2815
|
+
const nobjects = this.difficultyCalculator.objects.length;
|
|
2816
|
+
const ncircles = this.difficultyCalculator.mods.some((m) => m instanceof osuBase.ModScoreV2)
|
|
2817
|
+
? nobjects - this.difficultyCalculator.beatmap.hitObjects.spinners
|
|
2818
|
+
: this.difficultyCalculator.beatmap.hitObjects.circles;
|
|
2551
2819
|
if (ncircles === 0) {
|
|
2552
2820
|
return;
|
|
2553
2821
|
}
|
|
2554
2822
|
const realAccuracy = new osuBase.Accuracy({
|
|
2555
2823
|
...this.computedAccuracy,
|
|
2556
2824
|
n300: this.computedAccuracy.n300 -
|
|
2557
|
-
(this.
|
|
2825
|
+
(this.difficultyCalculator.objects.length - ncircles),
|
|
2558
2826
|
});
|
|
2559
2827
|
// Lots of arbitrary values from testing.
|
|
2560
2828
|
// Considering to use derivation from perfect accuracy in a probabilistic manner - assume normal distribution
|
|
@@ -2564,10 +2832,10 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
2564
2832
|
2.83;
|
|
2565
2833
|
// Bonus for many hitcircles - it's harder to keep good accuracy up for longer
|
|
2566
2834
|
this.accuracy *= Math.min(1.15, Math.pow(ncircles / 1000, 0.3));
|
|
2567
|
-
if (this.
|
|
2835
|
+
if (this.difficultyCalculator.mods.some((m) => m instanceof osuBase.ModHidden)) {
|
|
2568
2836
|
this.accuracy *= 1.08;
|
|
2569
2837
|
}
|
|
2570
|
-
if (this.
|
|
2838
|
+
if (this.difficultyCalculator.mods.some((m) => m instanceof osuBase.ModFlashlight)) {
|
|
2571
2839
|
this.accuracy *= 1.02;
|
|
2572
2840
|
}
|
|
2573
2841
|
}
|
|
@@ -2575,19 +2843,15 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
2575
2843
|
* Calculates the flashlight performance value of the beatmap.
|
|
2576
2844
|
*/
|
|
2577
2845
|
calculateFlashlightValue() {
|
|
2578
|
-
if (!this.
|
|
2846
|
+
if (!this.difficultyCalculator.mods.some((m) => m instanceof osuBase.ModFlashlight)) {
|
|
2579
2847
|
return;
|
|
2580
2848
|
}
|
|
2581
2849
|
// Global variables
|
|
2582
|
-
const objectCount = this.
|
|
2850
|
+
const objectCount = this.difficultyCalculator.objects.length;
|
|
2583
2851
|
this.flashlight =
|
|
2584
|
-
Math.pow(Math.pow(this.
|
|
2852
|
+
Math.pow(Math.pow(this.difficultyCalculator.flashlight, this.difficultyCalculator.mods.some((m) => m instanceof osuBase.ModTouchDevice)
|
|
2585
2853
|
? 0.8
|
|
2586
2854
|
: 1), 2) * 25;
|
|
2587
|
-
// Add an additional bonus for HDFL.
|
|
2588
|
-
if (this.stars.mods.some((m) => m instanceof osuBase.ModHidden)) {
|
|
2589
|
-
this.flashlight *= 1.3;
|
|
2590
|
-
}
|
|
2591
2855
|
// Combo scaling
|
|
2592
2856
|
this.flashlight *= this.comboPenalty;
|
|
2593
2857
|
if (this.effectiveMissCount > 0) {
|
|
@@ -2623,21 +2887,34 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
2623
2887
|
}
|
|
2624
2888
|
}
|
|
2625
2889
|
|
|
2890
|
+
exports.AimEvaluator = AimEvaluator;
|
|
2891
|
+
exports.DifficultyCalculator = DifficultyCalculator;
|
|
2626
2892
|
exports.DifficultyHitObject = DifficultyHitObject;
|
|
2627
2893
|
exports.DifficultyHitObjectCreator = DifficultyHitObjectCreator;
|
|
2628
2894
|
exports.DroidAim = DroidAim;
|
|
2895
|
+
exports.DroidAimEvaluator = DroidAimEvaluator;
|
|
2896
|
+
exports.DroidDifficultyCalculator = DroidDifficultyCalculator;
|
|
2629
2897
|
exports.DroidFlashlight = DroidFlashlight;
|
|
2898
|
+
exports.DroidFlashlightEvaluator = DroidFlashlightEvaluator;
|
|
2630
2899
|
exports.DroidPerformanceCalculator = DroidPerformanceCalculator;
|
|
2631
2900
|
exports.DroidRhythm = DroidRhythm;
|
|
2632
|
-
exports.
|
|
2901
|
+
exports.DroidRhythmEvaluator = DroidRhythmEvaluator;
|
|
2633
2902
|
exports.DroidTap = DroidTap;
|
|
2903
|
+
exports.DroidTapEvaluator = DroidTapEvaluator;
|
|
2634
2904
|
exports.DroidVisual = DroidVisual;
|
|
2905
|
+
exports.DroidVisualEvaluator = DroidVisualEvaluator;
|
|
2906
|
+
exports.FlashlightEvaluator = FlashlightEvaluator;
|
|
2635
2907
|
exports.MapStars = MapStars;
|
|
2636
2908
|
exports.OsuAim = OsuAim;
|
|
2909
|
+
exports.OsuAimEvaluator = OsuAimEvaluator;
|
|
2910
|
+
exports.OsuDifficultyCalculator = OsuDifficultyCalculator;
|
|
2637
2911
|
exports.OsuFlashlight = OsuFlashlight;
|
|
2912
|
+
exports.OsuFlashlightEvaluator = OsuFlashlightEvaluator;
|
|
2638
2913
|
exports.OsuPerformanceCalculator = OsuPerformanceCalculator;
|
|
2914
|
+
exports.OsuRhythmEvaluator = OsuRhythmEvaluator;
|
|
2639
2915
|
exports.OsuSpeed = OsuSpeed;
|
|
2640
|
-
exports.
|
|
2916
|
+
exports.OsuSpeedEvaluator = OsuSpeedEvaluator;
|
|
2641
2917
|
exports.PerformanceCalculator = PerformanceCalculator;
|
|
2642
|
-
exports.
|
|
2918
|
+
exports.RhythmEvaluator = RhythmEvaluator;
|
|
2919
|
+
exports.SpeedEvaluator = SpeedEvaluator;
|
|
2643
2920
|
//# sourceMappingURL=index.js.map
|