@rian8337/osu-difficulty-calculator 4.0.0-beta.82 → 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 +928 -632
  2. package/package.json +3 -3
  3. package/typings/index.d.ts +104 -100
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rian8337/osu-difficulty-calculator",
3
- "version": "4.0.0-beta.82",
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": "de134bf082f310d8b84bfa2d99f42d1f2044398b"
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;
@@ -941,6 +935,10 @@ declare abstract class PerformanceCalculator<T extends IDifficultyAttributes> {
941
935
  * The calculated accuracy.
942
936
  */
943
937
  computedAccuracy: Accuracy;
938
+ /**
939
+ * The calculated maximum combo.
940
+ */
941
+ combo: number;
944
942
  /**
945
943
  * The difficulty attributes that is being calculated.
946
944
  */
@@ -949,39 +947,23 @@ declare abstract class PerformanceCalculator<T extends IDifficultyAttributes> {
949
947
  * The mods that were used.
950
948
  */
951
949
  protected readonly mods: ModMap;
952
- /**
953
- * The global multiplier to be applied to the final performance value.
954
- *
955
- * This is being adjusted to keep the final value scaled around what it used to be when changing things.
956
- */
957
- protected abstract finalMultiplier: number;
958
- /**
959
- * The gamemode to calculate for.
960
- */
961
- protected abstract readonly mode: Modes;
962
- /**
963
- * The amount of misses that are filtered out from sliderbreaks.
964
- */
965
- protected effectiveMissCount: number;
950
+ private _sliderEndsDropped;
966
951
  /**
967
952
  * The amount of slider ends dropped in the score.
968
953
  */
969
- protected sliderEndsDropped: number;
954
+ protected get sliderEndsDropped(): number;
955
+ private _sliderTicksMissed;
970
956
  /**
971
957
  * The amount of slider ticks missed in the score.
972
958
  *
973
959
  * This is used to calculate the slider accuracy.
974
960
  */
975
- protected sliderTicksMissed: number;
961
+ protected get sliderTicksMissed(): number;
976
962
  private _usingClassicSliderAccuracy;
977
963
  /**
978
964
  * Whether this score uses classic slider accuracy.
979
965
  */
980
966
  protected get usingClassicSliderAccuracy(): boolean;
981
- /**
982
- * Nerf factor used for nerfing beatmaps with very likely dropped sliderends.
983
- */
984
- protected sliderNerfFactor: number;
985
967
  /**
986
968
  * @param difficultyAttributes The difficulty attributes to calculate.
987
969
  */
@@ -1002,10 +984,6 @@ declare abstract class PerformanceCalculator<T extends IDifficultyAttributes> {
1002
984
  * performance value of the beatmap and stores them in this instance.
1003
985
  */
1004
986
  protected abstract calculateValues(): void;
1005
- /**
1006
- * Calculates the total performance value of the beatmap and stores it in this instance.
1007
- */
1008
- protected abstract calculateTotalValue(): number;
1009
987
  /**
1010
988
  * The total hits that can be done in the beatmap.
1011
989
  */
@@ -1018,28 +996,12 @@ declare abstract class PerformanceCalculator<T extends IDifficultyAttributes> {
1018
996
  * The total of imperfect hits (100s, 50s, misses).
1019
997
  */
1020
998
  protected get totalImperfectHits(): number;
1021
- /**
1022
- * Calculates the base performance value of a star rating.
1023
- */
1024
- protected baseValue(stars: number): number;
1025
999
  /**
1026
1000
  * Processes given options for usage in performance calculation.
1027
1001
  *
1028
1002
  * @param options Options for performance calculation.
1029
1003
  */
1030
1004
  protected handleOptions(options?: PerformanceCalculationOptions): void;
1031
- /**
1032
- * Calculates a strain-based miss penalty.
1033
- *
1034
- * Strain-based miss penalty assumes that a player will miss on the hardest parts of a map,
1035
- * so we use the amount of relatively difficult sections to adjust miss penalty
1036
- * to make it more punishing on maps with lower amount of hard sections.
1037
- */
1038
- protected calculateStrainBasedMissPenalty(difficultStrainCount: number): number;
1039
- /**
1040
- * Calculates the amount of misses + sliderbreaks from combo.
1041
- */
1042
- private calculateEffectiveMissCount;
1043
1005
  /**
1044
1006
  * Determines whether an attribute is a cacheable attribute.
1045
1007
  *
@@ -1099,39 +1061,18 @@ declare class DroidPerformanceCalculator extends PerformanceCalculator<IDroidDif
1099
1061
  * Can be properly obtained by analyzing the replay associated with the score.
1100
1062
  */
1101
1063
  get flashlightSliderCheesePenalty(): number;
1102
- protected finalMultiplier: number;
1103
- 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;
1104
1069
  private _aimSliderCheesePenalty;
1105
1070
  private _flashlightSliderCheesePenalty;
1106
1071
  private _tapPenalty;
1072
+ private _effectiveMissCount;
1107
1073
  private _deviation;
1108
1074
  private _tapDeviation;
1109
- /**
1110
- * Applies a tap penalty value to this calculator.
1111
- *
1112
- * The tap and total performance value will be recalculated afterwards.
1113
- *
1114
- * @param value The tap penalty value. Must be greater than or equal to 1.
1115
- */
1116
- applyTapPenalty(value: number): void;
1117
- /**
1118
- * Applies an aim slider cheese penalty value to this calculator.
1119
- *
1120
- * The aim and total performance value will be recalculated afterwards.
1121
- *
1122
- * @param value The slider cheese penalty value. Must be between than 0 and 1.
1123
- */
1124
- applyAimSliderCheesePenalty(value: number): void;
1125
- /**
1126
- * Applies a flashlight slider cheese penalty value to this calculator.
1127
- *
1128
- * The flashlight and total performance value will be recalculated afterwards.
1129
- *
1130
- * @param value The slider cheese penalty value. Must be between 0 and 1.
1131
- */
1132
- applyFlashlightSliderCheesePenalty(value: number): void;
1133
1075
  protected calculateValues(): void;
1134
- protected calculateTotalValue(): number;
1135
1076
  protected handleOptions(options?: PerformanceCalculationOptions): void;
1136
1077
  /**
1137
1078
  * Calculates the aim performance value of the beatmap.
@@ -1153,6 +1094,14 @@ declare class DroidPerformanceCalculator extends PerformanceCalculator<IDroidDif
1153
1094
  * Calculates the reading performance value of the beatmap.
1154
1095
  */
1155
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;
1156
1105
  /**
1157
1106
  * The object-based proportional miss penalty.
1158
1107
  */
@@ -1211,6 +1160,13 @@ declare class DroidReading extends Skill {
1211
1160
  private difficulty;
1212
1161
  private noteWeightSum;
1213
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;
1214
1170
  process(current: DroidDifficultyHitObject): void;
1215
1171
  difficultyValue(): number;
1216
1172
  /**
@@ -1365,6 +1321,10 @@ interface IOsuDifficultyAttributes extends IDifficultyAttributes {
1365
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.
1366
1322
  */
1367
1323
  approachRate: number;
1324
+ /**
1325
+ * The health drain rate of the beatmap.
1326
+ */
1327
+ drainRate: number;
1368
1328
  /**
1369
1329
  * The difficulty corresponding to the speed skill.
1370
1330
  */
@@ -1373,6 +1333,22 @@ interface IOsuDifficultyAttributes extends IDifficultyAttributes {
1373
1333
  * The amount of strains that are considered difficult with respect to the speed skill.
1374
1334
  */
1375
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;
1376
1352
  }
1377
1353
 
1378
1354
  /**
@@ -1420,6 +1396,10 @@ declare class OsuAim extends OsuSkill {
1420
1396
  * Obtains the amount of sliders that are considered difficult in terms of relative strain.
1421
1397
  */
1422
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;
1423
1403
  protected strainValueAt(current: OsuDifficultyHitObject): number;
1424
1404
  protected calculateInitialStrain(time: number, current: OsuDifficultyHitObject): number;
1425
1405
  /**
@@ -1458,8 +1438,11 @@ declare abstract class OsuAimEvaluator {
1458
1438
  */
1459
1439
  declare class OsuDifficultyAttributes extends DifficultyAttributes implements IOsuDifficultyAttributes {
1460
1440
  approachRate: number;
1441
+ drainRate: number;
1461
1442
  speedDifficulty: number;
1462
1443
  speedDifficultStrainCount: number;
1444
+ aimTopWeightedSliderFactor: number;
1445
+ speedTopWeightedSliderFactor: number;
1463
1446
  constructor(cacheableAttributes?: CacheableDifficultyAttributes<IOsuDifficultyAttributes>);
1464
1447
  toString(): string;
1465
1448
  }
@@ -1468,7 +1451,7 @@ declare class OsuDifficultyAttributes extends DifficultyAttributes implements IO
1468
1451
  * A difficulty calculator for osu!standard gamemode.
1469
1452
  */
1470
1453
  declare class OsuDifficultyCalculator extends DifficultyCalculator<OsuPlayableBeatmap, OsuDifficultyHitObject, OsuDifficultyAttributes> {
1471
- protected readonly difficultyMultiplier = 0.0675;
1454
+ private readonly starRatingMultiplier;
1472
1455
  constructor();
1473
1456
  retainDifficultyAdjustmentMods(mods: Mod[]): Mod[];
1474
1457
  protected createDifficultyAttributes(beatmap: OsuPlayableBeatmap, skills: Skill[]): OsuDifficultyAttributes;
@@ -1476,9 +1459,10 @@ declare class OsuDifficultyCalculator extends DifficultyCalculator<OsuPlayableBe
1476
1459
  protected createDifficultyHitObjects(beatmap: OsuPlayableBeatmap): OsuDifficultyHitObject[];
1477
1460
  protected createSkills(beatmap: OsuPlayableBeatmap): OsuSkill[];
1478
1461
  protected createStrainPeakSkills(beatmap: OsuPlayableBeatmap): StrainSkill[];
1479
- private populateAimAttributes;
1480
- private populateSpeedAttributes;
1481
- private populateFlashlightAttributes;
1462
+ private calculateMechanicalDifficultyRating;
1463
+ private calculateStarRating;
1464
+ static calculateRateAdjustedApproachRate(approachRate: number, clockRate: number): number;
1465
+ static calculateRateAdjustedOverallDifficulty(overallDifficulty: number, clockRate: number): number;
1482
1466
  }
1483
1467
 
1484
1468
  /**
@@ -1491,6 +1475,7 @@ declare class OsuFlashlight extends OsuSkill {
1491
1475
  protected readonly decayWeight = 1;
1492
1476
  private currentFlashlightStrain;
1493
1477
  private readonly skillMultiplier;
1478
+ static difficultyToPerformance(difficulty: number): number;
1494
1479
  difficultyValue(): number;
1495
1480
  protected strainValueAt(current: OsuDifficultyHitObject): number;
1496
1481
  protected calculateInitialStrain(time: number, current: OsuDifficultyHitObject): number;
@@ -1541,13 +1526,14 @@ declare class OsuPerformanceCalculator extends PerformanceCalculator<IOsuDifficu
1541
1526
  * The flashlight performance value.
1542
1527
  */
1543
1528
  flashlight: number;
1544
- protected finalMultiplier: number;
1545
- protected readonly mode = Modes.osu;
1546
- 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;
1547
1535
  private speedDeviation;
1548
1536
  protected calculateValues(): void;
1549
- protected calculateTotalValue(): number;
1550
- protected handleOptions(options?: PerformanceCalculationOptions): void;
1551
1537
  /**
1552
1538
  * Calculates the aim performance value of the beatmap.
1553
1539
  */
@@ -1564,6 +1550,14 @@ declare class OsuPerformanceCalculator extends PerformanceCalculator<IOsuDifficu
1564
1550
  * Calculates the flashlight performance value of the beatmap.
1565
1551
  */
1566
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;
1567
1561
  /**
1568
1562
  * Estimates a player's deviation on speed notes using {@link calculateDeviation}, assuming worst-case.
1569
1563
  *
@@ -1586,6 +1580,11 @@ declare class OsuPerformanceCalculator extends PerformanceCalculator<IOsuDifficu
1586
1580
  * [Graph](https://www.desmos.com/calculator/dmogdhzofn)
1587
1581
  */
1588
1582
  private calculateSpeedHighDeviationNerf;
1583
+ private calculateEstimatedSliderBreaks;
1584
+ /**
1585
+ * Calculates the amount of misses + sliderbreaks from combo.
1586
+ */
1587
+ private calculateComboBasedEstimatedMissCount;
1589
1588
  toString(): string;
1590
1589
  }
1591
1590
 
@@ -1617,11 +1616,16 @@ declare class OsuSpeed extends OsuSkill {
1617
1616
  private currentSpeedStrain;
1618
1617
  private currentRhythm;
1619
1618
  private readonly skillMultiplier;
1619
+ private readonly sliderStrains;
1620
1620
  private maxStrain;
1621
1621
  /**
1622
1622
  * The amount of notes that are relevant to the difficulty.
1623
1623
  */
1624
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;
1625
1629
  /**
1626
1630
  * @param current The hitobject to calculate.
1627
1631
  */