@rian8337/osu-difficulty-calculator 4.0.0-beta.24 → 4.0.0-beta.26

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.24",
3
+ "version": "4.0.0-beta.26",
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.24"
36
+ "@rian8337/osu-base": "^4.0.0-beta.26"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "gitHead": "b567d54f6f8553aeaf56acb8a0b3741c3920b72b"
41
+ "gitHead": "1c353ee9455d80a5ca8358762f107899d64f1d5e"
42
42
  }
@@ -1,4 +1,4 @@
1
- import { Mod, PlaceableHitObject, Modes, Beatmap, DifficultyStatisticsCalculatorResult, Accuracy } from '@rian8337/osu-base';
1
+ import { Mod, PlaceableHitObject, Modes, Beatmap, Accuracy } from '@rian8337/osu-base';
2
2
 
3
3
  /**
4
4
  * An evaluator for calculating aim skill.
@@ -62,12 +62,6 @@ interface DifficultyAttributes {
62
62
  * The overall clock rate that was applied to the beatmap.
63
63
  */
64
64
  clockRate: number;
65
- /**
66
- * The perceived approach rate inclusive of rate-adjusting mods (DT/HT/etc).
67
- *
68
- * Rate-adjusting mods don't directly affect the approach rate difficulty value, but have a perceived effect as a result of adjusting audio timing.
69
- */
70
- approachRate: number;
71
65
  /**
72
66
  * The perceived overall difficulty inclusive of rate-adjusting mods (DT/HT/etc), based on osu!standard judgement.
73
67
  *
@@ -191,6 +185,10 @@ declare abstract class DifficultyHitObject {
191
185
  * Adjusted end time of the hitobject, taking speed multiplier into account.
192
186
  */
193
187
  readonly endTime: number;
188
+ /**
189
+ * The full great window of the hitobject.
190
+ */
191
+ readonly fullGreatWindow: number;
194
192
  /**
195
193
  * Other hitobjects in the beatmap, including this hitobject.
196
194
  */
@@ -199,7 +197,10 @@ declare abstract class DifficultyHitObject {
199
197
  protected readonly normalizedRadius = 50;
200
198
  protected readonly maximumSliderRadius: number;
201
199
  protected readonly assumedSliderRadius: number;
202
- protected readonly minDeltaTime = 25;
200
+ /**
201
+ * The lowest possible delta time value.
202
+ */
203
+ static readonly minDeltaTime = 25;
203
204
  private readonly lastObject;
204
205
  private readonly lastLastObject;
205
206
  /**
@@ -211,8 +212,9 @@ declare abstract class DifficultyHitObject {
211
212
  * @param lastLastObject The hitobject before the last hitobject.
212
213
  * @param difficultyHitObjects All difficulty hitobjects in the processed beatmap.
213
214
  * @param clockRate The clock rate of the beatmap.
215
+ * @param greatWindow The great window of the hitobject.
214
216
  */
215
- protected constructor(object: PlaceableHitObject, lastObject: PlaceableHitObject | null, lastLastObject: PlaceableHitObject | null, difficultyHitObjects: readonly DifficultyHitObject[], clockRate: number);
217
+ constructor(object: PlaceableHitObject, lastObject: PlaceableHitObject | null, lastLastObject: PlaceableHitObject | null, difficultyHitObjects: readonly DifficultyHitObject[], clockRate: number, greatWindow: number);
216
218
  /**
217
219
  * Computes the properties of this hitobject.
218
220
  *
@@ -250,6 +252,13 @@ declare abstract class DifficultyHitObject {
250
252
  * @returns The opacity of the hitobject at the given time.
251
253
  */
252
254
  opacityAt(time: number, isHidden: boolean): number;
255
+ /**
256
+ * How possible is it to doubletap this object together with the next one and get perfect
257
+ * judgement in range from 0 to 1.
258
+ *
259
+ * A value closer to 1 indicates a higher possibility.
260
+ */
261
+ get doubletapness(): number;
253
262
  protected abstract get scalingFactor(): number;
254
263
  protected setDistances(clockRate: number): void;
255
264
  private calculateSliderCursorPosition;
@@ -312,7 +321,11 @@ declare abstract class DifficultyCalculator<THitObject extends DifficultyHitObje
312
321
  /**
313
322
  * The difficulty objects of the beatmap.
314
323
  */
315
- readonly objects: THitObject[];
324
+ private _objects;
325
+ /**
326
+ * The difficulty objects of the beatmap.
327
+ */
328
+ get objects(): readonly THitObject[];
316
329
  /**
317
330
  * The modifications applied.
318
331
  */
@@ -321,10 +334,6 @@ declare abstract class DifficultyCalculator<THitObject extends DifficultyHitObje
321
334
  * The total star rating of the beatmap.
322
335
  */
323
336
  get total(): number;
324
- /**
325
- * The difficulty statistics of the beatmap after modifications are applied.
326
- */
327
- difficultyStatistics: DifficultyStatisticsCalculatorResult<number, number, number, number>;
328
337
  /**
329
338
  * The strain peaks of various calculated difficulties.
330
339
  */
@@ -342,7 +351,7 @@ declare abstract class DifficultyCalculator<THitObject extends DifficultyHitObje
342
351
  /**
343
352
  * Constructs a new instance of the calculator.
344
353
  *
345
- * @param beatmap The beatmap to calculate. This beatmap will be deep-cloned to prevent reference changes.
354
+ * @param beatmap The beatmap to calculate.
346
355
  */
347
356
  constructor(beatmap: Beatmap);
348
357
  /**
@@ -364,16 +373,10 @@ declare abstract class DifficultyCalculator<THitObject extends DifficultyHitObje
364
373
  /**
365
374
  * Generates difficulty hitobjects for this calculator.
366
375
  *
367
- * @param convertedBeatmap The beatmap to generate difficulty hitobjects from.
368
- */
369
- protected abstract generateDifficultyHitObjects(convertedBeatmap: Beatmap): THitObject[];
370
- /**
371
- * Computes the difficulty statistics of the original beatmap with respect to the used options.
372
- *
373
- * @param options The options to use for the difficulty statistics calculation.
374
- * @returns The computed difficulty statistics.
376
+ * @param beatmap The beatmap to generate difficulty hitobjects from.
377
+ * @param clockRate The clock rate of the beatmap.
375
378
  */
376
- protected abstract computeDifficultyStatistics(options?: DifficultyCalculationOptions): DifficultyStatisticsCalculatorResult<number, number, number, number>;
379
+ protected abstract generateDifficultyHitObjects(beatmap: Beatmap, clockRate: number): THitObject[];
377
380
  /**
378
381
  * Calculates the skills provided.
379
382
  *
@@ -398,8 +401,11 @@ declare abstract class DifficultyCalculator<THitObject extends DifficultyHitObje
398
401
  protected abstract createSkills(): Skill[];
399
402
  /**
400
403
  * Populates the stored difficulty attributes with necessary data.
404
+ *
405
+ * @param beatmap The beatmap to populate the attributes with.
406
+ * @param clockRate The clock rate of the beatmap.
401
407
  */
402
- protected populateDifficultyAttributes(): void;
408
+ protected populateDifficultyAttributes(beatmap: Beatmap, clockRate: number): void;
403
409
  /**
404
410
  * Calculates the star rating value of a difficulty.
405
411
  *
@@ -521,6 +527,7 @@ declare abstract class DroidSkill extends StrainSkill {
521
527
  * The strains of hitobjects.
522
528
  */
523
529
  get objectStrains(): readonly number[];
530
+ private difficulty;
524
531
  /**
525
532
  * Returns the number of strains weighed against the top strain.
526
533
  *
@@ -599,9 +606,9 @@ declare class DroidDifficultyHitObject extends DifficultyHitObject {
599
606
  * @param lastLastObject The hitobject before the last hitobject.
600
607
  * @param difficultyHitObjects All difficulty hitobjects in the processed beatmap.
601
608
  * @param clockRate The clock rate of the beatmap.
602
- * @param isForceAR Whether force AR is enabled.
609
+ * @param greatWindow The great window of the hitobject.
603
610
  */
604
- constructor(object: PlaceableHitObject, lastObject: PlaceableHitObject | null, lastLastObject: PlaceableHitObject | null, difficultyHitObjects: readonly DifficultyHitObject[], clockRate: number, isForceAR: boolean);
611
+ constructor(object: PlaceableHitObject, lastObject: PlaceableHitObject | null, lastLastObject: PlaceableHitObject | null, difficultyHitObjects: readonly DifficultyHitObject[], clockRate: number, greatWindow: number);
605
612
  computeProperties(clockRate: number, hitObjects: readonly PlaceableHitObject[]): void;
606
613
  /**
607
614
  * Determines whether this hitobject is considered overlapping with the hitobject before it.
@@ -609,6 +616,9 @@ declare class DroidDifficultyHitObject extends DifficultyHitObject {
609
616
  * Keep in mind that "overlapping" in this case is overlapping to the point where both hitobjects
610
617
  * can be hit with just a single tap in osu!droid.
611
618
  *
619
+ * In the case of sliders, it is considered overlapping if all nested hitobjects can be hit with
620
+ * one aim motion.
621
+ *
612
622
  * @param considerDistance Whether to consider the distance between both hitobjects.
613
623
  * @returns Whether the hitobject is considered overlapping.
614
624
  */
@@ -841,8 +851,7 @@ declare class DroidDifficultyCalculator extends DifficultyCalculator<DroidDiffic
841
851
  calculateTotal(): void;
842
852
  calculateAll(): void;
843
853
  toString(): string;
844
- protected generateDifficultyHitObjects(convertedBeatmap: Beatmap): DroidDifficultyHitObject[];
845
- protected computeDifficultyStatistics(options?: DroidDifficultyCalculationOptions): DifficultyStatisticsCalculatorResult<number, number, number, number>;
854
+ protected generateDifficultyHitObjects(beatmap: Beatmap, clockRate: number): DroidDifficultyHitObject[];
846
855
  protected createSkills(): DroidSkill[];
847
856
  /**
848
857
  * Called after aim skill calculation.
@@ -1243,36 +1252,27 @@ declare class DroidRhythm extends DroidSkill {
1243
1252
  protected readonly starsPerDouble = 1.75;
1244
1253
  private currentRhythmStrain;
1245
1254
  private currentRhythmMultiplier;
1246
- private readonly hitWindow;
1247
- constructor(mods: Mod[], overallDifficulty: number);
1248
1255
  protected strainValueAt(current: DroidDifficultyHitObject): number;
1249
1256
  protected calculateInitialStrain(time: number, current: DroidDifficultyHitObject): number;
1250
1257
  protected getObjectStrain(): number;
1251
1258
  protected saveToHitObject(current: DroidDifficultyHitObject): void;
1252
1259
  }
1253
1260
 
1254
- /**
1255
- * An evaluator for calculating rhythm skill.
1256
- *
1257
- * This class should be considered an "evaluating" class and not persisted.
1258
- */
1259
- declare abstract class RhythmEvaluator {
1260
- protected static readonly rhythmMultiplier: number;
1261
- protected static readonly historyTimeMax: number;
1262
- }
1263
-
1264
1261
  /**
1265
1262
  * An evaluator for calculating osu!droid Rhythm skill.
1266
1263
  */
1267
- declare abstract class DroidRhythmEvaluator extends RhythmEvaluator {
1264
+ declare abstract class DroidRhythmEvaluator {
1265
+ private static readonly historyTimeMax;
1266
+ private static readonly historyObjectsMax;
1267
+ private static readonly rhythmOverallMultiplier;
1268
+ private static readonly rhythmRatioMultiplier;
1268
1269
  /**
1269
1270
  * Calculates a rhythm multiplier for the difficulty of the tap associated
1270
1271
  * with historic data of the current object.
1271
1272
  *
1272
1273
  * @param current The current object.
1273
- * @param greatWindow The great hit window of the current object.
1274
1274
  */
1275
- static evaluateDifficultyOf(current: DroidDifficultyHitObject, greatWindow: number): number;
1275
+ static evaluateDifficultyOf(current: DroidDifficultyHitObject): number;
1276
1276
  }
1277
1277
 
1278
1278
  /**
@@ -1286,7 +1286,6 @@ declare class DroidTap extends DroidSkill {
1286
1286
  private currentTapStrain;
1287
1287
  private currentRhythmMultiplier;
1288
1288
  private readonly skillMultiplier;
1289
- private readonly greatWindow;
1290
1289
  private readonly considerCheesability;
1291
1290
  private readonly strainTimeCap?;
1292
1291
  private readonly _objectDeltaTimes;
@@ -1294,7 +1293,7 @@ declare class DroidTap extends DroidSkill {
1294
1293
  * The delta time of hitobjects.
1295
1294
  */
1296
1295
  get objectDeltaTimes(): readonly number[];
1297
- constructor(mods: Mod[], overallDifficulty: number, considerCheesability: boolean, strainTimeCap?: number);
1296
+ constructor(mods: Mod[], considerCheesability: boolean, strainTimeCap?: number);
1298
1297
  /**
1299
1298
  * The amount of notes that are relevant to the difficulty.
1300
1299
  */
@@ -1338,7 +1337,7 @@ declare abstract class DroidTapEvaluator extends SpeedEvaluator {
1338
1337
  * @param considerCheesability Whether to consider cheesability.
1339
1338
  * @param strainTimeCap The strain time to cap the object's strain time to.
1340
1339
  */
1341
- static evaluateDifficultyOf(current: DroidDifficultyHitObject, greatWindow: number, considerCheesability: boolean, strainTimeCap?: number): number;
1340
+ static evaluateDifficultyOf(current: DroidDifficultyHitObject, considerCheesability: boolean, strainTimeCap?: number): number;
1342
1341
  }
1343
1342
 
1344
1343
  /**
@@ -1420,17 +1419,6 @@ declare class OsuDifficultyHitObject extends DifficultyHitObject {
1420
1419
  private readonly radiusBuffThreshold;
1421
1420
  protected readonly mode = Modes.osu;
1422
1421
  protected get scalingFactor(): number;
1423
- /**
1424
- * Note: You **must** call `computeProperties` at some point due to how TypeScript handles
1425
- * overridden properties (see [this](https://github.com/microsoft/TypeScript/issues/1617) GitHub issue).
1426
- *
1427
- * @param object The underlying hitobject.
1428
- * @param lastObject The hitobject before this hitobject.
1429
- * @param lastLastObject The hitobject before the last hitobject.
1430
- * @param difficultyHitObjects All difficulty hitobjects in the processed beatmap.
1431
- * @param clockRate The clock rate of the beatmap.
1432
- */
1433
- constructor(object: PlaceableHitObject, lastObject: PlaceableHitObject | null, lastLastObject: PlaceableHitObject | null, difficultyHitObjects: readonly DifficultyHitObject[], clockRate: number);
1434
1422
  }
1435
1423
 
1436
1424
  /**
@@ -1475,6 +1463,12 @@ declare abstract class OsuAimEvaluator extends AimEvaluator {
1475
1463
  * Holds data that can be used to calculate osu!standard performance points.
1476
1464
  */
1477
1465
  interface OsuDifficultyAttributes extends DifficultyAttributes {
1466
+ /**
1467
+ * The perceived approach rate inclusive of rate-adjusting mods (DT/HT/etc).
1468
+ *
1469
+ * Rate-adjusting mods don't directly affect the approach rate difficulty value, but have a perceived effect as a result of adjusting audio timing.
1470
+ */
1471
+ approachRate: number;
1478
1472
  /**
1479
1473
  * The difficulty corresponding to the speed skill.
1480
1474
  */
@@ -1516,9 +1510,9 @@ declare class OsuDifficultyCalculator extends DifficultyCalculator<OsuDifficulty
1516
1510
  calculateTotal(): void;
1517
1511
  calculateAll(): void;
1518
1512
  toString(): string;
1519
- protected generateDifficultyHitObjects(convertedBeatmap: Beatmap): OsuDifficultyHitObject[];
1520
- protected computeDifficultyStatistics(options?: DifficultyCalculationOptions): DifficultyStatisticsCalculatorResult<number, number, number, number>;
1513
+ protected generateDifficultyHitObjects(beatmap: Beatmap, clockRate: number): OsuDifficultyHitObject[];
1521
1514
  protected createSkills(): OsuSkill[];
1515
+ protected populateDifficultyAttributes(beatmap: Beatmap, clockRate: number): void;
1522
1516
  /**
1523
1517
  * Called after aim skill calculation.
1524
1518
  *
@@ -1626,7 +1620,9 @@ declare class OsuPerformanceCalculator extends PerformanceCalculator<OsuDifficul
1626
1620
  /**
1627
1621
  * An evaluator for calculating osu!standard Rhythm skill.
1628
1622
  */
1629
- declare abstract class OsuRhythmEvaluator extends RhythmEvaluator {
1623
+ declare abstract class OsuRhythmEvaluator {
1624
+ private static readonly rhythmMultiplier;
1625
+ private static readonly historyTimeMax;
1630
1626
  /**
1631
1627
  * Calculates a rhythm multiplier for the difficulty of the tap associated
1632
1628
  * with historic data of the current object.
@@ -1634,7 +1630,7 @@ declare abstract class OsuRhythmEvaluator extends RhythmEvaluator {
1634
1630
  * @param current The current object.
1635
1631
  * @param greatWindow The great hit window of the current object.
1636
1632
  */
1637
- static evaluateDifficultyOf(current: OsuDifficultyHitObject, greatWindow: number): number;
1633
+ static evaluateDifficultyOf(current: OsuDifficultyHitObject): number;
1638
1634
  }
1639
1635
 
1640
1636
  /**
@@ -1649,8 +1645,6 @@ declare class OsuSpeed extends OsuSkill {
1649
1645
  private currentSpeedStrain;
1650
1646
  private currentRhythm;
1651
1647
  private readonly skillMultiplier;
1652
- private readonly greatWindow;
1653
- constructor(mods: Mod[], overallDifficulty: number);
1654
1648
  /**
1655
1649
  * @param current The hitobject to calculate.
1656
1650
  */
@@ -1678,9 +1672,8 @@ declare abstract class OsuSpeedEvaluator extends SpeedEvaluator {
1678
1672
  * - and how easily they can be cheesed.
1679
1673
  *
1680
1674
  * @param current The current object.
1681
- * @param greatWindow The great hit window of the current object.
1682
1675
  */
1683
- static evaluateDifficultyOf(current: OsuDifficultyHitObject, greatWindow: number): number;
1676
+ static evaluateDifficultyOf(current: OsuDifficultyHitObject): number;
1684
1677
  }
1685
1678
 
1686
- 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, RhythmEvaluator, SpeedEvaluator, type StrainPeaks };
1679
+ 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 };