@rian8337/osu-difficulty-calculator 4.0.0-beta.83 → 4.0.0-beta.85

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.
Files changed (3) hide show
  1. package/dist/index.js +930 -638
  2. package/package.json +3 -3
  3. package/typings/index.d.ts +100 -100
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rian8337/osu-difficulty-calculator",
3
- "version": "4.0.0-beta.83",
3
+ "version": "4.0.0-beta.85",
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.78"
36
+ "@rian8337/osu-base": "^4.0.0-beta.85"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "gitHead": "da2dd374cbbd45f8956f09a1248809318ac7025a"
41
+ "gitHead": "874c5332059efd6f54bbdd3b54dbb0144a75407e"
42
42
  }
@@ -288,7 +288,7 @@ declare abstract class DifficultyHitObject {
288
288
  *
289
289
  * A value closer to 1 indicates a higher possibility.
290
290
  */
291
- get doubletapness(): number;
291
+ getDoubletapness(nextObj: this | null): number;
292
292
  protected setDistances(clockRate: number): void;
293
293
  private calculateSliderCursorPosition;
294
294
  private getEndCursorPosition;
@@ -373,6 +373,13 @@ declare abstract class StrainSkill extends Skill {
373
373
  private currentStrain;
374
374
  private currentSectionPeak;
375
375
  private currentSectionEnd;
376
+ /**
377
+ * Converts a difficulty value to a performance value.
378
+ *
379
+ * @param difficulty The difficulty value to convert.
380
+ * @returns The performance value.
381
+ */
382
+ static difficultyToPerformance(difficulty: number): number;
376
383
  process(current: DifficultyHitObject): void;
377
384
  /**
378
385
  * Saves the current peak strain level to the list of strain peaks, which will be used to calculate an overall difficulty.
@@ -428,7 +435,6 @@ declare abstract class StrainSkill extends Skill {
428
435
  * The base of a difficulty calculator.
429
436
  */
430
437
  declare abstract class DifficultyCalculator<TBeatmap extends PlayableBeatmap, THitObject extends DifficultyHitObject, TAttributes extends DifficultyAttributes> {
431
- protected abstract readonly difficultyMultiplier: number;
432
438
  /**
433
439
  * `Mod`s that adjust the difficulty of a beatmap.
434
440
  */
@@ -440,13 +446,6 @@ declare abstract class DifficultyCalculator<TBeatmap extends PlayableBeatmap, TH
440
446
  * @returns The retained difficulty adjustment mods.
441
447
  */
442
448
  abstract retainDifficultyAdjustmentMods(mods: Mod[]): Mod[];
443
- /**
444
- * Calculates the difficulty of a `PlayableBeatmap`.
445
- *
446
- * @param beatmap The `PlayableBeatmap` whose difficulty is to be calculated.
447
- * @returns A `DifficultyAttributes` object describing the difficulty of the `Beatmap`.
448
- */
449
- calculate(beatmap: TBeatmap): TAttributes;
450
449
  /**
451
450
  * Calculates the difficulty of a `Beatmap` with specific `Mod`s.
452
451
  *
@@ -507,20 +506,6 @@ declare abstract class DifficultyCalculator<TBeatmap extends PlayableBeatmap, TH
507
506
  * @returns The `PlayableBeatmap`.
508
507
  */
509
508
  protected abstract createPlayableBeatmap(beatmap: Beatmap, mods?: ModMap): TBeatmap;
510
- /**
511
- * Calculates the base rating of a `Skill`.
512
- *
513
- * @param skill The `Skill` to calculate the rating of.
514
- * @returns The rating of the `Skill`.
515
- */
516
- protected calculateRating(skill: Skill): number;
517
- /**
518
- * Calculates the base performance value of a difficulty rating.
519
- *
520
- * @param rating The difficulty rating.
521
- */
522
- protected basePerformanceValue(rating: number): number;
523
- private createPlayableBeatmapWithDifficultyAdjustmentMods;
524
509
  }
525
510
 
526
511
  /**
@@ -653,6 +638,7 @@ declare class DroidAim extends DroidSkill {
653
638
  private maxSliderStrain;
654
639
  readonly withSliders: boolean;
655
640
  constructor(mods: ModMap, withSliders: boolean);
641
+ static difficultyToPerformance(difficulty: number): number;
656
642
  /**
657
643
  * Obtains the amount of sliders that are considered difficult in terms of relative strain.
658
644
  */
@@ -826,7 +812,7 @@ declare class DroidDifficultyCalculator extends DifficultyCalculator<DroidPlayab
826
812
  * Increasing this number will result in less sections being flagged.
827
813
  */
828
814
  static readonly threeFingerStrainThreshold = 175;
829
- protected readonly difficultyMultiplier = 0.18;
815
+ private readonly difficultyMultiplier;
830
816
  constructor();
831
817
  retainDifficultyAdjustmentMods(mods: Mod[]): Mod[];
832
818
  protected createDifficultyAttributes(beatmap: DroidPlayableBeatmap, skills: Skill[], objects: DroidDifficultyHitObject[]): ExtendedDroidDifficultyAttributes;
@@ -839,6 +825,13 @@ declare class DroidDifficultyCalculator extends DifficultyCalculator<DroidPlayab
839
825
  private populateRhythmAttributes;
840
826
  private populateFlashlightAttributes;
841
827
  private populateReadingAttributes;
828
+ /**
829
+ * Calculates the base rating of a `Skill`.
830
+ *
831
+ * @param skill The `Skill` to calculate the rating of.
832
+ * @returns The rating of the `Skill`.
833
+ */
834
+ private calculateRating;
842
835
  }
843
836
 
844
837
  /**
@@ -853,6 +846,7 @@ declare class DroidFlashlight extends DroidSkill {
853
846
  private currentFlashlightStrain;
854
847
  readonly withSliders: boolean;
855
848
  constructor(mods: ModMap, withSliders: boolean);
849
+ static difficultyToPerformance(difficulty: number): number;
856
850
  protected strainValueAt(current: DroidDifficultyHitObject): number;
857
851
  protected calculateInitialStrain(time: number, current: DifficultyHitObject): number;
858
852
  protected getObjectStrain(): number;
@@ -953,39 +947,23 @@ declare abstract class PerformanceCalculator<T extends IDifficultyAttributes> {
953
947
  * The mods that were used.
954
948
  */
955
949
  protected readonly mods: ModMap;
956
- /**
957
- * The global multiplier to be applied to the final performance value.
958
- *
959
- * This is being adjusted to keep the final value scaled around what it used to be when changing things.
960
- */
961
- protected abstract finalMultiplier: number;
962
- /**
963
- * The gamemode to calculate for.
964
- */
965
- protected abstract readonly mode: Modes;
966
- /**
967
- * The amount of misses, including slider nested misses.
968
- */
969
- protected effectiveMissCount: number;
950
+ private _sliderEndsDropped;
970
951
  /**
971
952
  * The amount of slider ends dropped in the score.
972
953
  */
973
- protected sliderEndsDropped: number;
954
+ protected get sliderEndsDropped(): number;
955
+ private _sliderTicksMissed;
974
956
  /**
975
957
  * The amount of slider ticks missed in the score.
976
958
  *
977
959
  * This is used to calculate the slider accuracy.
978
960
  */
979
- protected sliderTicksMissed: number;
961
+ protected get sliderTicksMissed(): number;
980
962
  private _usingClassicSliderAccuracy;
981
963
  /**
982
964
  * Whether this score uses classic slider accuracy.
983
965
  */
984
966
  protected get usingClassicSliderAccuracy(): boolean;
985
- /**
986
- * Nerf factor used for nerfing beatmaps with very likely dropped sliderends.
987
- */
988
- protected sliderNerfFactor: number;
989
967
  /**
990
968
  * @param difficultyAttributes The difficulty attributes to calculate.
991
969
  */
@@ -1006,10 +984,6 @@ declare abstract class PerformanceCalculator<T extends IDifficultyAttributes> {
1006
984
  * performance value of the beatmap and stores them in this instance.
1007
985
  */
1008
986
  protected abstract calculateValues(): void;
1009
- /**
1010
- * Calculates the total performance value of the beatmap and stores it in this instance.
1011
- */
1012
- protected abstract calculateTotalValue(): number;
1013
987
  /**
1014
988
  * The total hits that can be done in the beatmap.
1015
989
  */
@@ -1022,28 +996,12 @@ declare abstract class PerformanceCalculator<T extends IDifficultyAttributes> {
1022
996
  * The total of imperfect hits (100s, 50s, misses).
1023
997
  */
1024
998
  protected get totalImperfectHits(): number;
1025
- /**
1026
- * Calculates the base performance value of a star rating.
1027
- */
1028
- protected baseValue(stars: number): number;
1029
999
  /**
1030
1000
  * Processes given options for usage in performance calculation.
1031
1001
  *
1032
1002
  * @param options Options for performance calculation.
1033
1003
  */
1034
1004
  protected handleOptions(options?: PerformanceCalculationOptions): void;
1035
- /**
1036
- * Calculates a strain-based miss penalty.
1037
- *
1038
- * Strain-based miss penalty assumes that a player will miss on the hardest parts of a map,
1039
- * so we use the amount of relatively difficult sections to adjust miss penalty
1040
- * to make it more punishing on maps with lower amount of hard sections.
1041
- */
1042
- protected calculateStrainBasedMissPenalty(difficultStrainCount: number): number;
1043
- /**
1044
- * Calculates the amount of misses + sliderbreaks from combo.
1045
- */
1046
- private calculateEffectiveMissCount;
1047
1005
  /**
1048
1006
  * Determines whether an attribute is a cacheable attribute.
1049
1007
  *
@@ -1103,39 +1061,18 @@ declare class DroidPerformanceCalculator extends PerformanceCalculator<IDroidDif
1103
1061
  * Can be properly obtained by analyzing the replay associated with the score.
1104
1062
  */
1105
1063
  get flashlightSliderCheesePenalty(): number;
1106
- protected finalMultiplier: number;
1107
- protected readonly mode = Modes.droid;
1064
+ /**
1065
+ * The amount of misses, including slider breaks.
1066
+ */
1067
+ get effectiveMissCount(): number;
1068
+ static readonly finalMultiplier = 1.24;
1108
1069
  private _aimSliderCheesePenalty;
1109
1070
  private _flashlightSliderCheesePenalty;
1110
1071
  private _tapPenalty;
1072
+ private _effectiveMissCount;
1111
1073
  private _deviation;
1112
1074
  private _tapDeviation;
1113
- /**
1114
- * Applies a tap penalty value to this calculator.
1115
- *
1116
- * The tap and total performance value will be recalculated afterwards.
1117
- *
1118
- * @param value The tap penalty value. Must be greater than or equal to 1.
1119
- */
1120
- applyTapPenalty(value: number): void;
1121
- /**
1122
- * Applies an aim slider cheese penalty value to this calculator.
1123
- *
1124
- * The aim and total performance value will be recalculated afterwards.
1125
- *
1126
- * @param value The slider cheese penalty value. Must be between than 0 and 1.
1127
- */
1128
- applyAimSliderCheesePenalty(value: number): void;
1129
- /**
1130
- * Applies a flashlight slider cheese penalty value to this calculator.
1131
- *
1132
- * The flashlight and total performance value will be recalculated afterwards.
1133
- *
1134
- * @param value The slider cheese penalty value. Must be between 0 and 1.
1135
- */
1136
- applyFlashlightSliderCheesePenalty(value: number): void;
1137
1075
  protected calculateValues(): void;
1138
- protected calculateTotalValue(): number;
1139
1076
  protected handleOptions(options?: PerformanceCalculationOptions): void;
1140
1077
  /**
1141
1078
  * Calculates the aim performance value of the beatmap.
@@ -1157,6 +1094,14 @@ declare class DroidPerformanceCalculator extends PerformanceCalculator<IDroidDif
1157
1094
  * Calculates the reading performance value of the beatmap.
1158
1095
  */
1159
1096
  private calculateReadingValue;
1097
+ /**
1098
+ * Calculates a strain-based miss penalty.
1099
+ *
1100
+ * Strain-based miss penalty assumes that a player will miss on the hardest parts of a map,
1101
+ * so we use the amount of relatively difficult sections to adjust miss penalty
1102
+ * to make it more punishing on maps with lower amount of hard sections.
1103
+ */
1104
+ private calculateStrainBasedMissPenalty;
1160
1105
  /**
1161
1106
  * The object-based proportional miss penalty.
1162
1107
  */
@@ -1215,6 +1160,13 @@ declare class DroidReading extends Skill {
1215
1160
  private difficulty;
1216
1161
  private noteWeightSum;
1217
1162
  constructor(mods: ModMap, clockRate: number, hitObjects: readonly PlaceableHitObject[]);
1163
+ /**
1164
+ * Converts a difficulty value to a performance value.
1165
+ *
1166
+ * @param difficulty The difficulty value to convert.
1167
+ * @returns The performance value.
1168
+ */
1169
+ static difficultyToPerformance(difficulty: number): number;
1218
1170
  process(current: DroidDifficultyHitObject): void;
1219
1171
  difficultyValue(): number;
1220
1172
  /**
@@ -1369,6 +1321,10 @@ interface IOsuDifficultyAttributes extends IDifficultyAttributes {
1369
1321
  * Rate-adjusting mods don't directly affect the approach rate difficulty value, but have a perceived effect as a result of adjusting audio timing.
1370
1322
  */
1371
1323
  approachRate: number;
1324
+ /**
1325
+ * The health drain rate of the beatmap.
1326
+ */
1327
+ drainRate: number;
1372
1328
  /**
1373
1329
  * The difficulty corresponding to the speed skill.
1374
1330
  */
@@ -1377,6 +1333,22 @@ interface IOsuDifficultyAttributes extends IDifficultyAttributes {
1377
1333
  * The amount of strains that are considered difficult with respect to the speed skill.
1378
1334
  */
1379
1335
  speedDifficultStrainCount: number;
1336
+ /**
1337
+ * Describes how much of {@link aimDifficultStrainCount} is contributed to by circles or sliders.
1338
+ *
1339
+ * A value closer to 0 indicates most of {@link aimDifficultStrainCount} is contributed by circles.
1340
+ *
1341
+ * A value closer to infinity indicates most of {@link aimDifficultStrainCount} is contributed by sliders.
1342
+ */
1343
+ aimTopWeightedSliderFactor: number;
1344
+ /**
1345
+ * Describes how much of {@link speedDifficultStrainCount} is contributed to by circles or sliders.
1346
+ *
1347
+ * A value closer to 0 indicates most of {@link speedDifficultStrainCount} is contributed by circles.
1348
+ *
1349
+ * A value closer to infinity indicates most of {@link speedDifficultStrainCount} is contributed by sliders.
1350
+ */
1351
+ speedTopWeightedSliderFactor: number;
1380
1352
  }
1381
1353
 
1382
1354
  /**
@@ -1424,6 +1396,10 @@ declare class OsuAim extends OsuSkill {
1424
1396
  * Obtains the amount of sliders that are considered difficult in terms of relative strain.
1425
1397
  */
1426
1398
  countDifficultSliders(): number;
1399
+ /**
1400
+ * Obtains the amount of sliders that are considered difficult in terms of relative strain, weighted by consistency.
1401
+ */
1402
+ countTopWeightedSliders(): number;
1427
1403
  protected strainValueAt(current: OsuDifficultyHitObject): number;
1428
1404
  protected calculateInitialStrain(time: number, current: OsuDifficultyHitObject): number;
1429
1405
  /**
@@ -1462,8 +1438,11 @@ declare abstract class OsuAimEvaluator {
1462
1438
  */
1463
1439
  declare class OsuDifficultyAttributes extends DifficultyAttributes implements IOsuDifficultyAttributes {
1464
1440
  approachRate: number;
1441
+ drainRate: number;
1465
1442
  speedDifficulty: number;
1466
1443
  speedDifficultStrainCount: number;
1444
+ aimTopWeightedSliderFactor: number;
1445
+ speedTopWeightedSliderFactor: number;
1467
1446
  constructor(cacheableAttributes?: CacheableDifficultyAttributes<IOsuDifficultyAttributes>);
1468
1447
  toString(): string;
1469
1448
  }
@@ -1472,7 +1451,7 @@ declare class OsuDifficultyAttributes extends DifficultyAttributes implements IO
1472
1451
  * A difficulty calculator for osu!standard gamemode.
1473
1452
  */
1474
1453
  declare class OsuDifficultyCalculator extends DifficultyCalculator<OsuPlayableBeatmap, OsuDifficultyHitObject, OsuDifficultyAttributes> {
1475
- protected readonly difficultyMultiplier = 0.0675;
1454
+ private readonly starRatingMultiplier;
1476
1455
  constructor();
1477
1456
  retainDifficultyAdjustmentMods(mods: Mod[]): Mod[];
1478
1457
  protected createDifficultyAttributes(beatmap: OsuPlayableBeatmap, skills: Skill[]): OsuDifficultyAttributes;
@@ -1480,9 +1459,10 @@ declare class OsuDifficultyCalculator extends DifficultyCalculator<OsuPlayableBe
1480
1459
  protected createDifficultyHitObjects(beatmap: OsuPlayableBeatmap): OsuDifficultyHitObject[];
1481
1460
  protected createSkills(beatmap: OsuPlayableBeatmap): OsuSkill[];
1482
1461
  protected createStrainPeakSkills(beatmap: OsuPlayableBeatmap): StrainSkill[];
1483
- private populateAimAttributes;
1484
- private populateSpeedAttributes;
1485
- private populateFlashlightAttributes;
1462
+ private calculateMechanicalDifficultyRating;
1463
+ private calculateStarRating;
1464
+ static calculateRateAdjustedApproachRate(approachRate: number, clockRate: number): number;
1465
+ static calculateRateAdjustedOverallDifficulty(overallDifficulty: number, clockRate: number): number;
1486
1466
  }
1487
1467
 
1488
1468
  /**
@@ -1495,6 +1475,7 @@ declare class OsuFlashlight extends OsuSkill {
1495
1475
  protected readonly decayWeight = 1;
1496
1476
  private currentFlashlightStrain;
1497
1477
  private readonly skillMultiplier;
1478
+ static difficultyToPerformance(difficulty: number): number;
1498
1479
  difficultyValue(): number;
1499
1480
  protected strainValueAt(current: OsuDifficultyHitObject): number;
1500
1481
  protected calculateInitialStrain(time: number, current: OsuDifficultyHitObject): number;
@@ -1545,13 +1526,14 @@ declare class OsuPerformanceCalculator extends PerformanceCalculator<IOsuDifficu
1545
1526
  * The flashlight performance value.
1546
1527
  */
1547
1528
  flashlight: number;
1548
- protected finalMultiplier: number;
1549
- protected readonly mode = Modes.osu;
1550
- private comboPenalty;
1529
+ /**
1530
+ * The amount of misses, including slider breaks.
1531
+ */
1532
+ get effectiveMissCount(): number;
1533
+ static readonly finalMultiplier = 1.14;
1534
+ private _effectiveMissCount;
1551
1535
  private speedDeviation;
1552
1536
  protected calculateValues(): void;
1553
- protected calculateTotalValue(): number;
1554
- protected handleOptions(options?: PerformanceCalculationOptions): void;
1555
1537
  /**
1556
1538
  * Calculates the aim performance value of the beatmap.
1557
1539
  */
@@ -1568,6 +1550,14 @@ declare class OsuPerformanceCalculator extends PerformanceCalculator<IOsuDifficu
1568
1550
  * Calculates the flashlight performance value of the beatmap.
1569
1551
  */
1570
1552
  private calculateFlashlightValue;
1553
+ /**
1554
+ * Calculates a strain-based miss penalty.
1555
+ *
1556
+ * Strain-based miss penalty assumes that a player will miss on the hardest parts of a map,
1557
+ * so we use the amount of relatively difficult sections to adjust miss penalty
1558
+ * to make it more punishing on maps with lower amount of hard sections.
1559
+ */
1560
+ private calculateMissPenalty;
1571
1561
  /**
1572
1562
  * Estimates a player's deviation on speed notes using {@link calculateDeviation}, assuming worst-case.
1573
1563
  *
@@ -1590,6 +1580,11 @@ declare class OsuPerformanceCalculator extends PerformanceCalculator<IOsuDifficu
1590
1580
  * [Graph](https://www.desmos.com/calculator/dmogdhzofn)
1591
1581
  */
1592
1582
  private calculateSpeedHighDeviationNerf;
1583
+ private calculateEstimatedSliderBreaks;
1584
+ /**
1585
+ * Calculates the amount of misses + sliderbreaks from combo.
1586
+ */
1587
+ private calculateComboBasedEstimatedMissCount;
1593
1588
  toString(): string;
1594
1589
  }
1595
1590
 
@@ -1621,11 +1616,16 @@ declare class OsuSpeed extends OsuSkill {
1621
1616
  private currentSpeedStrain;
1622
1617
  private currentRhythm;
1623
1618
  private readonly skillMultiplier;
1619
+ private readonly sliderStrains;
1624
1620
  private maxStrain;
1625
1621
  /**
1626
1622
  * The amount of notes that are relevant to the difficulty.
1627
1623
  */
1628
1624
  relevantNoteCount(): number;
1625
+ /**
1626
+ * Obtains the amount of sliders that are considered difficult in terms of relative strain, weighted by consistency.
1627
+ */
1628
+ countTopWeightedSliders(): number;
1629
1629
  /**
1630
1630
  * @param current The hitobject to calculate.
1631
1631
  */