@rian8337/osu-rebalance-difficulty-calculator 4.0.0-beta.42 → 4.0.0-beta.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +333 -310
- package/package.json +3 -3
- package/typings/index.d.ts +30 -20
package/dist/index.js
CHANGED
|
@@ -27,6 +27,7 @@ AimEvaluator.wideAngleMultiplier = 1.5;
|
|
|
27
27
|
AimEvaluator.acuteAngleMultiplier = 1.95;
|
|
28
28
|
AimEvaluator.sliderMultiplier = 1.35;
|
|
29
29
|
AimEvaluator.velocityChangeMultiplier = 0.75;
|
|
30
|
+
AimEvaluator.wiggleMultiplier = 1.02;
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* The base of a difficulty calculator.
|
|
@@ -175,6 +176,12 @@ class DifficultyCalculator {
|
|
|
175
176
|
* Represents a hit object with difficulty calculation values.
|
|
176
177
|
*/
|
|
177
178
|
class DifficultyHitObject {
|
|
179
|
+
/**
|
|
180
|
+
* The normalized diameter of the hitobject.
|
|
181
|
+
*/
|
|
182
|
+
static get normalizedDiameter() {
|
|
183
|
+
return this.normalizedRadius * 2;
|
|
184
|
+
}
|
|
178
185
|
/**
|
|
179
186
|
* Note: You **must** call `computeProperties` at some point due to how TypeScript handles
|
|
180
187
|
* overridden properties (see [this](https://github.com/microsoft/TypeScript/issues/1617) GitHub issue).
|
|
@@ -236,9 +243,8 @@ class DifficultyHitObject {
|
|
|
236
243
|
* Calculated as the angle between the circles (current-2, current-1, current).
|
|
237
244
|
*/
|
|
238
245
|
this.angle = null;
|
|
239
|
-
this.
|
|
240
|
-
this.
|
|
241
|
-
this.assumedSliderRadius = this.normalizedRadius * 1.8;
|
|
246
|
+
this.maximumSliderRadius = DifficultyHitObject.normalizedRadius * 2.4;
|
|
247
|
+
this.assumedSliderRadius = DifficultyHitObject.normalizedRadius * 1.8;
|
|
242
248
|
this.object = object;
|
|
243
249
|
this.lastObject = lastObject;
|
|
244
250
|
this.lastLastObject = lastLastObject;
|
|
@@ -442,7 +448,7 @@ class DifficultyHitObject {
|
|
|
442
448
|
.getStackedPosition(this.mode)
|
|
443
449
|
.add(slider.path.positionAt(endTimeMin));
|
|
444
450
|
let currentCursorPosition = slider.getStackedPosition(this.mode);
|
|
445
|
-
const scalingFactor =
|
|
451
|
+
const scalingFactor = DifficultyHitObject.normalizedRadius / slider.radius;
|
|
446
452
|
for (let i = 1; i < slider.nestedHitObjects.length; ++i) {
|
|
447
453
|
const currentMovementObject = slider.nestedHitObjects[i];
|
|
448
454
|
let currentMovement = currentMovementObject
|
|
@@ -464,7 +470,7 @@ class DifficultyHitObject {
|
|
|
464
470
|
}
|
|
465
471
|
else if (currentMovementObject instanceof osuBase.SliderRepeat) {
|
|
466
472
|
// For a slider repeat, assume a tighter movement threshold to better assess repeat sliders.
|
|
467
|
-
requiredMovement =
|
|
473
|
+
requiredMovement = DifficultyHitObject.normalizedRadius;
|
|
468
474
|
}
|
|
469
475
|
if (currentMovementLength > requiredMovement) {
|
|
470
476
|
// This finds the positional delta from the required radius and the current position,
|
|
@@ -491,11 +497,211 @@ class DifficultyHitObject {
|
|
|
491
497
|
return pos;
|
|
492
498
|
}
|
|
493
499
|
}
|
|
500
|
+
/**
|
|
501
|
+
* The normalized radius of the hitobject.
|
|
502
|
+
*/
|
|
503
|
+
DifficultyHitObject.normalizedRadius = 50;
|
|
494
504
|
/**
|
|
495
505
|
* The lowest possible delta time value.
|
|
496
506
|
*/
|
|
497
507
|
DifficultyHitObject.minDeltaTime = 25;
|
|
498
508
|
|
|
509
|
+
/**
|
|
510
|
+
* Represents an osu!droid hit object with difficulty calculation values.
|
|
511
|
+
*/
|
|
512
|
+
class DroidDifficultyHitObject extends DifficultyHitObject {
|
|
513
|
+
get scalingFactor() {
|
|
514
|
+
const radius = this.object.radius;
|
|
515
|
+
// We will scale distances by this factor, so we can assume a uniform CircleSize among beatmaps.
|
|
516
|
+
let scalingFactor = DifficultyHitObject.normalizedRadius / radius;
|
|
517
|
+
// High circle size (small CS) bonus
|
|
518
|
+
if (radius < this.radiusBuffThreshold) {
|
|
519
|
+
scalingFactor *=
|
|
520
|
+
1 + Math.pow((this.radiusBuffThreshold - radius) / 50, 2);
|
|
521
|
+
}
|
|
522
|
+
return scalingFactor;
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Note: You **must** call `computeProperties` at some point due to how TypeScript handles
|
|
526
|
+
* overridden properties (see [this](https://github.com/microsoft/TypeScript/issues/1617) GitHub issue).
|
|
527
|
+
*
|
|
528
|
+
* @param object The underlying hitobject.
|
|
529
|
+
* @param lastObject The hitobject before this hitobject.
|
|
530
|
+
* @param lastLastObject The hitobject before the last hitobject.
|
|
531
|
+
* @param difficultyHitObjects All difficulty hitobjects in the processed beatmap.
|
|
532
|
+
* @param clockRate The clock rate of the beatmap.
|
|
533
|
+
*/
|
|
534
|
+
constructor(object, lastObject, lastLastObject, difficultyHitObjects, clockRate) {
|
|
535
|
+
super(object, lastObject, lastLastObject, difficultyHitObjects, clockRate);
|
|
536
|
+
/**
|
|
537
|
+
* The tap strain generated by the hitobject.
|
|
538
|
+
*/
|
|
539
|
+
this.tapStrain = 0;
|
|
540
|
+
/**
|
|
541
|
+
* The tap strain generated by the hitobject if `strainTime` isn't modified by
|
|
542
|
+
* OD. This is used in three-finger detection.
|
|
543
|
+
*/
|
|
544
|
+
this.originalTapStrain = 0;
|
|
545
|
+
/**
|
|
546
|
+
* The rhythm strain generated by the hitobject.
|
|
547
|
+
*/
|
|
548
|
+
this.rhythmStrain = 0;
|
|
549
|
+
/**
|
|
550
|
+
* The flashlight strain generated by the hitobject if sliders are considered.
|
|
551
|
+
*/
|
|
552
|
+
this.flashlightStrainWithSliders = 0;
|
|
553
|
+
/**
|
|
554
|
+
* The flashlight strain generated by the hitobject if sliders are not considered.
|
|
555
|
+
*/
|
|
556
|
+
this.flashlightStrainWithoutSliders = 0;
|
|
557
|
+
/**
|
|
558
|
+
* The visual strain generated by the hitobject if sliders are considered.
|
|
559
|
+
*/
|
|
560
|
+
this.visualStrainWithSliders = 0;
|
|
561
|
+
/**
|
|
562
|
+
* The visual strain generated by the hitobject if sliders are not considered.
|
|
563
|
+
*/
|
|
564
|
+
this.visualStrainWithoutSliders = 0;
|
|
565
|
+
/**
|
|
566
|
+
* The note density of the hitobject.
|
|
567
|
+
*/
|
|
568
|
+
this.noteDensity = 1;
|
|
569
|
+
/**
|
|
570
|
+
* The overlapping factor of the hitobject.
|
|
571
|
+
*
|
|
572
|
+
* This is used to scale visual skill.
|
|
573
|
+
*/
|
|
574
|
+
this.overlappingFactor = 0;
|
|
575
|
+
this.radiusBuffThreshold = 70;
|
|
576
|
+
this.mode = osuBase.Modes.droid;
|
|
577
|
+
this.maximumSliderRadius = DifficultyHitObject.normalizedRadius * 2;
|
|
578
|
+
this.timePreempt = object.timePreempt / clockRate;
|
|
579
|
+
}
|
|
580
|
+
computeProperties(clockRate, hitObjects) {
|
|
581
|
+
super.computeProperties(clockRate, hitObjects);
|
|
582
|
+
this.setVisuals(clockRate, hitObjects);
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Determines whether this hitobject is considered overlapping with the hitobject before it.
|
|
586
|
+
*
|
|
587
|
+
* Keep in mind that "overlapping" in this case is overlapping to the point where both hitobjects
|
|
588
|
+
* can be hit with just a single tap in osu!droid.
|
|
589
|
+
*
|
|
590
|
+
* In the case of sliders, it is considered overlapping if all nested hitobjects can be hit with
|
|
591
|
+
* one aim motion.
|
|
592
|
+
*
|
|
593
|
+
* @param considerDistance Whether to consider the distance between both hitobjects.
|
|
594
|
+
* @returns Whether the hitobject is considered overlapping.
|
|
595
|
+
*/
|
|
596
|
+
isOverlapping(considerDistance) {
|
|
597
|
+
if (this.object instanceof osuBase.Spinner) {
|
|
598
|
+
return false;
|
|
599
|
+
}
|
|
600
|
+
const prev = this.previous(0);
|
|
601
|
+
if (!prev || prev.object instanceof osuBase.Spinner) {
|
|
602
|
+
return false;
|
|
603
|
+
}
|
|
604
|
+
if (this.object.startTime !== prev.object.startTime) {
|
|
605
|
+
return false;
|
|
606
|
+
}
|
|
607
|
+
if (!considerDistance) {
|
|
608
|
+
return true;
|
|
609
|
+
}
|
|
610
|
+
const distanceThreshold = 2 * this.object.radius;
|
|
611
|
+
const startPosition = this.object.getStackedPosition(osuBase.Modes.droid);
|
|
612
|
+
const prevStartPosition = prev.object.getStackedPosition(osuBase.Modes.droid);
|
|
613
|
+
// We need to consider two cases:
|
|
614
|
+
//
|
|
615
|
+
// Case 1: Current object is a circle, or previous object is a circle.
|
|
616
|
+
// In this case, we only need to check if their positions are close enough to be tapped together.
|
|
617
|
+
//
|
|
618
|
+
// Case 2: Both objects are sliders.
|
|
619
|
+
// In this case, we need to check if all nested hitobjects can be hit together.
|
|
620
|
+
// To start with, check if the starting positions can be tapped together.
|
|
621
|
+
if (startPosition.getDistance(prevStartPosition) > distanceThreshold) {
|
|
622
|
+
return false;
|
|
623
|
+
}
|
|
624
|
+
if (this.object instanceof osuBase.Circle || prev.object instanceof osuBase.Circle) {
|
|
625
|
+
return true;
|
|
626
|
+
}
|
|
627
|
+
// Check if all nested hitobjects can be hit together.
|
|
628
|
+
for (let i = 1; i < this.object.nestedHitObjects.length; ++i) {
|
|
629
|
+
const position = this.object.nestedHitObjects[i].getStackedPosition(osuBase.Modes.droid);
|
|
630
|
+
const prevPosition = prevStartPosition.add(prev.object.curvePositionAt(i / (this.object.nestedHitObjects.length - 1)));
|
|
631
|
+
if (position.getDistance(prevPosition) > distanceThreshold) {
|
|
632
|
+
return false;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
// Do the same for the previous slider as well.
|
|
636
|
+
for (let i = 1; i < prev.object.nestedHitObjects.length; ++i) {
|
|
637
|
+
const prevPosition = prev.object.nestedHitObjects[i].getStackedPosition(osuBase.Modes.droid);
|
|
638
|
+
const position = startPosition.add(this.object.curvePositionAt(i / (prev.object.nestedHitObjects.length - 1)));
|
|
639
|
+
if (prevPosition.getDistance(position) > distanceThreshold) {
|
|
640
|
+
return false;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
return true;
|
|
644
|
+
}
|
|
645
|
+
setVisuals(clockRate, hitObjects) {
|
|
646
|
+
// We'll have two visible object arrays. The first array contains objects before the current object starts in a reversed order,
|
|
647
|
+
// while the second array contains objects after the current object ends.
|
|
648
|
+
// For overlapping factor, we also need to consider previous visible objects.
|
|
649
|
+
const prevVisibleObjects = [];
|
|
650
|
+
const nextVisibleObjects = [];
|
|
651
|
+
for (let j = this.index + 2; j < hitObjects.length; ++j) {
|
|
652
|
+
const o = hitObjects[j];
|
|
653
|
+
if (o instanceof osuBase.Spinner) {
|
|
654
|
+
continue;
|
|
655
|
+
}
|
|
656
|
+
if (o.startTime / clockRate > this.endTime + this.timePreempt) {
|
|
657
|
+
break;
|
|
658
|
+
}
|
|
659
|
+
nextVisibleObjects.push(o);
|
|
660
|
+
}
|
|
661
|
+
for (let j = 0; j < this.index; ++j) {
|
|
662
|
+
const prev = this.previous(j);
|
|
663
|
+
if (prev.object instanceof osuBase.Spinner) {
|
|
664
|
+
continue;
|
|
665
|
+
}
|
|
666
|
+
if (prev.startTime >= this.startTime) {
|
|
667
|
+
continue;
|
|
668
|
+
}
|
|
669
|
+
if (prev.startTime < this.startTime - this.timePreempt) {
|
|
670
|
+
break;
|
|
671
|
+
}
|
|
672
|
+
prevVisibleObjects.push(prev.object);
|
|
673
|
+
}
|
|
674
|
+
for (const hitObject of prevVisibleObjects) {
|
|
675
|
+
const distance = this.object
|
|
676
|
+
.getStackedPosition(this.mode)
|
|
677
|
+
.getDistance(hitObject.getStackedEndPosition(this.mode));
|
|
678
|
+
const deltaTime = this.startTime - hitObject.endTime / clockRate;
|
|
679
|
+
this.applyToOverlappingFactor(distance, deltaTime);
|
|
680
|
+
}
|
|
681
|
+
for (const hitObject of nextVisibleObjects) {
|
|
682
|
+
const distance = hitObject
|
|
683
|
+
.getStackedPosition(this.mode)
|
|
684
|
+
.getDistance(this.object.getStackedEndPosition(this.mode));
|
|
685
|
+
const deltaTime = hitObject.startTime / clockRate - this.endTime;
|
|
686
|
+
if (deltaTime >= 0) {
|
|
687
|
+
this.noteDensity += 1 - deltaTime / this.timePreempt;
|
|
688
|
+
}
|
|
689
|
+
this.applyToOverlappingFactor(distance, deltaTime);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
applyToOverlappingFactor(distance, deltaTime) {
|
|
693
|
+
// Penalize objects that are too close to the object in both distance
|
|
694
|
+
// and delta time to prevent stream maps from being overweighted.
|
|
695
|
+
this.overlappingFactor +=
|
|
696
|
+
Math.max(0, 1 - distance / (2.5 * this.object.radius)) *
|
|
697
|
+
(7.5 /
|
|
698
|
+
(1 +
|
|
699
|
+
Math.exp(0.15 *
|
|
700
|
+
(Math.max(deltaTime, DifficultyHitObject.minDeltaTime) -
|
|
701
|
+
75))));
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
|
|
499
705
|
/**
|
|
500
706
|
* An evaluator for calculating osu!droid Aim skill.
|
|
501
707
|
*/
|
|
@@ -531,6 +737,8 @@ class DroidAimEvaluator extends AimEvaluator {
|
|
|
531
737
|
}
|
|
532
738
|
const last = current.previous(0);
|
|
533
739
|
const lastLast = current.previous(1);
|
|
740
|
+
const radius = DroidDifficultyHitObject.normalizedRadius;
|
|
741
|
+
const diameter = DroidDifficultyHitObject.normalizedDiameter;
|
|
534
742
|
// Calculate the velocity to the current hitobject, which starts with a base distance / time assuming the last object is a hitcircle.
|
|
535
743
|
let currentVelocity = current.lazyJumpDistance / current.strainTime;
|
|
536
744
|
// But if the last object is a slider, then we extend the travel velocity through the slider into the current object.
|
|
@@ -557,6 +765,7 @@ class DroidAimEvaluator extends AimEvaluator {
|
|
|
557
765
|
let acuteAngleBonus = 0;
|
|
558
766
|
let sliderBonus = 0;
|
|
559
767
|
let velocityChangeBonus = 0;
|
|
768
|
+
let wiggleBonus = 0;
|
|
560
769
|
// Start strain with regular velocity.
|
|
561
770
|
let strain = currentVelocity;
|
|
562
771
|
if (
|
|
@@ -566,40 +775,40 @@ class DroidAimEvaluator extends AimEvaluator {
|
|
|
566
775
|
current.angle !== null &&
|
|
567
776
|
last.angle !== null &&
|
|
568
777
|
lastLast.angle !== null) {
|
|
778
|
+
const currentAngle = current.angle;
|
|
779
|
+
const lastAngle = last.angle;
|
|
569
780
|
// Rewarding angles, take the smaller velocity as base.
|
|
570
781
|
const angleBonus = Math.min(currentVelocity, prevVelocity);
|
|
571
782
|
wideAngleBonus = this.calculateWideAngleBonus(current.angle);
|
|
572
783
|
acuteAngleBonus = this.calculateAcuteAngleBonus(current.angle);
|
|
573
|
-
//
|
|
574
|
-
if (current.strainTime > 100) {
|
|
575
|
-
acuteAngleBonus = 0;
|
|
576
|
-
}
|
|
577
|
-
else {
|
|
578
|
-
acuteAngleBonus *=
|
|
579
|
-
// Multiply by previous angle, we don't want to buff unless this is a wiggle type pattern.
|
|
580
|
-
this.calculateAcuteAngleBonus(last.angle) *
|
|
581
|
-
// The maximum velocity we buff is equal to 125 / strainTime.
|
|
582
|
-
Math.min(angleBonus, 125 / current.strainTime) *
|
|
583
|
-
// Scale buff from 300 BPM 1/2 to 400 BPM 1/2.
|
|
584
|
-
Math.pow(Math.sin((Math.PI / 2) *
|
|
585
|
-
Math.min(1, (100 - current.strainTime) / 25)), 2) *
|
|
586
|
-
// Buff distance exceeding 50 (radius) up to 100 (diameter).
|
|
587
|
-
Math.pow(Math.sin(((Math.PI / 2) *
|
|
588
|
-
(osuBase.MathUtils.clamp(current.lazyJumpDistance, 50, 100) -
|
|
589
|
-
50)) /
|
|
590
|
-
50), 2);
|
|
591
|
-
}
|
|
592
|
-
// Penalize wide angles if they're repeated, reducing the penalty as last.angle gets more acute.
|
|
784
|
+
// Penalize angle repetition.
|
|
593
785
|
wideAngleBonus *=
|
|
594
|
-
|
|
595
|
-
(
|
|
596
|
-
Math.min(wideAngleBonus, Math.pow(this.calculateWideAngleBonus(last.angle), 3)));
|
|
597
|
-
// Penalize acute angles if they're repeated, reducing the penalty as lastLast.angle gets more obtuse.
|
|
786
|
+
1 -
|
|
787
|
+
Math.min(wideAngleBonus, Math.pow(this.calculateWideAngleBonus(lastAngle), 3));
|
|
598
788
|
acuteAngleBonus *=
|
|
599
|
-
0.
|
|
600
|
-
0.
|
|
789
|
+
0.08 +
|
|
790
|
+
0.92 *
|
|
601
791
|
(1 -
|
|
602
|
-
Math.min(acuteAngleBonus, Math.pow(this.calculateAcuteAngleBonus(
|
|
792
|
+
Math.min(acuteAngleBonus, Math.pow(this.calculateAcuteAngleBonus(lastAngle), 3)));
|
|
793
|
+
// Apply full wide angle bonus for distance more than one diameter
|
|
794
|
+
wideAngleBonus *=
|
|
795
|
+
angleBonus *
|
|
796
|
+
osuBase.MathUtils.smootherstep(current.lazyJumpDistance, 0, diameter);
|
|
797
|
+
// Apply acute angle bonus for BPM above 300 1/2 and distance more than one diameter
|
|
798
|
+
acuteAngleBonus *=
|
|
799
|
+
angleBonus *
|
|
800
|
+
osuBase.MathUtils.smootherstep(osuBase.MathUtils.millisecondsToBPM(current.strainTime, 2), 300, 400) *
|
|
801
|
+
osuBase.MathUtils.smootherstep(current.lazyJumpDistance, diameter, diameter * 2);
|
|
802
|
+
// Apply wiggle bonus for jumps that are [radius, 3*diameter] in distance, with < 110 angle
|
|
803
|
+
// https://www.desmos.com/calculator/dp0v0nvowc
|
|
804
|
+
wiggleBonus =
|
|
805
|
+
angleBonus *
|
|
806
|
+
osuBase.MathUtils.smootherstep(current.lazyJumpDistance, radius, diameter) *
|
|
807
|
+
Math.pow(osuBase.MathUtils.reverseLerp(current.lazyJumpDistance, diameter * 3, diameter), 1.8) *
|
|
808
|
+
osuBase.MathUtils.smootherstep(currentAngle, osuBase.MathUtils.degreesToRadians(110), osuBase.MathUtils.degreesToRadians(60)) *
|
|
809
|
+
osuBase.MathUtils.smootherstep(current.lazyJumpDistance, radius, diameter) *
|
|
810
|
+
Math.pow(osuBase.MathUtils.reverseLerp(current.lazyJumpDistance, diameter * 3, diameter), 1.8) *
|
|
811
|
+
osuBase.MathUtils.smootherstep(lastAngle, osuBase.MathUtils.degreesToRadians(110), osuBase.MathUtils.degreesToRadians(60));
|
|
603
812
|
}
|
|
604
813
|
if (Math.max(prevVelocity, currentVelocity)) {
|
|
605
814
|
// We want to use the average velocity over the whole object when awarding differences, not the individual jump and slider path velocities.
|
|
@@ -631,6 +840,7 @@ class DroidAimEvaluator extends AimEvaluator {
|
|
|
631
840
|
strain *= 0.5 * (1 + Math.sqrt(flowBonus));
|
|
632
841
|
wideAngleBonus *= 0.5 * (1 + Math.sqrt(flowBonus));
|
|
633
842
|
}
|
|
843
|
+
strain += wiggleBonus * this.wiggleMultiplier;
|
|
634
844
|
// Add in acute angle bonus or wide angle bonus + velocity change bonus, whichever is larger.
|
|
635
845
|
strain += Math.max(acuteAngleBonus * this.acuteAngleMultiplier, wideAngleBonus * this.wideAngleMultiplier +
|
|
636
846
|
velocityChangeBonus * this.velocityChangeMultiplier);
|
|
@@ -657,27 +867,20 @@ class DroidAimEvaluator extends AimEvaluator {
|
|
|
657
867
|
const travelDistance = (_a = prev === null || prev === void 0 ? void 0 : prev.travelDistance) !== null && _a !== void 0 ? _a : 0;
|
|
658
868
|
const distance = travelDistance + current.minimumJumpDistance;
|
|
659
869
|
const shortDistancePenalty = Math.min(1, Math.pow(distance / this.singleSpacingThreshold, 3.5));
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
const angleDiff = Math.abs(current.angle - prev.angle);
|
|
668
|
-
const adjustedAngleDiff = Math.sin(angleDiff / 2) * 180;
|
|
669
|
-
const angularVelocity = adjustedAngleDiff / (0.1 + current.strainTime);
|
|
670
|
-
const angularVelocityBonus = Math.max(0, Math.pow(angularVelocity, 0.4) - 1);
|
|
671
|
-
adjustedDistanceScale = 0.65 + angularVelocityBonus * 0.45;
|
|
672
|
-
}
|
|
673
|
-
return ((200 * speedBonus * shortDistancePenalty * adjustedDistanceScale) /
|
|
674
|
-
current.strainTime);
|
|
870
|
+
return (200 * speedBonus * shortDistancePenalty) / current.strainTime;
|
|
871
|
+
}
|
|
872
|
+
static calculateWideAngleBonus(angle) {
|
|
873
|
+
return osuBase.MathUtils.smoothstep(angle, osuBase.MathUtils.degreesToRadians(40), osuBase.MathUtils.degreesToRadians(140));
|
|
874
|
+
}
|
|
875
|
+
static calculateAcuteAngleBonus(angle) {
|
|
876
|
+
return osuBase.MathUtils.smoothstep(angle, osuBase.MathUtils.degreesToRadians(140), osuBase.MathUtils.degreesToRadians(40));
|
|
675
877
|
}
|
|
676
878
|
}
|
|
677
|
-
DroidAimEvaluator.wideAngleMultiplier = 1.
|
|
678
|
-
DroidAimEvaluator.
|
|
679
|
-
DroidAimEvaluator.
|
|
680
|
-
DroidAimEvaluator.
|
|
879
|
+
DroidAimEvaluator.wideAngleMultiplier = 1.5;
|
|
880
|
+
DroidAimEvaluator.acuteAngleMultiplier = 2.6;
|
|
881
|
+
DroidAimEvaluator.sliderMultiplier = 1.35;
|
|
882
|
+
DroidAimEvaluator.velocityChangeMultiplier = 0.75;
|
|
883
|
+
DroidAimEvaluator.singleSpacingThreshold = DroidDifficultyHitObject.normalizedDiameter;
|
|
681
884
|
// 200 1/4 BPM delta time
|
|
682
885
|
DroidAimEvaluator.minSpeedBonus = 75;
|
|
683
886
|
|
|
@@ -790,41 +993,6 @@ class StrainSkill extends Skill {
|
|
|
790
993
|
* and to calculate a final difficulty value representing the difficulty of hitting all the processed objects.
|
|
791
994
|
*/
|
|
792
995
|
class DroidSkill extends StrainSkill {
|
|
793
|
-
constructor() {
|
|
794
|
-
super(...arguments);
|
|
795
|
-
/**
|
|
796
|
-
* The minimum number of strains to judge when computing for retryability.
|
|
797
|
-
*/
|
|
798
|
-
this.minimumRetryabilityStrains = 500;
|
|
799
|
-
}
|
|
800
|
-
/**
|
|
801
|
-
* Computes the retryability of the beatmap based on the strains of the hitobjects.
|
|
802
|
-
*
|
|
803
|
-
* Earlier difficult strains indicate higher retryability.
|
|
804
|
-
*
|
|
805
|
-
* The result is scaled by clock rate as it affects the total number of strains.
|
|
806
|
-
*
|
|
807
|
-
* @returns A number between 0 and 1. A higher value indicates higher retryability.
|
|
808
|
-
*/
|
|
809
|
-
countRetryability() {
|
|
810
|
-
if (this._objectStrains.length === 0) {
|
|
811
|
-
return 0;
|
|
812
|
-
}
|
|
813
|
-
const maxStrain = Math.max(...this._objectStrains);
|
|
814
|
-
if (maxStrain === 0) {
|
|
815
|
-
return 0;
|
|
816
|
-
}
|
|
817
|
-
let weightedStrainSum = 0;
|
|
818
|
-
for (let i = 0; i < this._objectStrains.length; ++i) {
|
|
819
|
-
const strainRatio = this._objectStrains[i] / maxStrain;
|
|
820
|
-
// Give more weight to earlier strains.
|
|
821
|
-
const strainPositionWeight = 1 - Math.pow(i / this._objectStrains.length, 0.75) / 10;
|
|
822
|
-
weightedStrainSum += strainRatio * strainPositionWeight;
|
|
823
|
-
}
|
|
824
|
-
return (1 -
|
|
825
|
-
weightedStrainSum /
|
|
826
|
-
Math.max(this._objectStrains.length, this.minimumRetryabilityStrains));
|
|
827
|
-
}
|
|
828
996
|
process(current) {
|
|
829
997
|
super.process(current);
|
|
830
998
|
this._objectStrains.push(this.getObjectStrain(current));
|
|
@@ -863,15 +1031,34 @@ class DroidAim extends DroidSkill {
|
|
|
863
1031
|
this.reducedSectionCount = 10;
|
|
864
1032
|
this.reducedSectionBaseline = 0.75;
|
|
865
1033
|
this.starsPerDouble = 1.05;
|
|
866
|
-
this.skillMultiplier =
|
|
1034
|
+
this.skillMultiplier = 25.6;
|
|
867
1035
|
this.currentAimStrain = 0;
|
|
1036
|
+
this.sliderStrains = [];
|
|
868
1037
|
this.withSliders = withSliders;
|
|
869
1038
|
}
|
|
1039
|
+
/**
|
|
1040
|
+
* Obtains the amount of sliders that are considered difficult in terms of relative strain.
|
|
1041
|
+
*/
|
|
1042
|
+
countDifficultSliders() {
|
|
1043
|
+
if (this.sliderStrains.length === 0) {
|
|
1044
|
+
return 0;
|
|
1045
|
+
}
|
|
1046
|
+
const sortedStrains = this.sliderStrains.sort((a, b) => b - a);
|
|
1047
|
+
const maxSliderStrain = sortedStrains[0];
|
|
1048
|
+
if (maxSliderStrain === 0) {
|
|
1049
|
+
return 0;
|
|
1050
|
+
}
|
|
1051
|
+
return sortedStrains.reduce((total, strain) => total +
|
|
1052
|
+
1 / (1 + Math.exp(-((strain / maxSliderStrain) * 12 - 6))), 0);
|
|
1053
|
+
}
|
|
870
1054
|
strainValueAt(current) {
|
|
871
1055
|
this.currentAimStrain *= this.strainDecay(current.deltaTime);
|
|
872
1056
|
this.currentAimStrain +=
|
|
873
1057
|
DroidAimEvaluator.evaluateDifficultyOf(current, this.withSliders) *
|
|
874
1058
|
this.skillMultiplier;
|
|
1059
|
+
if (current.object instanceof osuBase.Slider) {
|
|
1060
|
+
this.sliderStrains.push(this.currentAimStrain);
|
|
1061
|
+
}
|
|
875
1062
|
return this.currentAimStrain;
|
|
876
1063
|
}
|
|
877
1064
|
calculateInitialStrain(time, current) {
|
|
@@ -940,7 +1127,7 @@ class DroidTapEvaluator extends SpeedEvaluator {
|
|
|
940
1127
|
0.75 *
|
|
941
1128
|
Math.pow(osuBase.ErrorFunction.erf((this.minSpeedBonus - strainTime) / 40), 2);
|
|
942
1129
|
}
|
|
943
|
-
return (speedBonus * Math.pow(doubletapness, 1.5)) / strainTime;
|
|
1130
|
+
return (speedBonus * Math.pow(doubletapness, 1.5) * 1000) / strainTime;
|
|
944
1131
|
}
|
|
945
1132
|
}
|
|
946
1133
|
|
|
@@ -960,10 +1147,9 @@ class DroidTap extends DroidSkill {
|
|
|
960
1147
|
this.reducedSectionBaseline = 0.75;
|
|
961
1148
|
this.strainDecayBase = 0.3;
|
|
962
1149
|
this.starsPerDouble = 1.1;
|
|
963
|
-
this.minimumRetryabilityStrains = 750;
|
|
964
1150
|
this.currentTapStrain = 0;
|
|
965
1151
|
this.currentRhythmMultiplier = 0;
|
|
966
|
-
this.skillMultiplier =
|
|
1152
|
+
this.skillMultiplier = 1.375;
|
|
967
1153
|
this._objectDeltaTimes = [];
|
|
968
1154
|
this.considerCheesability = considerCheesability;
|
|
969
1155
|
this.strainTimeCap = strainTimeCap;
|
|
@@ -1078,13 +1264,13 @@ class DroidFlashlightEvaluator extends FlashlightEvaluator {
|
|
|
1078
1264
|
let angleRepeatCount = 0;
|
|
1079
1265
|
for (let i = 0; i < Math.min(current.index, 10); ++i) {
|
|
1080
1266
|
const currentObject = current.previous(i);
|
|
1267
|
+
cumulativeStrainTime += last.strainTime;
|
|
1081
1268
|
if (!(currentObject.object instanceof osuBase.Spinner) &&
|
|
1082
1269
|
// Exclude overlapping objects that can be tapped at once.
|
|
1083
1270
|
!currentObject.isOverlapping(false)) {
|
|
1084
1271
|
const jumpDistance = current.object
|
|
1085
1272
|
.getStackedPosition(osuBase.Modes.droid)
|
|
1086
1273
|
.subtract(currentObject.object.getStackedEndPosition(osuBase.Modes.droid)).length;
|
|
1087
|
-
cumulativeStrainTime += last.strainTime;
|
|
1088
1274
|
// We want to nerf objects that can be easily seen within the Flashlight circle radius.
|
|
1089
1275
|
if (i === 0) {
|
|
1090
1276
|
smallDistNerf = Math.min(1, jumpDistance / 75);
|
|
@@ -1317,7 +1503,7 @@ class DroidRhythmEvaluator {
|
|
|
1317
1503
|
}
|
|
1318
1504
|
// Repeated island (ex: triplet -> triplet).
|
|
1319
1505
|
// Graph: https://www.desmos.com/calculator/pj7an56zwf
|
|
1320
|
-
effectiveRatio *= Math.min(3 / islandCount, Math.pow(1 / islandCount,
|
|
1506
|
+
effectiveRatio *= Math.min(3 / islandCount, Math.pow(1 / islandCount, osuBase.MathUtils.offsetLogistic(island.delta, 58.33, 0.24, 2.75)));
|
|
1321
1507
|
break;
|
|
1322
1508
|
}
|
|
1323
1509
|
if (!islandFound) {
|
|
@@ -1540,202 +1726,6 @@ class DroidVisual extends DroidSkill {
|
|
|
1540
1726
|
}
|
|
1541
1727
|
}
|
|
1542
1728
|
|
|
1543
|
-
/**
|
|
1544
|
-
* Represents an osu!droid hit object with difficulty calculation values.
|
|
1545
|
-
*/
|
|
1546
|
-
class DroidDifficultyHitObject extends DifficultyHitObject {
|
|
1547
|
-
get scalingFactor() {
|
|
1548
|
-
const radius = this.object.radius;
|
|
1549
|
-
// We will scale distances by this factor, so we can assume a uniform CircleSize among beatmaps.
|
|
1550
|
-
let scalingFactor = this.normalizedRadius / radius;
|
|
1551
|
-
// High circle size (small CS) bonus
|
|
1552
|
-
if (radius < this.radiusBuffThreshold) {
|
|
1553
|
-
scalingFactor *=
|
|
1554
|
-
1 + Math.pow((this.radiusBuffThreshold - radius) / 50, 2);
|
|
1555
|
-
}
|
|
1556
|
-
return scalingFactor;
|
|
1557
|
-
}
|
|
1558
|
-
/**
|
|
1559
|
-
* Note: You **must** call `computeProperties` at some point due to how TypeScript handles
|
|
1560
|
-
* overridden properties (see [this](https://github.com/microsoft/TypeScript/issues/1617) GitHub issue).
|
|
1561
|
-
*
|
|
1562
|
-
* @param object The underlying hitobject.
|
|
1563
|
-
* @param lastObject The hitobject before this hitobject.
|
|
1564
|
-
* @param lastLastObject The hitobject before the last hitobject.
|
|
1565
|
-
* @param difficultyHitObjects All difficulty hitobjects in the processed beatmap.
|
|
1566
|
-
* @param clockRate The clock rate of the beatmap.
|
|
1567
|
-
*/
|
|
1568
|
-
constructor(object, lastObject, lastLastObject, difficultyHitObjects, clockRate) {
|
|
1569
|
-
super(object, lastObject, lastLastObject, difficultyHitObjects, clockRate);
|
|
1570
|
-
/**
|
|
1571
|
-
* The tap strain generated by the hitobject.
|
|
1572
|
-
*/
|
|
1573
|
-
this.tapStrain = 0;
|
|
1574
|
-
/**
|
|
1575
|
-
* The tap strain generated by the hitobject if `strainTime` isn't modified by
|
|
1576
|
-
* OD. This is used in three-finger detection.
|
|
1577
|
-
*/
|
|
1578
|
-
this.originalTapStrain = 0;
|
|
1579
|
-
/**
|
|
1580
|
-
* The rhythm strain generated by the hitobject.
|
|
1581
|
-
*/
|
|
1582
|
-
this.rhythmStrain = 0;
|
|
1583
|
-
/**
|
|
1584
|
-
* The flashlight strain generated by the hitobject if sliders are considered.
|
|
1585
|
-
*/
|
|
1586
|
-
this.flashlightStrainWithSliders = 0;
|
|
1587
|
-
/**
|
|
1588
|
-
* The flashlight strain generated by the hitobject if sliders are not considered.
|
|
1589
|
-
*/
|
|
1590
|
-
this.flashlightStrainWithoutSliders = 0;
|
|
1591
|
-
/**
|
|
1592
|
-
* The visual strain generated by the hitobject if sliders are considered.
|
|
1593
|
-
*/
|
|
1594
|
-
this.visualStrainWithSliders = 0;
|
|
1595
|
-
/**
|
|
1596
|
-
* The visual strain generated by the hitobject if sliders are not considered.
|
|
1597
|
-
*/
|
|
1598
|
-
this.visualStrainWithoutSliders = 0;
|
|
1599
|
-
/**
|
|
1600
|
-
* The note density of the hitobject.
|
|
1601
|
-
*/
|
|
1602
|
-
this.noteDensity = 1;
|
|
1603
|
-
/**
|
|
1604
|
-
* The overlapping factor of the hitobject.
|
|
1605
|
-
*
|
|
1606
|
-
* This is used to scale visual skill.
|
|
1607
|
-
*/
|
|
1608
|
-
this.overlappingFactor = 0;
|
|
1609
|
-
this.radiusBuffThreshold = 70;
|
|
1610
|
-
this.mode = osuBase.Modes.droid;
|
|
1611
|
-
this.maximumSliderRadius = this.normalizedRadius * 2;
|
|
1612
|
-
this.timePreempt = object.timePreempt / clockRate;
|
|
1613
|
-
}
|
|
1614
|
-
computeProperties(clockRate, hitObjects) {
|
|
1615
|
-
super.computeProperties(clockRate, hitObjects);
|
|
1616
|
-
this.setVisuals(clockRate, hitObjects);
|
|
1617
|
-
}
|
|
1618
|
-
/**
|
|
1619
|
-
* Determines whether this hitobject is considered overlapping with the hitobject before it.
|
|
1620
|
-
*
|
|
1621
|
-
* Keep in mind that "overlapping" in this case is overlapping to the point where both hitobjects
|
|
1622
|
-
* can be hit with just a single tap in osu!droid.
|
|
1623
|
-
*
|
|
1624
|
-
* In the case of sliders, it is considered overlapping if all nested hitobjects can be hit with
|
|
1625
|
-
* one aim motion.
|
|
1626
|
-
*
|
|
1627
|
-
* @param considerDistance Whether to consider the distance between both hitobjects.
|
|
1628
|
-
* @returns Whether the hitobject is considered overlapping.
|
|
1629
|
-
*/
|
|
1630
|
-
isOverlapping(considerDistance) {
|
|
1631
|
-
if (this.object instanceof osuBase.Spinner) {
|
|
1632
|
-
return false;
|
|
1633
|
-
}
|
|
1634
|
-
const prev = this.previous(0);
|
|
1635
|
-
if (!prev || prev.object instanceof osuBase.Spinner) {
|
|
1636
|
-
return false;
|
|
1637
|
-
}
|
|
1638
|
-
if (this.object.startTime !== prev.object.startTime) {
|
|
1639
|
-
return false;
|
|
1640
|
-
}
|
|
1641
|
-
if (!considerDistance) {
|
|
1642
|
-
return true;
|
|
1643
|
-
}
|
|
1644
|
-
const distanceThreshold = 2 * this.object.radius;
|
|
1645
|
-
const startPosition = this.object.getStackedPosition(osuBase.Modes.droid);
|
|
1646
|
-
const prevStartPosition = prev.object.getStackedPosition(osuBase.Modes.droid);
|
|
1647
|
-
// We need to consider two cases:
|
|
1648
|
-
//
|
|
1649
|
-
// Case 1: Current object is a circle, or previous object is a circle.
|
|
1650
|
-
// In this case, we only need to check if their positions are close enough to be tapped together.
|
|
1651
|
-
//
|
|
1652
|
-
// Case 2: Both objects are sliders.
|
|
1653
|
-
// In this case, we need to check if all nested hitobjects can be hit together.
|
|
1654
|
-
// To start with, check if the starting positions can be tapped together.
|
|
1655
|
-
if (startPosition.getDistance(prevStartPosition) > distanceThreshold) {
|
|
1656
|
-
return false;
|
|
1657
|
-
}
|
|
1658
|
-
if (this.object instanceof osuBase.Circle || prev.object instanceof osuBase.Circle) {
|
|
1659
|
-
return true;
|
|
1660
|
-
}
|
|
1661
|
-
// Check if all nested hitobjects can be hit together.
|
|
1662
|
-
for (let i = 1; i < this.object.nestedHitObjects.length; ++i) {
|
|
1663
|
-
const position = this.object.nestedHitObjects[i].getStackedPosition(osuBase.Modes.droid);
|
|
1664
|
-
const prevPosition = prevStartPosition.add(prev.object.curvePositionAt(i / (this.object.nestedHitObjects.length - 1)));
|
|
1665
|
-
if (position.getDistance(prevPosition) > distanceThreshold) {
|
|
1666
|
-
return false;
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
// Do the same for the previous slider as well.
|
|
1670
|
-
for (let i = 1; i < prev.object.nestedHitObjects.length; ++i) {
|
|
1671
|
-
const prevPosition = prev.object.nestedHitObjects[i].getStackedPosition(osuBase.Modes.droid);
|
|
1672
|
-
const position = startPosition.add(this.object.curvePositionAt(i / (prev.object.nestedHitObjects.length - 1)));
|
|
1673
|
-
if (prevPosition.getDistance(position) > distanceThreshold) {
|
|
1674
|
-
return false;
|
|
1675
|
-
}
|
|
1676
|
-
}
|
|
1677
|
-
return true;
|
|
1678
|
-
}
|
|
1679
|
-
setVisuals(clockRate, hitObjects) {
|
|
1680
|
-
// We'll have two visible object arrays. The first array contains objects before the current object starts in a reversed order,
|
|
1681
|
-
// while the second array contains objects after the current object ends.
|
|
1682
|
-
// For overlapping factor, we also need to consider previous visible objects.
|
|
1683
|
-
const prevVisibleObjects = [];
|
|
1684
|
-
const nextVisibleObjects = [];
|
|
1685
|
-
for (let j = this.index + 2; j < hitObjects.length; ++j) {
|
|
1686
|
-
const o = hitObjects[j];
|
|
1687
|
-
if (o instanceof osuBase.Spinner) {
|
|
1688
|
-
continue;
|
|
1689
|
-
}
|
|
1690
|
-
if (o.startTime / clockRate > this.endTime + this.timePreempt) {
|
|
1691
|
-
break;
|
|
1692
|
-
}
|
|
1693
|
-
nextVisibleObjects.push(o);
|
|
1694
|
-
}
|
|
1695
|
-
for (let j = 0; j < this.index; ++j) {
|
|
1696
|
-
const prev = this.previous(j);
|
|
1697
|
-
if (prev.object instanceof osuBase.Spinner) {
|
|
1698
|
-
continue;
|
|
1699
|
-
}
|
|
1700
|
-
if (prev.startTime >= this.startTime) {
|
|
1701
|
-
continue;
|
|
1702
|
-
}
|
|
1703
|
-
if (prev.startTime < this.startTime - this.timePreempt) {
|
|
1704
|
-
break;
|
|
1705
|
-
}
|
|
1706
|
-
prevVisibleObjects.push(prev.object);
|
|
1707
|
-
}
|
|
1708
|
-
for (const hitObject of prevVisibleObjects) {
|
|
1709
|
-
const distance = this.object
|
|
1710
|
-
.getStackedPosition(this.mode)
|
|
1711
|
-
.getDistance(hitObject.getStackedEndPosition(this.mode));
|
|
1712
|
-
const deltaTime = this.startTime - hitObject.endTime / clockRate;
|
|
1713
|
-
this.applyToOverlappingFactor(distance, deltaTime);
|
|
1714
|
-
}
|
|
1715
|
-
for (const hitObject of nextVisibleObjects) {
|
|
1716
|
-
const distance = hitObject
|
|
1717
|
-
.getStackedPosition(this.mode)
|
|
1718
|
-
.getDistance(this.object.getStackedEndPosition(this.mode));
|
|
1719
|
-
const deltaTime = hitObject.startTime / clockRate - this.endTime;
|
|
1720
|
-
if (deltaTime >= 0) {
|
|
1721
|
-
this.noteDensity += 1 - deltaTime / this.timePreempt;
|
|
1722
|
-
}
|
|
1723
|
-
this.applyToOverlappingFactor(distance, deltaTime);
|
|
1724
|
-
}
|
|
1725
|
-
}
|
|
1726
|
-
applyToOverlappingFactor(distance, deltaTime) {
|
|
1727
|
-
// Penalize objects that are too close to the object in both distance
|
|
1728
|
-
// and delta time to prevent stream maps from being overweighted.
|
|
1729
|
-
this.overlappingFactor +=
|
|
1730
|
-
Math.max(0, 1 - distance / (2.5 * this.object.radius)) *
|
|
1731
|
-
(7.5 /
|
|
1732
|
-
(1 +
|
|
1733
|
-
Math.exp(0.15 *
|
|
1734
|
-
(Math.max(deltaTime, DifficultyHitObject.minDeltaTime) -
|
|
1735
|
-
75))));
|
|
1736
|
-
}
|
|
1737
|
-
}
|
|
1738
|
-
|
|
1739
1729
|
/**
|
|
1740
1730
|
* A difficulty calculator for osu!droid gamemode.
|
|
1741
1731
|
*/
|
|
@@ -1744,6 +1734,7 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1744
1734
|
super(...arguments);
|
|
1745
1735
|
this.attributes = {
|
|
1746
1736
|
mode: "rebalance",
|
|
1737
|
+
aimDifficultSliderCount: 0,
|
|
1747
1738
|
tapDifficulty: 0,
|
|
1748
1739
|
rhythmDifficulty: 0,
|
|
1749
1740
|
visualDifficulty: 0,
|
|
@@ -1958,14 +1949,12 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1958
1949
|
postCalculateAim(aimSkill, aimSkillWithoutSliders) {
|
|
1959
1950
|
this.strainPeaks.aimWithSliders = aimSkill.strainPeaks;
|
|
1960
1951
|
this.strainPeaks.aimWithoutSliders = aimSkillWithoutSliders.strainPeaks;
|
|
1961
|
-
const retryabilityScaling = this.calculateRetryabilityScaling(aimSkill.countRetryability());
|
|
1962
1952
|
this.attributes.aimDifficulty = this.mods.some((m) => m instanceof osuBase.ModAutopilot)
|
|
1963
1953
|
? 0
|
|
1964
|
-
: this.starValue(aimSkill.difficultyValue())
|
|
1954
|
+
: this.starValue(aimSkill.difficultyValue());
|
|
1965
1955
|
if (this.aim) {
|
|
1966
1956
|
this.attributes.sliderFactor =
|
|
1967
|
-
|
|
1968
|
-
retryabilityScaling) /
|
|
1957
|
+
this.starValue(aimSkillWithoutSliders.difficultyValue()) /
|
|
1969
1958
|
this.aim;
|
|
1970
1959
|
}
|
|
1971
1960
|
if (this.mods.some((m) => m instanceof osuBase.ModRelax)) {
|
|
@@ -1973,6 +1962,8 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1973
1962
|
}
|
|
1974
1963
|
this.attributes.aimDifficultStrainCount =
|
|
1975
1964
|
aimSkill.countDifficultStrains();
|
|
1965
|
+
this.attributes.aimDifficultSliderCount =
|
|
1966
|
+
aimSkill.countDifficultSliders();
|
|
1976
1967
|
this.calculateAimAttributes();
|
|
1977
1968
|
}
|
|
1978
1969
|
/**
|
|
@@ -2017,16 +2008,12 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
2017
2008
|
*/
|
|
2018
2009
|
postCalculateTap(tapSkillCheese, tapSkillVibro) {
|
|
2019
2010
|
this.strainPeaks.speed = tapSkillCheese.strainPeaks;
|
|
2020
|
-
const retryabilityScaling = this.calculateRetryabilityScaling(tapSkillCheese.countRetryability());
|
|
2021
2011
|
this.attributes.tapDifficulty = this.mods.some((m) => m instanceof osuBase.ModRelax)
|
|
2022
2012
|
? 0
|
|
2023
|
-
: this.starValue(tapSkillCheese.difficultyValue())
|
|
2024
|
-
retryabilityScaling;
|
|
2013
|
+
: this.starValue(tapSkillCheese.difficultyValue());
|
|
2025
2014
|
if (this.tap) {
|
|
2026
2015
|
this.attributes.vibroFactor =
|
|
2027
|
-
|
|
2028
|
-
retryabilityScaling) /
|
|
2029
|
-
this.tap;
|
|
2016
|
+
this.starValue(tapSkillVibro.difficultyValue()) / this.tap;
|
|
2030
2017
|
}
|
|
2031
2018
|
this.attributes.speedNoteCount = tapSkillCheese.relevantNoteCount();
|
|
2032
2019
|
this.attributes.averageSpeedDeltaTime =
|
|
@@ -2110,6 +2097,9 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
2110
2097
|
if (this.mods.some((m) => m instanceof osuBase.ModRelax)) {
|
|
2111
2098
|
this.attributes.flashlightDifficulty *= 0.7;
|
|
2112
2099
|
}
|
|
2100
|
+
else if (this.mods.some((m) => m instanceof osuBase.ModAutopilot)) {
|
|
2101
|
+
this.attributes.flashlightDifficulty *= 0.4;
|
|
2102
|
+
}
|
|
2113
2103
|
this.attributes.flashlightDifficultStrainCount =
|
|
2114
2104
|
flashlightSkill.countDifficultStrains();
|
|
2115
2105
|
}
|
|
@@ -2204,6 +2194,14 @@ class PerformanceCalculator {
|
|
|
2204
2194
|
this.computedAccuracy.n100 +
|
|
2205
2195
|
this.computedAccuracy.n50);
|
|
2206
2196
|
}
|
|
2197
|
+
/**
|
|
2198
|
+
* The total of imperfect hits (100s, 50s, misses).
|
|
2199
|
+
*/
|
|
2200
|
+
get totalImperfectHits() {
|
|
2201
|
+
return (this.computedAccuracy.n100 +
|
|
2202
|
+
this.computedAccuracy.n50 +
|
|
2203
|
+
this.computedAccuracy.nmiss);
|
|
2204
|
+
}
|
|
2207
2205
|
/**
|
|
2208
2206
|
* Calculates the base performance value of a star rating.
|
|
2209
2207
|
*/
|
|
@@ -2271,9 +2269,7 @@ class PerformanceCalculator {
|
|
|
2271
2269
|
if (this.difficultyAttributes.sliderCount > 0) {
|
|
2272
2270
|
// We assume 15% of sliders in a beatmap are difficult since there's no way to tell from the performance calculator.
|
|
2273
2271
|
const estimateDifficultSliders = this.difficultyAttributes.sliderCount * 0.15;
|
|
2274
|
-
const estimateSliderEndsDropped = osuBase.MathUtils.clamp(Math.min(this.
|
|
2275
|
-
this.computedAccuracy.n50 +
|
|
2276
|
-
this.computedAccuracy.nmiss, maxCombo - combo), 0, estimateDifficultSliders);
|
|
2272
|
+
const estimateSliderEndsDropped = osuBase.MathUtils.clamp(Math.min(this.totalImperfectHits, maxCombo - combo), 0, estimateDifficultSliders);
|
|
2277
2273
|
this.sliderNerfFactor =
|
|
2278
2274
|
(1 - this.difficultyAttributes.sliderFactor) *
|
|
2279
2275
|
Math.pow(1 -
|
|
@@ -2308,9 +2304,7 @@ class PerformanceCalculator {
|
|
|
2308
2304
|
const fullComboThreshold = maxCombo - 0.1 * this.difficultyAttributes.sliderCount;
|
|
2309
2305
|
if (combo < fullComboThreshold) {
|
|
2310
2306
|
// Clamp miss count to maximum amount of possible breaks.
|
|
2311
|
-
comboBasedMissCount = Math.min(fullComboThreshold / Math.max(1, combo), this.
|
|
2312
|
-
this.computedAccuracy.n50 +
|
|
2313
|
-
this.computedAccuracy.nmiss);
|
|
2307
|
+
comboBasedMissCount = Math.min(fullComboThreshold / Math.max(1, combo), this.totalImperfectHits);
|
|
2314
2308
|
}
|
|
2315
2309
|
}
|
|
2316
2310
|
return Math.max(this.computedAccuracy.nmiss, comboBasedMissCount);
|
|
@@ -2503,7 +2497,7 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2503
2497
|
Math.pow(this.visual, 1.1), 1 / 1.1) * this.finalMultiplier);
|
|
2504
2498
|
}
|
|
2505
2499
|
handleOptions(options) {
|
|
2506
|
-
var _a, _b, _c, _d;
|
|
2500
|
+
var _a, _b, _c, _d, _e;
|
|
2507
2501
|
this._tapPenalty = (_a = options === null || options === void 0 ? void 0 : options.tapPenalty) !== null && _a !== void 0 ? _a : 1;
|
|
2508
2502
|
this._aimSliderCheesePenalty = (_b = options === null || options === void 0 ? void 0 : options.aimSliderCheesePenalty) !== null && _b !== void 0 ? _b : 1;
|
|
2509
2503
|
this._flashlightSliderCheesePenalty =
|
|
@@ -2511,6 +2505,18 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2511
2505
|
this._visualSliderCheesePenalty =
|
|
2512
2506
|
(_d = options === null || options === void 0 ? void 0 : options.visualSliderCheesePenalty) !== null && _d !== void 0 ? _d : 1;
|
|
2513
2507
|
super.handleOptions(options);
|
|
2508
|
+
const { maxCombo, aimDifficultSliderCount, sliderFactor } = this.difficultyAttributes;
|
|
2509
|
+
const combo = (_e = options === null || options === void 0 ? void 0 : options.combo) !== null && _e !== void 0 ? _e : maxCombo - this.computedAccuracy.nmiss;
|
|
2510
|
+
if (aimDifficultSliderCount > 0) {
|
|
2511
|
+
// Consider all missing combo to be dropped difficult sliders.
|
|
2512
|
+
const estimateImproperlyFollowedDifficultSliders = osuBase.MathUtils.clamp(Math.min(this.totalImperfectHits, maxCombo - combo), 0, aimDifficultSliderCount);
|
|
2513
|
+
this.sliderNerfFactor =
|
|
2514
|
+
(1 - sliderFactor) *
|
|
2515
|
+
Math.pow(1 -
|
|
2516
|
+
estimateImproperlyFollowedDifficultSliders /
|
|
2517
|
+
aimDifficultSliderCount, 3) +
|
|
2518
|
+
sliderFactor;
|
|
2519
|
+
}
|
|
2514
2520
|
}
|
|
2515
2521
|
/**
|
|
2516
2522
|
* Calculates the aim performance value of the beatmap.
|
|
@@ -3055,8 +3061,9 @@ class OsuSpeedEvaluator extends SpeedEvaluator {
|
|
|
3055
3061
|
* - and how easily they can be cheesed.
|
|
3056
3062
|
*
|
|
3057
3063
|
* @param current The current object.
|
|
3064
|
+
* @param mods The mods applied.
|
|
3058
3065
|
*/
|
|
3059
|
-
static evaluateDifficultyOf(current) {
|
|
3066
|
+
static evaluateDifficultyOf(current, mods) {
|
|
3060
3067
|
var _a;
|
|
3061
3068
|
if (current.object instanceof osuBase.Spinner) {
|
|
3062
3069
|
return 0;
|
|
@@ -3079,8 +3086,11 @@ class OsuSpeedEvaluator extends SpeedEvaluator {
|
|
|
3079
3086
|
// Cap distance at spacing threshold
|
|
3080
3087
|
const distance = Math.min(this.SINGLE_SPACING_THRESHOLD, travelDistance + current.minimumJumpDistance);
|
|
3081
3088
|
// Max distance bonus is 1 * `distance_multiplier` at single_spacing_threshold
|
|
3082
|
-
|
|
3089
|
+
let distanceBonus = Math.pow(distance / this.SINGLE_SPACING_THRESHOLD, 3.95) *
|
|
3083
3090
|
this.DISTANCE_MULTIPLIER;
|
|
3091
|
+
if (mods.some((m) => m instanceof osuBase.ModAutopilot)) {
|
|
3092
|
+
distanceBonus = 0;
|
|
3093
|
+
}
|
|
3084
3094
|
// Base difficulty with all bonuses
|
|
3085
3095
|
const difficulty = ((1 + speedBonus + distanceBonus) * 1000) / strainTime;
|
|
3086
3096
|
// Apply penalty if there's doubletappable doubles
|
|
@@ -3263,7 +3273,7 @@ class OsuSpeed extends OsuSkill {
|
|
|
3263
3273
|
strainValueAt(current) {
|
|
3264
3274
|
this.currentSpeedStrain *= this.strainDecay(current.strainTime);
|
|
3265
3275
|
this.currentSpeedStrain +=
|
|
3266
|
-
OsuSpeedEvaluator.evaluateDifficultyOf(current) *
|
|
3276
|
+
OsuSpeedEvaluator.evaluateDifficultyOf(current, this.mods) *
|
|
3267
3277
|
this.skillMultiplier;
|
|
3268
3278
|
this.currentRhythm = OsuRhythmEvaluator.evaluateDifficultyOf(current);
|
|
3269
3279
|
const strain = this.currentSpeedStrain * this.currentRhythm;
|
|
@@ -3420,7 +3430,7 @@ class OsuDifficultyHitObject extends DifficultyHitObject {
|
|
|
3420
3430
|
get scalingFactor() {
|
|
3421
3431
|
const radius = this.object.radius;
|
|
3422
3432
|
// We will scale distances by this factor, so we can assume a uniform CircleSize among beatmaps.
|
|
3423
|
-
let scalingFactor =
|
|
3433
|
+
let scalingFactor = DifficultyHitObject.normalizedRadius / radius;
|
|
3424
3434
|
// High circle size (small CS) bonus
|
|
3425
3435
|
if (radius < this.radiusBuffThreshold) {
|
|
3426
3436
|
scalingFactor *=
|
|
@@ -3604,6 +3614,9 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3604
3614
|
if (this.mods.some((m) => m instanceof osuBase.ModRelax)) {
|
|
3605
3615
|
this.attributes.aimDifficulty *= 0.9;
|
|
3606
3616
|
}
|
|
3617
|
+
else if (this.mods.some((m) => m instanceof osuBase.ModAutopilot)) {
|
|
3618
|
+
this.attributes.aimDifficulty = 0;
|
|
3619
|
+
}
|
|
3607
3620
|
this.attributes.aimDifficultStrainCount =
|
|
3608
3621
|
aimSkill.countDifficultStrains();
|
|
3609
3622
|
}
|
|
@@ -3615,6 +3628,9 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3615
3628
|
postCalculateSpeed(speedSkill) {
|
|
3616
3629
|
this.strainPeaks.speed = speedSkill.strainPeaks;
|
|
3617
3630
|
this.attributes.speedDifficulty = this.starValue(speedSkill.difficultyValue());
|
|
3631
|
+
if (this.mods.some((m) => m instanceof osuBase.ModAutopilot)) {
|
|
3632
|
+
this.attributes.speedDifficulty *= 0.5;
|
|
3633
|
+
}
|
|
3618
3634
|
this.attributes.speedDifficultStrainCount =
|
|
3619
3635
|
speedSkill.countDifficultStrains();
|
|
3620
3636
|
}
|
|
@@ -3642,6 +3658,9 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3642
3658
|
if (this.mods.some((m) => m instanceof osuBase.ModRelax)) {
|
|
3643
3659
|
this.attributes.flashlightDifficulty *= 0.7;
|
|
3644
3660
|
}
|
|
3661
|
+
else if (this.mods.some((m) => m instanceof osuBase.ModAutopilot)) {
|
|
3662
|
+
this.attributes.flashlightDifficulty *= 0.4;
|
|
3663
|
+
}
|
|
3645
3664
|
}
|
|
3646
3665
|
}
|
|
3647
3666
|
|
|
@@ -3695,6 +3714,9 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
3695
3714
|
* Calculates the aim performance value of the beatmap.
|
|
3696
3715
|
*/
|
|
3697
3716
|
calculateAimValue() {
|
|
3717
|
+
if (this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModAutopilot)) {
|
|
3718
|
+
return 0;
|
|
3719
|
+
}
|
|
3698
3720
|
let aimValue = this.baseValue(this.difficultyAttributes.aimDifficulty);
|
|
3699
3721
|
// Longer maps are worth more
|
|
3700
3722
|
let lengthBonus = 0.95 + 0.4 * Math.min(1, this.totalHits / 2000);
|
|
@@ -3754,7 +3776,8 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
3754
3776
|
speedValue *= this.calculateStrainBasedMissPenalty(this.difficultyAttributes.speedDifficultStrainCount);
|
|
3755
3777
|
// AR scaling
|
|
3756
3778
|
const calculatedAR = this.difficultyAttributes.approachRate;
|
|
3757
|
-
if (calculatedAR > 10.33
|
|
3779
|
+
if (calculatedAR > 10.33 &&
|
|
3780
|
+
!this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModAutopilot)) {
|
|
3758
3781
|
// Buff for longer maps with high AR.
|
|
3759
3782
|
speedValue *= 1 + 0.3 * (calculatedAR - 10.33) * lengthBonus;
|
|
3760
3783
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rian8337/osu-rebalance-difficulty-calculator",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.44",
|
|
4
4
|
"description": "A module for calculating osu!standard beatmap difficulty and performance value with respect to the latest osu!lazer difficulty and performance algorithm.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"osu",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"url": "https://github.com/Rian8337/osu-droid-module/issues"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@rian8337/osu-base": "^4.0.0-beta.
|
|
36
|
+
"@rian8337/osu-base": "^4.0.0-beta.44"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "1a6680610da1128d0986580501c392adc649c948"
|
|
42
42
|
}
|
package/typings/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ declare abstract class AimEvaluator {
|
|
|
10
10
|
protected static readonly acuteAngleMultiplier: number;
|
|
11
11
|
protected static readonly sliderMultiplier: number;
|
|
12
12
|
protected static readonly velocityChangeMultiplier: number;
|
|
13
|
+
protected static readonly wiggleMultiplier: number;
|
|
13
14
|
/**
|
|
14
15
|
* Calculates the bonus of wide angles.
|
|
15
16
|
*/
|
|
@@ -197,8 +198,15 @@ declare abstract class DifficultyHitObject {
|
|
|
197
198
|
* Other hitobjects in the beatmap, including this hitobject.
|
|
198
199
|
*/
|
|
199
200
|
protected readonly hitObjects: readonly DifficultyHitObject[];
|
|
201
|
+
/**
|
|
202
|
+
* The normalized radius of the hitobject.
|
|
203
|
+
*/
|
|
204
|
+
static readonly normalizedRadius: number;
|
|
205
|
+
/**
|
|
206
|
+
* The normalized diameter of the hitobject.
|
|
207
|
+
*/
|
|
208
|
+
static get normalizedDiameter(): number;
|
|
200
209
|
protected abstract readonly mode: Modes;
|
|
201
|
-
protected readonly normalizedRadius = 50;
|
|
202
210
|
protected readonly maximumSliderRadius: number;
|
|
203
211
|
protected readonly assumedSliderRadius: number;
|
|
204
212
|
/**
|
|
@@ -543,20 +551,6 @@ declare abstract class DroidSkill extends StrainSkill {
|
|
|
543
551
|
* The bonus multiplier that is given for a sequence of notes of equal difficulty.
|
|
544
552
|
*/
|
|
545
553
|
protected abstract readonly starsPerDouble: number;
|
|
546
|
-
/**
|
|
547
|
-
* The minimum number of strains to judge when computing for retryability.
|
|
548
|
-
*/
|
|
549
|
-
protected readonly minimumRetryabilityStrains: number;
|
|
550
|
-
/**
|
|
551
|
-
* Computes the retryability of the beatmap based on the strains of the hitobjects.
|
|
552
|
-
*
|
|
553
|
-
* Earlier difficult strains indicate higher retryability.
|
|
554
|
-
*
|
|
555
|
-
* The result is scaled by clock rate as it affects the total number of strains.
|
|
556
|
-
*
|
|
557
|
-
* @returns A number between 0 and 1. A higher value indicates higher retryability.
|
|
558
|
-
*/
|
|
559
|
-
countRetryability(): number;
|
|
560
554
|
process(current: DifficultyHitObject): void;
|
|
561
555
|
difficultyValue(): number;
|
|
562
556
|
/**
|
|
@@ -660,7 +654,12 @@ declare class DroidAim extends DroidSkill {
|
|
|
660
654
|
private readonly skillMultiplier;
|
|
661
655
|
private readonly withSliders;
|
|
662
656
|
private currentAimStrain;
|
|
657
|
+
private readonly sliderStrains;
|
|
663
658
|
constructor(mods: Mod[], withSliders: boolean);
|
|
659
|
+
/**
|
|
660
|
+
* Obtains the amount of sliders that are considered difficult in terms of relative strain.
|
|
661
|
+
*/
|
|
662
|
+
countDifficultSliders(): number;
|
|
664
663
|
protected strainValueAt(current: DroidDifficultyHitObject): number;
|
|
665
664
|
protected calculateInitialStrain(time: number, current: DroidDifficultyHitObject): number;
|
|
666
665
|
protected getObjectStrain(): number;
|
|
@@ -674,9 +673,10 @@ declare class DroidAim extends DroidSkill {
|
|
|
674
673
|
* An evaluator for calculating osu!droid Aim skill.
|
|
675
674
|
*/
|
|
676
675
|
declare abstract class DroidAimEvaluator extends AimEvaluator {
|
|
677
|
-
protected static readonly wideAngleMultiplier = 1.
|
|
678
|
-
protected static readonly
|
|
679
|
-
protected static readonly
|
|
676
|
+
protected static readonly wideAngleMultiplier = 1.5;
|
|
677
|
+
protected static readonly acuteAngleMultiplier = 2.6;
|
|
678
|
+
protected static readonly sliderMultiplier = 1.35;
|
|
679
|
+
protected static readonly velocityChangeMultiplier = 0.75;
|
|
680
680
|
private static readonly singleSpacingThreshold;
|
|
681
681
|
private static readonly minSpeedBonus;
|
|
682
682
|
/**
|
|
@@ -699,12 +699,18 @@ declare abstract class DroidAimEvaluator extends AimEvaluator {
|
|
|
699
699
|
* Calculates the flow aim strain of a hitobject.
|
|
700
700
|
*/
|
|
701
701
|
private static flowAimStrainOf;
|
|
702
|
+
protected static calculateWideAngleBonus(angle: number): number;
|
|
703
|
+
protected static calculateAcuteAngleBonus(angle: number): number;
|
|
702
704
|
}
|
|
703
705
|
|
|
704
706
|
/**
|
|
705
707
|
* Holds data that can be used to calculate osu!droid performance points.
|
|
706
708
|
*/
|
|
707
709
|
interface DroidDifficultyAttributes extends DifficultyAttributes {
|
|
710
|
+
/**
|
|
711
|
+
* The number of sliders weighted by difficulty.
|
|
712
|
+
*/
|
|
713
|
+
aimDifficultSliderCount: number;
|
|
708
714
|
/**
|
|
709
715
|
* The difficulty corresponding to the tap skill.
|
|
710
716
|
*/
|
|
@@ -1071,6 +1077,10 @@ declare abstract class PerformanceCalculator<T extends DifficultyAttributes> {
|
|
|
1071
1077
|
* The total hits that were successfully done.
|
|
1072
1078
|
*/
|
|
1073
1079
|
protected get totalSuccessfulHits(): number;
|
|
1080
|
+
/**
|
|
1081
|
+
* The total of imperfect hits (100s, 50s, misses).
|
|
1082
|
+
*/
|
|
1083
|
+
protected get totalImperfectHits(): number;
|
|
1074
1084
|
/**
|
|
1075
1085
|
* Calculates the base performance value of a star rating.
|
|
1076
1086
|
*/
|
|
@@ -1301,7 +1311,6 @@ declare class DroidTap extends DroidSkill {
|
|
|
1301
1311
|
protected readonly reducedSectionBaseline = 0.75;
|
|
1302
1312
|
protected readonly strainDecayBase = 0.3;
|
|
1303
1313
|
protected readonly starsPerDouble = 1.1;
|
|
1304
|
-
protected readonly minimumRetryabilityStrains = 750;
|
|
1305
1314
|
private currentTapStrain;
|
|
1306
1315
|
private currentRhythmMultiplier;
|
|
1307
1316
|
private readonly skillMultiplier;
|
|
@@ -1690,8 +1699,9 @@ declare abstract class OsuSpeedEvaluator extends SpeedEvaluator {
|
|
|
1690
1699
|
* - and how easily they can be cheesed.
|
|
1691
1700
|
*
|
|
1692
1701
|
* @param current The current object.
|
|
1702
|
+
* @param mods The mods applied.
|
|
1693
1703
|
*/
|
|
1694
|
-
static evaluateDifficultyOf(current: OsuDifficultyHitObject): number;
|
|
1704
|
+
static evaluateDifficultyOf(current: OsuDifficultyHitObject, mods: Mod[]): number;
|
|
1695
1705
|
}
|
|
1696
1706
|
|
|
1697
1707
|
export { AimEvaluator, type CacheableDifficultyAttributes, type DifficultSlider, type DifficultyAttributes, type DifficultyCalculationOptions, DifficultyCalculator, DifficultyHitObject, DroidAim, DroidAimEvaluator, type DroidDifficultyAttributes, type DroidDifficultyCalculationOptions, DroidDifficultyCalculator, DroidDifficultyHitObject, DroidFlashlight, DroidFlashlightEvaluator, DroidPerformanceCalculator, DroidRhythm, DroidRhythmEvaluator, DroidTap, DroidTapEvaluator, DroidVisual, DroidVisualEvaluator, type ExtendedDroidDifficultyAttributes, FlashlightEvaluator, type HighStrainSection, OsuAim, OsuAimEvaluator, type OsuDifficultyAttributes, OsuDifficultyCalculator, OsuDifficultyHitObject, OsuFlashlight, OsuFlashlightEvaluator, OsuPerformanceCalculator, OsuRhythmEvaluator, OsuSpeed, OsuSpeedEvaluator, type PerformanceCalculationOptions, PerformanceCalculator, SpeedEvaluator, type StrainPeaks };
|