@rian8337/osu-difficulty-calculator 4.0.0-beta.50 → 4.0.0-beta.52

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rian8337/osu-difficulty-calculator",
3
- "version": "4.0.0-beta.50",
3
+ "version": "4.0.0-beta.52",
4
4
  "description": "A module for calculating osu!standard beatmap difficulty and performance value with respect to the current 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.48"
36
+ "@rian8337/osu-base": "^4.0.0-beta.52"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "gitHead": "4a7163ab0b7a470d6df75087101a298514ab853b"
41
+ "gitHead": "c7cd2019227c891e7897245ee61d1e24d7a5fb9c"
42
42
  }
@@ -1,26 +1,5 @@
1
1
  import { Mod, PlaceableHitObject, Modes, Beatmap, Accuracy } from '@rian8337/osu-base';
2
2
 
3
- /**
4
- * An evaluator for calculating aim skill.
5
- *
6
- * This class should be considered an "evaluating" class and not persisted.
7
- */
8
- declare abstract class AimEvaluator {
9
- protected static readonly wideAngleMultiplier: number;
10
- protected static readonly acuteAngleMultiplier: number;
11
- protected static readonly sliderMultiplier: number;
12
- protected static readonly velocityChangeMultiplier: number;
13
- protected static readonly wiggleMultiplier: number;
14
- /**
15
- * Calculates the bonus of wide angles.
16
- */
17
- protected static calculateWideAngleBonus(angle: number): number;
18
- /**
19
- * Calculates the bonus of acute angles.
20
- */
21
- protected static calculateAcuteAngleBonus(angle: number): number;
22
- }
23
-
24
3
  /**
25
4
  * Holds data that can be used to calculate performance points.
26
5
  */
@@ -81,6 +60,10 @@ interface DifficultyAttributes {
81
60
  * The number of spinners in the beatmap.
82
61
  */
83
62
  spinnerCount: number;
63
+ /**
64
+ * The number of sliders weighted by difficulty.
65
+ */
66
+ aimDifficultSliderCount: number;
84
67
  /**
85
68
  * The amount of strains that are considered difficult with respect to the aim skill.
86
69
  */
@@ -259,10 +242,10 @@ declare abstract class DifficultyHitObject {
259
242
  * Calculates the opacity of the hitobject at a given time.
260
243
  *
261
244
  * @param time The time to calculate the hitobject's opacity at.
262
- * @param isHidden Whether Hidden mod is used.
245
+ * @param mods The mods used.
263
246
  * @returns The opacity of the hitobject at the given time.
264
247
  */
265
- opacityAt(time: number, isHidden: boolean): number;
248
+ opacityAt(time: number, mods: Mod[]): number;
266
249
  /**
267
250
  * How possible is it to doubletap this object together with the next one and get perfect
268
251
  * judgement in range from 0 to 1.
@@ -627,6 +610,7 @@ declare class DroidDifficultyHitObject extends DifficultyHitObject {
627
610
  */
628
611
  constructor(object: PlaceableHitObject, lastObject: PlaceableHitObject | null, lastLastObject: PlaceableHitObject | null, difficultyHitObjects: readonly DifficultyHitObject[], clockRate: number);
629
612
  computeProperties(clockRate: number, hitObjects: readonly PlaceableHitObject[]): void;
613
+ opacityAt(time: number, mods: Mod[]): number;
630
614
  /**
631
615
  * Determines whether this hitobject is considered overlapping with the hitobject before it.
632
616
  *
@@ -653,9 +637,9 @@ declare class DroidAim extends DroidSkill {
653
637
  protected readonly reducedSectionBaseline = 0.75;
654
638
  protected readonly starsPerDouble = 1.05;
655
639
  private readonly skillMultiplier;
656
- private readonly withSliders;
657
640
  private currentAimStrain;
658
641
  private readonly sliderStrains;
642
+ readonly withSliders: boolean;
659
643
  constructor(mods: Mod[], withSliders: boolean);
660
644
  /**
661
645
  * Obtains the amount of sliders that are considered difficult in terms of relative strain.
@@ -673,11 +657,12 @@ declare class DroidAim extends DroidSkill {
673
657
  /**
674
658
  * An evaluator for calculating osu!droid Aim skill.
675
659
  */
676
- declare abstract class DroidAimEvaluator extends AimEvaluator {
677
- protected static readonly wideAngleMultiplier = 1.5;
678
- protected static readonly acuteAngleMultiplier = 2.6;
679
- protected static readonly sliderMultiplier = 1.35;
680
- protected static readonly velocityChangeMultiplier = 0.75;
660
+ declare abstract class DroidAimEvaluator {
661
+ private static readonly wideAngleMultiplier;
662
+ private static readonly acuteAngleMultiplier;
663
+ private static readonly sliderMultiplier;
664
+ private static readonly velocityChangeMultiplier;
665
+ private static readonly wiggleMultiplier;
681
666
  private static readonly singleSpacingThreshold;
682
667
  private static readonly minSpeedBonus;
683
668
  /**
@@ -700,18 +685,14 @@ declare abstract class DroidAimEvaluator extends AimEvaluator {
700
685
  * Calculates the flow aim strain of a hitobject.
701
686
  */
702
687
  private static flowAimStrainOf;
703
- protected static calculateWideAngleBonus(angle: number): number;
704
- protected static calculateAcuteAngleBonus(angle: number): number;
688
+ private static calculateWideAngleBonus;
689
+ private static calculateAcuteAngleBonus;
705
690
  }
706
691
 
707
692
  /**
708
693
  * Holds data that can be used to calculate osu!droid performance points.
709
694
  */
710
695
  interface DroidDifficultyAttributes extends DifficultyAttributes {
711
- /**
712
- * The number of sliders weighted by difficulty.
713
- */
714
- aimDifficultSliderCount: number;
715
696
  /**
716
697
  * The difficulty corresponding to the tap skill.
717
698
  */
@@ -933,9 +914,8 @@ declare class DroidFlashlight extends DroidSkill {
933
914
  protected readonly reducedSectionBaseline = 1;
934
915
  protected readonly starsPerDouble = 1.06;
935
916
  private readonly skillMultiplier;
936
- private readonly isHidden;
937
- private readonly withSliders;
938
917
  private currentFlashlightStrain;
918
+ readonly withSliders: boolean;
939
919
  constructor(mods: Mod[], withSliders: boolean);
940
920
  protected strainValueAt(current: DroidDifficultyHitObject): number;
941
921
  protected calculateInitialStrain(time: number, current: DifficultyHitObject): number;
@@ -944,23 +924,17 @@ declare class DroidFlashlight extends DroidSkill {
944
924
  difficultyValue(): number;
945
925
  }
946
926
 
947
- /**
948
- * An evaluator for calculating flashlight skill.
949
- *
950
- * This class should be considered an "evaluating" class and not persisted.
951
- */
952
- declare abstract class FlashlightEvaluator {
953
- protected static readonly maxOpacityBonus: number;
954
- protected static readonly hiddenBonus: number;
955
- protected static readonly minVelocity: number;
956
- protected static readonly sliderMultiplier: number;
957
- protected static readonly minAngleMultiplier: number;
958
- }
959
-
960
927
  /**
961
928
  * An evaluator for calculating osu!droid Flashlight skill.
962
929
  */
963
- declare abstract class DroidFlashlightEvaluator extends FlashlightEvaluator {
930
+ declare abstract class DroidFlashlightEvaluator {
931
+ private static readonly maxOpacityBonus;
932
+ private static readonly hiddenBonus;
933
+ private static readonly traceableCircleBonus;
934
+ private static readonly traceableObjectBonus;
935
+ private static readonly minVelocity;
936
+ private static readonly sliderMultiplier;
937
+ private static readonly minAngleMultiplier;
964
938
  /**
965
939
  * Evaluates the difficulty of memorizing and hitting the current object, based on:
966
940
  *
@@ -971,10 +945,10 @@ declare abstract class DroidFlashlightEvaluator extends FlashlightEvaluator {
971
945
  * - and whether Hidden mod is enabled.
972
946
  *
973
947
  * @param current The current object.
974
- * @param isHiddenMod Whether the Hidden mod is enabled.
948
+ * @param mods The mods used.
975
949
  * @param withSliders Whether to take slider difficulty into account.
976
950
  */
977
- static evaluateDifficultyOf(current: DroidDifficultyHitObject, isHiddenMod: boolean, withSliders: boolean): number;
951
+ static evaluateDifficultyOf(current: DroidDifficultyHitObject, mods: Mod[], withSliders: boolean): number;
978
952
  }
979
953
 
980
954
  /**
@@ -1321,13 +1295,13 @@ declare class DroidTap extends DroidSkill {
1321
1295
  private currentTapStrain;
1322
1296
  private currentRhythmMultiplier;
1323
1297
  private readonly skillMultiplier;
1324
- private readonly considerCheesability;
1325
- private readonly strainTimeCap?;
1326
1298
  private readonly _objectDeltaTimes;
1327
1299
  /**
1328
1300
  * The delta time of hitobjects.
1329
1301
  */
1330
1302
  get objectDeltaTimes(): readonly number[];
1303
+ readonly considerCheesability: boolean;
1304
+ private readonly strainTimeCap?;
1331
1305
  constructor(mods: Mod[], considerCheesability: boolean, strainTimeCap?: number);
1332
1306
  /**
1333
1307
  * The amount of notes that are relevant to the difficulty.
@@ -1346,19 +1320,11 @@ declare class DroidTap extends DroidSkill {
1346
1320
  protected saveToHitObject(current: DroidDifficultyHitObject): void;
1347
1321
  }
1348
1322
 
1349
- /**
1350
- * An evaluator for calculating speed or tap skill.
1351
- *
1352
- * This class should be considered an "evaluating" class and not persisted.
1353
- */
1354
- declare abstract class SpeedEvaluator {
1355
- protected static readonly minSpeedBonus: number;
1356
- }
1357
-
1358
1323
  /**
1359
1324
  * An evaluator for calculating osu!droid tap skill.
1360
1325
  */
1361
- declare abstract class DroidTapEvaluator extends SpeedEvaluator {
1326
+ declare abstract class DroidTapEvaluator {
1327
+ private static readonly minSpeedBonus;
1362
1328
  /**
1363
1329
  * Evaluates the difficulty of tapping the current object, based on:
1364
1330
  *
@@ -1383,11 +1349,10 @@ declare class DroidVisual extends DroidSkill {
1383
1349
  protected readonly reducedSectionCount = 10;
1384
1350
  protected readonly reducedSectionBaseline = 0.75;
1385
1351
  protected readonly strainDecayBase = 0.1;
1386
- private readonly isHidden;
1387
- private readonly withSliders;
1388
1352
  private currentVisualStrain;
1389
1353
  private currentRhythmMultiplier;
1390
1354
  private readonly skillMultiplier;
1355
+ readonly withSliders: boolean;
1391
1356
  constructor(mods: Mod[], withSliders: boolean);
1392
1357
  protected strainValueAt(current: DroidDifficultyHitObject): number;
1393
1358
  protected calculateInitialStrain(time: number, current: DroidDifficultyHitObject): number;
@@ -1411,10 +1376,10 @@ declare abstract class DroidVisualEvaluator {
1411
1376
  * - and whether the Hidden mod is enabled.
1412
1377
  *
1413
1378
  * @param current The current object.
1414
- * @param isHiddenMod Whether the Hidden mod is enabled.
1379
+ * @param mods The mods used.
1415
1380
  * @param withSliders Whether to take slider difficulty into account.
1416
1381
  */
1417
- static evaluateDifficultyOf(current: DroidDifficultyHitObject, isHiddenMod: boolean, withSliders: boolean): number;
1382
+ static evaluateDifficultyOf(current: DroidDifficultyHitObject, mods: Mod[], withSliders: boolean): number;
1418
1383
  }
1419
1384
 
1420
1385
  /**
@@ -1456,8 +1421,13 @@ declare class OsuAim extends OsuSkill {
1456
1421
  protected readonly decayWeight = 0.9;
1457
1422
  private currentAimStrain;
1458
1423
  private readonly skillMultiplier;
1459
- private readonly withSliders;
1424
+ private readonly sliderStrains;
1425
+ readonly withSliders: boolean;
1460
1426
  constructor(mods: Mod[], withSliders: boolean);
1427
+ /**
1428
+ * Obtains the amount of sliders that are considered difficult in terms of relative strain.
1429
+ */
1430
+ countDifficultSliders(): number;
1461
1431
  protected strainValueAt(current: OsuDifficultyHitObject): number;
1462
1432
  protected calculateInitialStrain(time: number, current: OsuDifficultyHitObject): number;
1463
1433
  /**
@@ -1469,7 +1439,12 @@ declare class OsuAim extends OsuSkill {
1469
1439
  /**
1470
1440
  * An evaluator for calculating osu!standard Aim skill.
1471
1441
  */
1472
- declare abstract class OsuAimEvaluator extends AimEvaluator {
1442
+ declare abstract class OsuAimEvaluator {
1443
+ private static readonly wideAngleMultiplier;
1444
+ private static readonly acuteAngleMultiplier;
1445
+ private static readonly sliderMultiplier;
1446
+ private static readonly velocityChangeMultiplier;
1447
+ private static readonly wiggleMultiplier;
1473
1448
  /**
1474
1449
  * Evaluates the difficulty of aiming the current object, based on:
1475
1450
  *
@@ -1482,6 +1457,8 @@ declare abstract class OsuAimEvaluator extends AimEvaluator {
1482
1457
  * @param withSliders Whether to take slider difficulty into account.
1483
1458
  */
1484
1459
  static evaluateDifficultyOf(current: OsuDifficultyHitObject, withSliders: boolean): number;
1460
+ private static calculateWideAngleBonus;
1461
+ private static calculateAcuteAngleBonus;
1485
1462
  }
1486
1463
 
1487
1464
  /**
@@ -1555,10 +1532,6 @@ declare class OsuDifficultyCalculator extends DifficultyCalculator<OsuDifficulty
1555
1532
  * @param speedSkill The speed skill.
1556
1533
  */
1557
1534
  private postCalculateSpeed;
1558
- /**
1559
- * Calculates speed-related attributes.
1560
- */
1561
- private calculateSpeedAttributes;
1562
1535
  /**
1563
1536
  * Called after flashlight skill calculation.
1564
1537
  *
@@ -1577,8 +1550,6 @@ declare class OsuFlashlight extends OsuSkill {
1577
1550
  protected readonly decayWeight = 1;
1578
1551
  private currentFlashlightStrain;
1579
1552
  private readonly skillMultiplier;
1580
- private readonly isHidden;
1581
- constructor(mods: Mod[]);
1582
1553
  difficultyValue(): number;
1583
1554
  protected strainValueAt(current: OsuDifficultyHitObject): number;
1584
1555
  protected calculateInitialStrain(time: number, current: OsuDifficultyHitObject): number;
@@ -1588,7 +1559,12 @@ declare class OsuFlashlight extends OsuSkill {
1588
1559
  /**
1589
1560
  * An evaluator for calculating osu!standard Flashlight skill.
1590
1561
  */
1591
- declare abstract class OsuFlashlightEvaluator extends FlashlightEvaluator {
1562
+ declare abstract class OsuFlashlightEvaluator {
1563
+ private static readonly maxOpacityBonus;
1564
+ private static readonly hiddenBonus;
1565
+ private static readonly minVelocity;
1566
+ private static readonly sliderMultiplier;
1567
+ private static readonly minAngleMultiplier;
1592
1568
  /**
1593
1569
  * Evaluates the difficulty of memorizing and hitting the current object, based on:
1594
1570
  *
@@ -1599,9 +1575,9 @@ declare abstract class OsuFlashlightEvaluator extends FlashlightEvaluator {
1599
1575
  * - and whether Hidden mod is enabled.
1600
1576
  *
1601
1577
  * @param current The current object.
1602
- * @param isHiddenMod Whether the Hidden mod is enabled.
1578
+ * @param mods The mods used.
1603
1579
  */
1604
- static evaluateDifficultyOf(current: OsuDifficultyHitObject, isHiddenMod: boolean): number;
1580
+ static evaluateDifficultyOf(current: OsuDifficultyHitObject, mods: Mod[]): number;
1605
1581
  }
1606
1582
 
1607
1583
  /**
@@ -1627,6 +1603,7 @@ declare class OsuPerformanceCalculator extends PerformanceCalculator<OsuDifficul
1627
1603
  protected finalMultiplier: number;
1628
1604
  protected readonly mode = Modes.osu;
1629
1605
  private comboPenalty;
1606
+ private speedDeviation;
1630
1607
  protected calculateValues(): void;
1631
1608
  protected calculateTotalValue(): number;
1632
1609
  protected handleOptions(options?: PerformanceCalculationOptions): void;
@@ -1646,6 +1623,28 @@ declare class OsuPerformanceCalculator extends PerformanceCalculator<OsuDifficul
1646
1623
  * Calculates the flashlight performance value of the beatmap.
1647
1624
  */
1648
1625
  private calculateFlashlightValue;
1626
+ /**
1627
+ * Estimates a player's deviation on speed notes using {@link calculateDeviation}, assuming worst-case.
1628
+ *
1629
+ * Treats all speed notes as hit circles.
1630
+ */
1631
+ private calculateSpeedDeviation;
1632
+ /**
1633
+ * Estimates the player's tap deviation based on the OD, given number of greats, oks, mehs and misses,
1634
+ * assuming the player's mean hit error is 0. The estimation is consistent in that two SS scores on the
1635
+ * same map with the same settings will always return the same deviation.
1636
+ *
1637
+ * Misses are ignored because they are usually due to misaiming.
1638
+ *
1639
+ * Greats and oks are assumed to follow a normal distribution, whereas mehs are assumed to follow a uniform distribution.
1640
+ */
1641
+ private calculateDeviation;
1642
+ /**
1643
+ * Calculates multiplier for speed to account for improper tapping based on the deviation and speed difficulty.
1644
+ *
1645
+ * [Graph](https://www.desmos.com/calculator/dmogdhzofn)
1646
+ */
1647
+ private calculateSpeedHighDeviationNerf;
1649
1648
  toString(): string;
1650
1649
  }
1651
1650
 
@@ -1691,13 +1690,14 @@ declare class OsuSpeed extends OsuSkill {
1691
1690
  /**
1692
1691
  * An evaluator for calculating osu!standard speed skill.
1693
1692
  */
1694
- declare abstract class OsuSpeedEvaluator extends SpeedEvaluator {
1693
+ declare abstract class OsuSpeedEvaluator {
1695
1694
  /**
1696
1695
  * Spacing threshold for a single hitobject spacing.
1697
1696
  *
1698
1697
  * About 1.25 circles distance between hitobject centers.
1699
1698
  */
1700
1699
  private static readonly SINGLE_SPACING_THRESHOLD;
1700
+ private static readonly minSpeedBonus;
1701
1701
  private static readonly DISTANCE_MULTIPLIER;
1702
1702
  /**
1703
1703
  * Evaluates the difficulty of tapping the current object, based on:
@@ -1707,8 +1707,9 @@ declare abstract class OsuSpeedEvaluator extends SpeedEvaluator {
1707
1707
  * - and how easily they can be cheesed.
1708
1708
  *
1709
1709
  * @param current The current object.
1710
+ * @param mods The mods applied.
1710
1711
  */
1711
- static evaluateDifficultyOf(current: OsuDifficultyHitObject): number;
1712
+ static evaluateDifficultyOf(current: OsuDifficultyHitObject, mods: Mod[]): number;
1712
1713
  }
1713
1714
 
1714
- 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 };
1715
+ export { 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, type HighStrainSection, OsuAim, OsuAimEvaluator, type OsuDifficultyAttributes, OsuDifficultyCalculator, OsuDifficultyHitObject, OsuFlashlight, OsuFlashlightEvaluator, OsuPerformanceCalculator, OsuRhythmEvaluator, OsuSpeed, OsuSpeedEvaluator, type PerformanceCalculationOptions, PerformanceCalculator, type StrainPeaks };