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

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 CHANGED
@@ -43,6 +43,15 @@ class DifficultyCalculator {
43
43
  };
44
44
  this.beatmap = beatmap;
45
45
  }
46
+ /**
47
+ * Retains `Mod`s that adjust a beatmap's difficulty from the specified mods.
48
+ *
49
+ * @param mods The mods to retain the difficulty adjustment mods from.
50
+ * @returns The retained difficulty adjustment mods.
51
+ */
52
+ static retainDifficultyAdjustmentMods(mods) {
53
+ return mods.filter((mod) => this.difficultyAdjustmentMods.has(mod.constructor));
54
+ }
46
55
  /**
47
56
  * Calculates the star rating of the specified beatmap.
48
57
  *
@@ -144,6 +153,10 @@ class DifficultyCalculator {
144
153
  return Math.pow(5 * Math.max(1, rating / 0.0675) - 4, 3) / 100000;
145
154
  }
146
155
  }
156
+ /**
157
+ * `Mod`s that adjust the difficulty of a beatmap.
158
+ */
159
+ DifficultyCalculator.difficultyAdjustmentMods = new Set();
147
160
 
148
161
  /**
149
162
  * Represents a hit object with difficulty calculation values.
@@ -2162,6 +2175,21 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
2162
2175
  * Increasing this number will result in less sections being flagged.
2163
2176
  */
2164
2177
  DroidDifficultyCalculator.threeFingerStrainThreshold = 175;
2178
+ DroidDifficultyCalculator.difficultyAdjustmentMods = new Set([
2179
+ osuBase.ModDoubleTime,
2180
+ osuBase.ModNightCore,
2181
+ osuBase.ModDifficultyAdjust,
2182
+ osuBase.ModHalfTime,
2183
+ osuBase.ModEasy,
2184
+ osuBase.ModHardRock,
2185
+ osuBase.ModFlashlight,
2186
+ osuBase.ModHidden,
2187
+ osuBase.ModRelax,
2188
+ osuBase.ModAutopilot,
2189
+ osuBase.ModPrecise,
2190
+ osuBase.ModScoreV2,
2191
+ osuBase.ModTraceable,
2192
+ ]);
2165
2193
 
2166
2194
  /**
2167
2195
  * The base class of performance calculators.
@@ -3745,6 +3773,19 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
3745
3773
  }
3746
3774
  }
3747
3775
  }
3776
+ OsuDifficultyCalculator.difficultyAdjustmentMods = new Set([
3777
+ osuBase.ModTouchDevice,
3778
+ osuBase.ModDoubleTime,
3779
+ osuBase.ModNightCore,
3780
+ osuBase.ModDifficultyAdjust,
3781
+ osuBase.ModHalfTime,
3782
+ osuBase.ModEasy,
3783
+ osuBase.ModHardRock,
3784
+ osuBase.ModFlashlight,
3785
+ osuBase.ModHidden,
3786
+ osuBase.ModRelax,
3787
+ osuBase.ModAutopilot,
3788
+ ]);
3748
3789
 
3749
3790
  /**
3750
3791
  * A performance points calculator that calculates performance points for osu!standard gamemode.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rian8337/osu-difficulty-calculator",
3
- "version": "4.0.0-beta.52",
3
+ "version": "4.0.0-beta.53",
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",
@@ -38,5 +38,5 @@
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "gitHead": "c7cd2019227c891e7897245ee61d1e24d7a5fb9c"
41
+ "gitHead": "f35904075742e0f04b295c304bd7d81d11d2b99d"
42
42
  }
@@ -1,4 +1,4 @@
1
- import { Mod, PlaceableHitObject, Modes, Beatmap, Accuracy } from '@rian8337/osu-base';
1
+ import { Mod, PlaceableHitObject, Modes, Beatmap, ModHidden, ModPrecise, ModTraceable, ModScoreV2, ModDoubleTime, ModNightCore, ModDifficultyAdjust, ModHalfTime, ModEasy, ModHardRock, ModFlashlight, ModRelax, ModAutopilot, Accuracy, ModTouchDevice } from '@rian8337/osu-base';
2
2
 
3
3
  /**
4
4
  * Holds data that can be used to calculate performance points.
@@ -340,6 +340,10 @@ declare abstract class DifficultyCalculator<THitObject extends DifficultyHitObje
340
340
  * The difficulty attributes that can be cached. It can also be used to calculate performance points.
341
341
  */
342
342
  abstract get cacheableAttributes(): CacheableDifficultyAttributes<TAttributes>;
343
+ /**
344
+ * `Mod`s that adjust the difficulty of a beatmap.
345
+ */
346
+ protected static readonly difficultyAdjustmentMods: Set<typeof Mod>;
343
347
  protected abstract readonly difficultyMultiplier: number;
344
348
  protected abstract readonly mode: Modes;
345
349
  /**
@@ -348,6 +352,13 @@ declare abstract class DifficultyCalculator<THitObject extends DifficultyHitObje
348
352
  * @param beatmap The beatmap to calculate.
349
353
  */
350
354
  constructor(beatmap: Beatmap);
355
+ /**
356
+ * Retains `Mod`s that adjust a beatmap's difficulty from the specified mods.
357
+ *
358
+ * @param mods The mods to retain the difficulty adjustment mods from.
359
+ * @returns The retained difficulty adjustment mods.
360
+ */
361
+ static retainDifficultyAdjustmentMods(mods: Mod[]): Mod[];
351
362
  /**
352
363
  * Calculates the star rating of the specified beatmap.
353
364
  *
@@ -832,6 +843,7 @@ declare class DroidDifficultyCalculator extends DifficultyCalculator<DroidDiffic
832
843
  static readonly threeFingerStrainThreshold = 175;
833
844
  readonly attributes: ExtendedDroidDifficultyAttributes;
834
845
  get cacheableAttributes(): CacheableDifficultyAttributes<DroidDifficultyAttributes>;
846
+ protected static readonly difficultyAdjustmentMods: Set<typeof ModHidden | typeof ModPrecise | typeof ModTraceable | typeof ModScoreV2 | typeof ModDoubleTime | typeof ModNightCore | typeof ModDifficultyAdjust | typeof ModHalfTime | typeof ModEasy | typeof ModHardRock | typeof ModFlashlight | typeof ModRelax | typeof ModAutopilot>;
835
847
  protected readonly difficultyMultiplier = 0.18;
836
848
  protected readonly mode = Modes.droid;
837
849
  calculate(options?: DroidDifficultyCalculationOptions): this;
@@ -1499,6 +1511,7 @@ declare class OsuDifficultyCalculator extends DifficultyCalculator<OsuDifficulty
1499
1511
  get flashlight(): number;
1500
1512
  readonly attributes: OsuDifficultyAttributes;
1501
1513
  get cacheableAttributes(): CacheableDifficultyAttributes<OsuDifficultyAttributes>;
1514
+ protected static readonly difficultyAdjustmentMods: Set<typeof ModHidden | typeof ModDoubleTime | typeof ModNightCore | typeof ModDifficultyAdjust | typeof ModHalfTime | typeof ModEasy | typeof ModHardRock | typeof ModFlashlight | typeof ModRelax | typeof ModAutopilot | typeof ModTouchDevice>;
1502
1515
  protected readonly difficultyMultiplier = 0.0675;
1503
1516
  protected readonly mode = Modes.osu;
1504
1517
  /**