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

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
@@ -85,15 +85,14 @@ class DifficultyCalculator {
85
85
  * @returns The current instance.
86
86
  */
87
87
  calculate(options) {
88
- var _a, _b;
88
+ var _a;
89
89
  this.mods = (_a = options === null || options === void 0 ? void 0 : options.mods) !== null && _a !== void 0 ? _a : [];
90
90
  const playableBeatmap = this.beatmap.createPlayableBeatmap({
91
91
  mode: this.mode,
92
92
  mods: this.mods,
93
93
  customSpeedMultiplier: options === null || options === void 0 ? void 0 : options.customSpeedMultiplier,
94
94
  });
95
- const clockRate = osuBase.ModUtil.calculateRateWithMods(this.mods) *
96
- ((_b = options === null || options === void 0 ? void 0 : options.customSpeedMultiplier) !== null && _b !== void 0 ? _b : 1);
95
+ const clockRate = this.calculateClockRate(options);
97
96
  this.populateDifficultyAttributes(playableBeatmap, clockRate);
98
97
  this._objects = this.generateDifficultyHitObjects(playableBeatmap, clockRate);
99
98
  this.calculateAll();
@@ -112,6 +111,17 @@ class DifficultyCalculator {
112
111
  }
113
112
  }
114
113
  }
114
+ /**
115
+ * Obtains the clock rate of the beatmap.
116
+ *
117
+ * @param options The options to obtain the clock rate with.
118
+ * @returns The clock rate of the beatmap.
119
+ */
120
+ calculateClockRate(options) {
121
+ var _a, _b;
122
+ return (osuBase.ModUtil.calculateRateWithMods((_a = options === null || options === void 0 ? void 0 : options.mods) !== null && _a !== void 0 ? _a : []) *
123
+ ((_b = options === null || options === void 0 ? void 0 : options.customSpeedMultiplier) !== null && _b !== void 0 ? _b : 1));
124
+ }
115
125
  /**
116
126
  * Populates the stored difficulty attributes with necessary data.
117
127
  *
@@ -1729,6 +1739,10 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
1729
1739
  get cacheableAttributes() {
1730
1740
  return Object.assign(Object.assign({}, this.attributes), { mods: osuBase.ModUtil.modsToOsuString(this.attributes.mods) });
1731
1741
  }
1742
+ // Override to use DroidDifficultyCalculationOptions
1743
+ calculate(options) {
1744
+ return super.calculate(options);
1745
+ }
1732
1746
  /**
1733
1747
  * Calculates the aim star rating of the beatmap and stores it in this instance.
1734
1748
  */
@@ -1865,6 +1879,10 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
1865
1879
  new DroidVisual(this.mods, false),
1866
1880
  ];
1867
1881
  }
1882
+ calculateClockRate(options) {
1883
+ var _a, _b;
1884
+ return (osuBase.ModUtil.calculateRateWithMods((_a = options === null || options === void 0 ? void 0 : options.mods) !== null && _a !== void 0 ? _a : [], options === null || options === void 0 ? void 0 : options.oldStatistics) * ((_b = options === null || options === void 0 ? void 0 : options.customSpeedMultiplier) !== null && _b !== void 0 ? _b : 1));
1885
+ }
1868
1886
  /**
1869
1887
  * Called after aim skill calculation.
1870
1888
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rian8337/osu-difficulty-calculator",
3
- "version": "4.0.0-beta.26",
3
+ "version": "4.0.0-beta.28",
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.26"
36
+ "@rian8337/osu-base": "^4.0.0-beta.28"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "gitHead": "1c353ee9455d80a5ca8358762f107899d64f1d5e"
41
+ "gitHead": "c442670959e9f766fab6d2e6238d7bb0e40ef869"
42
42
  }
@@ -399,6 +399,13 @@ declare abstract class DifficultyCalculator<THitObject extends DifficultyHitObje
399
399
  * Creates skills to be calculated.
400
400
  */
401
401
  protected abstract createSkills(): Skill[];
402
+ /**
403
+ * Obtains the clock rate of the beatmap.
404
+ *
405
+ * @param options The options to obtain the clock rate with.
406
+ * @returns The clock rate of the beatmap.
407
+ */
408
+ protected calculateClockRate(options?: DifficultyCalculationOptions): number;
402
409
  /**
403
410
  * Populates the stored difficulty attributes with necessary data.
404
411
  *
@@ -828,6 +835,7 @@ declare class DroidDifficultyCalculator extends DifficultyCalculator<DroidDiffic
828
835
  get cacheableAttributes(): CacheableDifficultyAttributes<DroidDifficultyAttributes>;
829
836
  protected readonly difficultyMultiplier = 0.18;
830
837
  protected readonly mode = Modes.droid;
838
+ calculate(options?: DroidDifficultyCalculationOptions): this;
831
839
  /**
832
840
  * Calculates the aim star rating of the beatmap and stores it in this instance.
833
841
  */
@@ -853,6 +861,7 @@ declare class DroidDifficultyCalculator extends DifficultyCalculator<DroidDiffic
853
861
  toString(): string;
854
862
  protected generateDifficultyHitObjects(beatmap: Beatmap, clockRate: number): DroidDifficultyHitObject[];
855
863
  protected createSkills(): DroidSkill[];
864
+ protected calculateClockRate(options?: DroidDifficultyCalculationOptions): number;
856
865
  /**
857
866
  * Called after aim skill calculation.
858
867
  *