@rian8337/osu-rebalance-difficulty-calculator 4.0.0-beta.32 → 4.0.0-beta.39
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 +43 -30
- package/package.json +3 -3
- package/typings/index.d.ts +3 -4
package/dist/index.js
CHANGED
|
@@ -138,13 +138,20 @@ class DifficultyCalculator {
|
|
|
138
138
|
let greatWindow;
|
|
139
139
|
switch (this.mode) {
|
|
140
140
|
case osuBase.Modes.droid:
|
|
141
|
-
|
|
141
|
+
if (this.mods.some((m) => m instanceof osuBase.ModPrecise)) {
|
|
142
|
+
greatWindow = new osuBase.PreciseDroidHitWindow(beatmap.difficulty.od).greatWindow;
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
greatWindow = new osuBase.DroidHitWindow(beatmap.difficulty.od)
|
|
146
|
+
.greatWindow;
|
|
147
|
+
}
|
|
142
148
|
break;
|
|
143
149
|
case osuBase.Modes.osu:
|
|
144
|
-
greatWindow = new osuBase.OsuHitWindow(beatmap.difficulty.od)
|
|
150
|
+
greatWindow = new osuBase.OsuHitWindow(beatmap.difficulty.od)
|
|
151
|
+
.greatWindow;
|
|
145
152
|
break;
|
|
146
153
|
}
|
|
147
|
-
this.attributes.overallDifficulty = osuBase.OsuHitWindow.
|
|
154
|
+
this.attributes.overallDifficulty = osuBase.OsuHitWindow.greatWindowToOD(greatWindow / clockRate);
|
|
148
155
|
}
|
|
149
156
|
/**
|
|
150
157
|
* Calculates the star rating value of a difficulty.
|
|
@@ -177,9 +184,9 @@ class DifficultyHitObject {
|
|
|
177
184
|
* @param lastLastObject The hitobject before the last hitobject.
|
|
178
185
|
* @param difficultyHitObjects All difficulty hitobjects in the processed beatmap.
|
|
179
186
|
* @param clockRate The clock rate of the beatmap.
|
|
180
|
-
* @param greatWindow The great window of the hitobject.
|
|
181
187
|
*/
|
|
182
|
-
constructor(object, lastObject, lastLastObject, difficultyHitObjects, clockRate
|
|
188
|
+
constructor(object, lastObject, lastLastObject, difficultyHitObjects, clockRate) {
|
|
189
|
+
var _a, _b, _c, _d;
|
|
183
190
|
/**
|
|
184
191
|
* The aim strain generated by the hitobject if sliders are considered.
|
|
185
192
|
*/
|
|
@@ -236,7 +243,14 @@ class DifficultyHitObject {
|
|
|
236
243
|
this.lastObject = lastObject;
|
|
237
244
|
this.lastLastObject = lastLastObject;
|
|
238
245
|
this.hitObjects = difficultyHitObjects;
|
|
239
|
-
|
|
246
|
+
if (object instanceof osuBase.Slider) {
|
|
247
|
+
this.fullGreatWindow =
|
|
248
|
+
((_b = (_a = object.head.hitWindow) === null || _a === void 0 ? void 0 : _a.greatWindow) !== null && _b !== void 0 ? _b : 1200) * 2;
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
this.fullGreatWindow = ((_d = (_c = object.hitWindow) === null || _c === void 0 ? void 0 : _c.greatWindow) !== null && _d !== void 0 ? _d : 1200) * 2;
|
|
252
|
+
}
|
|
253
|
+
this.fullGreatWindow /= clockRate;
|
|
240
254
|
this.index = difficultyHitObjects.length - 1;
|
|
241
255
|
// Capped to 25ms to prevent difficulty calculation breaking from simultaneous objects.
|
|
242
256
|
this.startTime = object.startTime / clockRate;
|
|
@@ -1550,10 +1564,9 @@ class DroidDifficultyHitObject extends DifficultyHitObject {
|
|
|
1550
1564
|
* @param lastLastObject The hitobject before the last hitobject.
|
|
1551
1565
|
* @param difficultyHitObjects All difficulty hitobjects in the processed beatmap.
|
|
1552
1566
|
* @param clockRate The clock rate of the beatmap.
|
|
1553
|
-
* @param greatWindow The great window of the hitobject.
|
|
1554
1567
|
*/
|
|
1555
|
-
constructor(object, lastObject, lastLastObject, difficultyHitObjects, clockRate
|
|
1556
|
-
super(object, lastObject, lastLastObject, difficultyHitObjects, clockRate
|
|
1568
|
+
constructor(object, lastObject, lastLastObject, difficultyHitObjects, clockRate) {
|
|
1569
|
+
super(object, lastObject, lastLastObject, difficultyHitObjects, clockRate);
|
|
1557
1570
|
/**
|
|
1558
1571
|
* The tap strain generated by the hitobject.
|
|
1559
1572
|
*/
|
|
@@ -1909,10 +1922,8 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1909
1922
|
var _a, _b;
|
|
1910
1923
|
const difficultyObjects = [];
|
|
1911
1924
|
const { objects } = beatmap.hitObjects;
|
|
1912
|
-
const isPrecise = this.mods.some((m) => m instanceof osuBase.ModPrecise);
|
|
1913
|
-
const greatWindow = new osuBase.DroidHitWindow(beatmap.difficulty.od).hitWindowFor300(isPrecise) / clockRate;
|
|
1914
1925
|
for (let i = 0; i < objects.length; ++i) {
|
|
1915
|
-
const difficultyObject = new DroidDifficultyHitObject(objects[i], (_a = objects[i - 1]) !== null && _a !== void 0 ? _a : null, (_b = objects[i - 2]) !== null && _b !== void 0 ? _b : null, difficultyObjects, clockRate
|
|
1926
|
+
const difficultyObject = new DroidDifficultyHitObject(objects[i], (_a = objects[i - 1]) !== null && _a !== void 0 ? _a : null, (_b = objects[i - 2]) !== null && _b !== void 0 ? _b : null, difficultyObjects, clockRate);
|
|
1916
1927
|
difficultyObject.computeProperties(clockRate, objects);
|
|
1917
1928
|
difficultyObjects.push(difficultyObject);
|
|
1918
1929
|
}
|
|
@@ -2694,14 +2705,11 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2694
2705
|
if (this.totalSuccessfulHits === 0) {
|
|
2695
2706
|
return Number.POSITIVE_INFINITY;
|
|
2696
2707
|
}
|
|
2697
|
-
const
|
|
2698
|
-
|
|
2699
|
-
const
|
|
2700
|
-
const
|
|
2701
|
-
const hitWindow50 =
|
|
2702
|
-
this.difficultyAttributes.clockRate;
|
|
2703
|
-
const hitWindow100 = droidHitWindow.hitWindowFor100(isPrecise) /
|
|
2704
|
-
this.difficultyAttributes.clockRate;
|
|
2708
|
+
const { clockRate } = this.difficultyAttributes;
|
|
2709
|
+
const hitWindow = this.getConvertedHitWindow();
|
|
2710
|
+
const hitWindow300 = hitWindow.greatWindow / clockRate;
|
|
2711
|
+
const hitWindow100 = hitWindow.okWindow / clockRate;
|
|
2712
|
+
const hitWindow50 = hitWindow.mehWindow / clockRate;
|
|
2705
2713
|
const { n100, n50, nmiss } = this.computedAccuracy;
|
|
2706
2714
|
const circleCount = this.difficultyAttributes.hitCircleCount;
|
|
2707
2715
|
const missCountCircles = Math.min(nmiss, circleCount);
|
|
@@ -2765,13 +2773,11 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2765
2773
|
if (this.totalSuccessfulHits === 0) {
|
|
2766
2774
|
return Number.POSITIVE_INFINITY;
|
|
2767
2775
|
}
|
|
2768
|
-
const { speedNoteCount, clockRate
|
|
2769
|
-
const
|
|
2770
|
-
|
|
2771
|
-
const
|
|
2772
|
-
const
|
|
2773
|
-
const hitWindow50 = droidHitWindow.hitWindowFor50(isPrecise) / clockRate;
|
|
2774
|
-
const hitWindow100 = droidHitWindow.hitWindowFor100(isPrecise) / clockRate;
|
|
2776
|
+
const { speedNoteCount, clockRate } = this.difficultyAttributes;
|
|
2777
|
+
const hitWindow = this.getConvertedHitWindow();
|
|
2778
|
+
const hitWindow300 = hitWindow.greatWindow / clockRate;
|
|
2779
|
+
const hitWindow100 = hitWindow.okWindow / clockRate;
|
|
2780
|
+
const hitWindow50 = hitWindow.mehWindow / clockRate;
|
|
2775
2781
|
const { n100, n50, nmiss } = this.computedAccuracy;
|
|
2776
2782
|
// Assume a fixed ratio of non-300s hit in speed notes based on speed note count ratio and OD.
|
|
2777
2783
|
// Graph: https://www.desmos.com/calculator/iskvgjkxr4
|
|
@@ -2819,6 +2825,15 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2819
2825
|
}
|
|
2820
2826
|
return Number.POSITIVE_INFINITY;
|
|
2821
2827
|
}
|
|
2828
|
+
getConvertedHitWindow() {
|
|
2829
|
+
const hitWindow300 = new osuBase.OsuHitWindow(this.difficultyAttributes.overallDifficulty).greatWindow;
|
|
2830
|
+
if (this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModPrecise)) {
|
|
2831
|
+
return new osuBase.PreciseDroidHitWindow(osuBase.PreciseDroidHitWindow.greatWindowToOD(hitWindow300 * this.difficultyAttributes.clockRate));
|
|
2832
|
+
}
|
|
2833
|
+
else {
|
|
2834
|
+
return new osuBase.DroidHitWindow(osuBase.DroidHitWindow.greatWindowToOD(hitWindow300 * this.difficultyAttributes.clockRate));
|
|
2835
|
+
}
|
|
2836
|
+
}
|
|
2822
2837
|
toString() {
|
|
2823
2838
|
return (this.total.toFixed(2) +
|
|
2824
2839
|
" pp (" +
|
|
@@ -3548,10 +3563,8 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3548
3563
|
var _a, _b;
|
|
3549
3564
|
const difficultyObjects = [];
|
|
3550
3565
|
const { objects } = beatmap.hitObjects;
|
|
3551
|
-
const greatWindow = new osuBase.OsuHitWindow(beatmap.difficulty.od).hitWindowFor300() /
|
|
3552
|
-
clockRate;
|
|
3553
3566
|
for (let i = 0; i < objects.length; ++i) {
|
|
3554
|
-
const difficultyObject = new OsuDifficultyHitObject(objects[i], (_a = objects[i - 1]) !== null && _a !== void 0 ? _a : null, (_b = objects[i - 2]) !== null && _b !== void 0 ? _b : null, difficultyObjects, clockRate
|
|
3567
|
+
const difficultyObject = new OsuDifficultyHitObject(objects[i], (_a = objects[i - 1]) !== null && _a !== void 0 ? _a : null, (_b = objects[i - 2]) !== null && _b !== void 0 ? _b : null, difficultyObjects, clockRate);
|
|
3555
3568
|
difficultyObject.computeProperties(clockRate, objects);
|
|
3556
3569
|
difficultyObjects.push(difficultyObject);
|
|
3557
3570
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rian8337/osu-rebalance-difficulty-calculator",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.39",
|
|
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",
|
|
@@ -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.
|
|
36
|
+
"@rian8337/osu-base": "^4.0.0-beta.39"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "6039ff691d968464d4b111e0b5a88775fb055281"
|
|
42
42
|
}
|
package/typings/index.d.ts
CHANGED
|
@@ -216,9 +216,8 @@ declare abstract class DifficultyHitObject {
|
|
|
216
216
|
* @param lastLastObject The hitobject before the last hitobject.
|
|
217
217
|
* @param difficultyHitObjects All difficulty hitobjects in the processed beatmap.
|
|
218
218
|
* @param clockRate The clock rate of the beatmap.
|
|
219
|
-
* @param greatWindow The great window of the hitobject.
|
|
220
219
|
*/
|
|
221
|
-
constructor(object: PlaceableHitObject, lastObject: PlaceableHitObject | null, lastLastObject: PlaceableHitObject | null, difficultyHitObjects: readonly DifficultyHitObject[], clockRate: number
|
|
220
|
+
constructor(object: PlaceableHitObject, lastObject: PlaceableHitObject | null, lastLastObject: PlaceableHitObject | null, difficultyHitObjects: readonly DifficultyHitObject[], clockRate: number);
|
|
222
221
|
/**
|
|
223
222
|
* Computes the properties of this hitobject.
|
|
224
223
|
*
|
|
@@ -630,9 +629,8 @@ declare class DroidDifficultyHitObject extends DifficultyHitObject {
|
|
|
630
629
|
* @param lastLastObject The hitobject before the last hitobject.
|
|
631
630
|
* @param difficultyHitObjects All difficulty hitobjects in the processed beatmap.
|
|
632
631
|
* @param clockRate The clock rate of the beatmap.
|
|
633
|
-
* @param greatWindow The great window of the hitobject.
|
|
634
632
|
*/
|
|
635
|
-
constructor(object: PlaceableHitObject, lastObject: PlaceableHitObject | null, lastLastObject: PlaceableHitObject | null, difficultyHitObjects: readonly DifficultyHitObject[], clockRate: number
|
|
633
|
+
constructor(object: PlaceableHitObject, lastObject: PlaceableHitObject | null, lastLastObject: PlaceableHitObject | null, difficultyHitObjects: readonly DifficultyHitObject[], clockRate: number);
|
|
636
634
|
computeProperties(clockRate: number, hitObjects: readonly PlaceableHitObject[]): void;
|
|
637
635
|
/**
|
|
638
636
|
* Determines whether this hitobject is considered overlapping with the hitobject before it.
|
|
@@ -1258,6 +1256,7 @@ declare class DroidPerformanceCalculator extends PerformanceCalculator<DroidDiff
|
|
|
1258
1256
|
* This is fine though, since this method is only used to scale tap pp.
|
|
1259
1257
|
*/
|
|
1260
1258
|
private calculateTapDeviation;
|
|
1259
|
+
private getConvertedHitWindow;
|
|
1261
1260
|
toString(): string;
|
|
1262
1261
|
}
|
|
1263
1262
|
|