@rian8337/osu-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;
|
|
@@ -1493,10 +1507,9 @@ class DroidDifficultyHitObject extends DifficultyHitObject {
|
|
|
1493
1507
|
* @param lastLastObject The hitobject before the last hitobject.
|
|
1494
1508
|
* @param difficultyHitObjects All difficulty hitobjects in the processed beatmap.
|
|
1495
1509
|
* @param clockRate The clock rate of the beatmap.
|
|
1496
|
-
* @param greatWindow The great window of the hitobject.
|
|
1497
1510
|
*/
|
|
1498
|
-
constructor(object, lastObject, lastLastObject, difficultyHitObjects, clockRate
|
|
1499
|
-
super(object, lastObject, lastLastObject, difficultyHitObjects, clockRate
|
|
1511
|
+
constructor(object, lastObject, lastLastObject, difficultyHitObjects, clockRate) {
|
|
1512
|
+
super(object, lastObject, lastLastObject, difficultyHitObjects, clockRate);
|
|
1500
1513
|
/**
|
|
1501
1514
|
* The tap strain generated by the hitobject.
|
|
1502
1515
|
*/
|
|
@@ -1852,10 +1865,8 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1852
1865
|
var _a, _b;
|
|
1853
1866
|
const difficultyObjects = [];
|
|
1854
1867
|
const { objects } = beatmap.hitObjects;
|
|
1855
|
-
const isPrecise = this.mods.some((m) => m instanceof osuBase.ModPrecise);
|
|
1856
|
-
const greatWindow = new osuBase.DroidHitWindow(beatmap.difficulty.od).hitWindowFor300(isPrecise) / clockRate;
|
|
1857
1868
|
for (let i = 0; i < objects.length; ++i) {
|
|
1858
|
-
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
|
|
1869
|
+
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);
|
|
1859
1870
|
difficultyObject.computeProperties(clockRate, objects);
|
|
1860
1871
|
difficultyObjects.push(difficultyObject);
|
|
1861
1872
|
}
|
|
@@ -2628,14 +2639,11 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2628
2639
|
if (this.totalSuccessfulHits === 0) {
|
|
2629
2640
|
return Number.POSITIVE_INFINITY;
|
|
2630
2641
|
}
|
|
2631
|
-
const
|
|
2632
|
-
|
|
2633
|
-
const
|
|
2634
|
-
const
|
|
2635
|
-
const hitWindow50 =
|
|
2636
|
-
this.difficultyAttributes.clockRate;
|
|
2637
|
-
const hitWindow100 = droidHitWindow.hitWindowFor100(isPrecise) /
|
|
2638
|
-
this.difficultyAttributes.clockRate;
|
|
2642
|
+
const { clockRate } = this.difficultyAttributes;
|
|
2643
|
+
const hitWindow = this.getConvertedHitWindow();
|
|
2644
|
+
const hitWindow300 = hitWindow.greatWindow / clockRate;
|
|
2645
|
+
const hitWindow100 = hitWindow.okWindow / clockRate;
|
|
2646
|
+
const hitWindow50 = hitWindow.mehWindow / clockRate;
|
|
2639
2647
|
const { n100, n50, nmiss } = this.computedAccuracy;
|
|
2640
2648
|
const circleCount = this.difficultyAttributes.hitCircleCount;
|
|
2641
2649
|
const missCountCircles = Math.min(nmiss, circleCount);
|
|
@@ -2699,13 +2707,11 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2699
2707
|
if (this.totalSuccessfulHits === 0) {
|
|
2700
2708
|
return Number.POSITIVE_INFINITY;
|
|
2701
2709
|
}
|
|
2702
|
-
const { speedNoteCount, clockRate
|
|
2703
|
-
const
|
|
2704
|
-
|
|
2705
|
-
const
|
|
2706
|
-
const
|
|
2707
|
-
const hitWindow50 = droidHitWindow.hitWindowFor50(isPrecise) / clockRate;
|
|
2708
|
-
const hitWindow100 = droidHitWindow.hitWindowFor100(isPrecise) / clockRate;
|
|
2710
|
+
const { speedNoteCount, clockRate } = this.difficultyAttributes;
|
|
2711
|
+
const hitWindow = this.getConvertedHitWindow();
|
|
2712
|
+
const hitWindow300 = hitWindow.greatWindow / clockRate;
|
|
2713
|
+
const hitWindow100 = hitWindow.okWindow / clockRate;
|
|
2714
|
+
const hitWindow50 = hitWindow.mehWindow / clockRate;
|
|
2709
2715
|
const { n100, n50, nmiss } = this.computedAccuracy;
|
|
2710
2716
|
// Assume a fixed ratio of non-300s hit in speed notes based on speed note count ratio and OD.
|
|
2711
2717
|
// Graph: https://www.desmos.com/calculator/iskvgjkxr4
|
|
@@ -2753,6 +2759,15 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2753
2759
|
}
|
|
2754
2760
|
return Number.POSITIVE_INFINITY;
|
|
2755
2761
|
}
|
|
2762
|
+
getConvertedHitWindow() {
|
|
2763
|
+
const hitWindow300 = new osuBase.OsuHitWindow(this.difficultyAttributes.overallDifficulty).greatWindow;
|
|
2764
|
+
if (this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModPrecise)) {
|
|
2765
|
+
return new osuBase.PreciseDroidHitWindow(osuBase.PreciseDroidHitWindow.greatWindowToOD(hitWindow300 * this.difficultyAttributes.clockRate));
|
|
2766
|
+
}
|
|
2767
|
+
else {
|
|
2768
|
+
return new osuBase.DroidHitWindow(osuBase.DroidHitWindow.greatWindowToOD(hitWindow300 * this.difficultyAttributes.clockRate));
|
|
2769
|
+
}
|
|
2770
|
+
}
|
|
2756
2771
|
toString() {
|
|
2757
2772
|
return (this.total.toFixed(2) +
|
|
2758
2773
|
" pp (" +
|
|
@@ -3482,10 +3497,8 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3482
3497
|
var _a, _b;
|
|
3483
3498
|
const difficultyObjects = [];
|
|
3484
3499
|
const { objects } = beatmap.hitObjects;
|
|
3485
|
-
const greatWindow = new osuBase.OsuHitWindow(beatmap.difficulty.od).hitWindowFor300() /
|
|
3486
|
-
clockRate;
|
|
3487
3500
|
for (let i = 0; i < objects.length; ++i) {
|
|
3488
|
-
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
|
|
3501
|
+
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);
|
|
3489
3502
|
difficultyObject.computeProperties(clockRate, objects);
|
|
3490
3503
|
difficultyObjects.push(difficultyObject);
|
|
3491
3504
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rian8337/osu-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 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.
|
|
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
|
*
|
|
@@ -617,9 +616,8 @@ declare class DroidDifficultyHitObject extends DifficultyHitObject {
|
|
|
617
616
|
* @param lastLastObject The hitobject before the last hitobject.
|
|
618
617
|
* @param difficultyHitObjects All difficulty hitobjects in the processed beatmap.
|
|
619
618
|
* @param clockRate The clock rate of the beatmap.
|
|
620
|
-
* @param greatWindow The great window of the hitobject.
|
|
621
619
|
*/
|
|
622
|
-
constructor(object: PlaceableHitObject, lastObject: PlaceableHitObject | null, lastLastObject: PlaceableHitObject | null, difficultyHitObjects: readonly DifficultyHitObject[], clockRate: number
|
|
620
|
+
constructor(object: PlaceableHitObject, lastObject: PlaceableHitObject | null, lastLastObject: PlaceableHitObject | null, difficultyHitObjects: readonly DifficultyHitObject[], clockRate: number);
|
|
623
621
|
computeProperties(clockRate: number, hitObjects: readonly PlaceableHitObject[]): void;
|
|
624
622
|
/**
|
|
625
623
|
* Determines whether this hitobject is considered overlapping with the hitobject before it.
|
|
@@ -1244,6 +1242,7 @@ declare class DroidPerformanceCalculator extends PerformanceCalculator<DroidDiff
|
|
|
1244
1242
|
* This is fine though, since this method is only used to scale tap pp.
|
|
1245
1243
|
*/
|
|
1246
1244
|
private calculateTapDeviation;
|
|
1245
|
+
private getConvertedHitWindow;
|
|
1247
1246
|
toString(): string;
|
|
1248
1247
|
}
|
|
1249
1248
|
|