@rian8337/osu-rebalance-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.
@@ -2161,6 +2174,21 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
2161
2174
  * Increasing this number will result in less sections being flagged.
2162
2175
  */
2163
2176
  DroidDifficultyCalculator.threeFingerStrainThreshold = 175;
2177
+ DroidDifficultyCalculator.difficultyAdjustmentMods = new Set([
2178
+ osuBase.ModDoubleTime,
2179
+ osuBase.ModNightCore,
2180
+ osuBase.ModDifficultyAdjust,
2181
+ osuBase.ModHalfTime,
2182
+ osuBase.ModEasy,
2183
+ osuBase.ModHardRock,
2184
+ osuBase.ModFlashlight,
2185
+ osuBase.ModHidden,
2186
+ osuBase.ModRelax,
2187
+ osuBase.ModAutopilot,
2188
+ osuBase.ModPrecise,
2189
+ osuBase.ModScoreV2,
2190
+ osuBase.ModTraceable,
2191
+ ]);
2164
2192
 
2165
2193
  /**
2166
2194
  * The base class of performance calculators.
@@ -3728,6 +3756,19 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
3728
3756
  }
3729
3757
  }
3730
3758
  }
3759
+ OsuDifficultyCalculator.difficultyAdjustmentMods = new Set([
3760
+ osuBase.ModTouchDevice,
3761
+ osuBase.ModDoubleTime,
3762
+ osuBase.ModNightCore,
3763
+ osuBase.ModDifficultyAdjust,
3764
+ osuBase.ModHalfTime,
3765
+ osuBase.ModEasy,
3766
+ osuBase.ModHardRock,
3767
+ osuBase.ModFlashlight,
3768
+ osuBase.ModHidden,
3769
+ osuBase.ModRelax,
3770
+ osuBase.ModAutopilot,
3771
+ ]);
3731
3772
 
3732
3773
  /**
3733
3774
  * 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-rebalance-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 latest osu!lazer 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.
@@ -339,6 +339,10 @@ declare abstract class DifficultyCalculator<THitObject extends DifficultyHitObje
339
339
  * The difficulty attributes that can be cached. It can also be used to calculate performance points.
340
340
  */
341
341
  abstract get cacheableAttributes(): CacheableDifficultyAttributes<TAttributes>;
342
+ /**
343
+ * `Mod`s that adjust the difficulty of a beatmap.
344
+ */
345
+ protected static readonly difficultyAdjustmentMods: Set<typeof Mod>;
342
346
  protected abstract readonly difficultyMultiplier: number;
343
347
  protected abstract readonly mode: Modes;
344
348
  /**
@@ -347,6 +351,13 @@ declare abstract class DifficultyCalculator<THitObject extends DifficultyHitObje
347
351
  * @param beatmap The beatmap to calculate.
348
352
  */
349
353
  constructor(beatmap: Beatmap);
354
+ /**
355
+ * Retains `Mod`s that adjust a beatmap's difficulty from the specified mods.
356
+ *
357
+ * @param mods The mods to retain the difficulty adjustment mods from.
358
+ * @returns The retained difficulty adjustment mods.
359
+ */
360
+ static retainDifficultyAdjustmentMods(mods: Mod[]): Mod[];
350
361
  /**
351
362
  * Calculates the star rating of the specified beatmap.
352
363
  *
@@ -831,6 +842,7 @@ declare class DroidDifficultyCalculator extends DifficultyCalculator<DroidDiffic
831
842
  static readonly threeFingerStrainThreshold = 175;
832
843
  readonly attributes: ExtendedDroidDifficultyAttributes;
833
844
  get cacheableAttributes(): CacheableDifficultyAttributes<DroidDifficultyAttributes>;
845
+ 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>;
834
846
  protected readonly difficultyMultiplier = 0.18;
835
847
  protected readonly mode = Modes.droid;
836
848
  calculate(options?: DroidDifficultyCalculationOptions): this;
@@ -1497,6 +1509,7 @@ declare class OsuDifficultyCalculator extends DifficultyCalculator<OsuDifficulty
1497
1509
  get flashlight(): number;
1498
1510
  readonly attributes: OsuDifficultyAttributes;
1499
1511
  get cacheableAttributes(): CacheableDifficultyAttributes<OsuDifficultyAttributes>;
1512
+ 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>;
1500
1513
  protected readonly difficultyMultiplier = 0.0675;
1501
1514
  protected readonly mode = Modes.osu;
1502
1515
  /**