@rian8337/osu-rebalance-difficulty-calculator 4.0.0-beta.24 → 4.0.0-beta.25
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 +215 -159
- package/package.json +3 -3
- package/typings/index.d.ts +28 -28
package/dist/index.js
CHANGED
|
@@ -44,7 +44,6 @@ class DifficultyCalculator {
|
|
|
44
44
|
* @param beatmap The beatmap to calculate. This beatmap will be deep-cloned to prevent reference changes.
|
|
45
45
|
*/
|
|
46
46
|
constructor(beatmap) {
|
|
47
|
-
var _a;
|
|
48
47
|
/**
|
|
49
48
|
* The difficulty objects of the beatmap.
|
|
50
49
|
*/
|
|
@@ -65,7 +64,7 @@ class DifficultyCalculator {
|
|
|
65
64
|
this.beatmap = beatmap;
|
|
66
65
|
this.difficultyStatistics = {
|
|
67
66
|
circleSize: beatmap.difficulty.cs,
|
|
68
|
-
approachRate:
|
|
67
|
+
approachRate: beatmap.difficulty.ar,
|
|
69
68
|
overallDifficulty: beatmap.difficulty.od,
|
|
70
69
|
healthDrain: beatmap.difficulty.hp,
|
|
71
70
|
overallSpeedMultiplier: 1,
|
|
@@ -89,14 +88,14 @@ class DifficultyCalculator {
|
|
|
89
88
|
calculate(options) {
|
|
90
89
|
var _a;
|
|
91
90
|
this.mods = (_a = options === null || options === void 0 ? void 0 : options.mods) !== null && _a !== void 0 ? _a : [];
|
|
92
|
-
const
|
|
91
|
+
const playableBeatmap = this.beatmap.createPlayableBeatmap({
|
|
93
92
|
mode: this.mode,
|
|
94
93
|
mods: this.mods,
|
|
95
94
|
customSpeedMultiplier: options === null || options === void 0 ? void 0 : options.customSpeedMultiplier,
|
|
96
95
|
});
|
|
97
96
|
this.difficultyStatistics = Object.seal(this.computeDifficultyStatistics(options));
|
|
98
97
|
this.populateDifficultyAttributes();
|
|
99
|
-
this.objects.push(...this.generateDifficultyHitObjects(
|
|
98
|
+
this.objects.push(...this.generateDifficultyHitObjects(playableBeatmap));
|
|
100
99
|
this.calculateAll();
|
|
101
100
|
return this;
|
|
102
101
|
}
|
|
@@ -159,8 +158,9 @@ class DifficultyHitObject {
|
|
|
159
158
|
* @param lastLastObject The hitobject before the last hitobject.
|
|
160
159
|
* @param difficultyHitObjects All difficulty hitobjects in the processed beatmap.
|
|
161
160
|
* @param clockRate The clock rate of the beatmap.
|
|
161
|
+
* @param greatWindow The great window of the hitobject.
|
|
162
162
|
*/
|
|
163
|
-
constructor(object, lastObject, lastLastObject, difficultyHitObjects, clockRate) {
|
|
163
|
+
constructor(object, lastObject, lastLastObject, difficultyHitObjects, clockRate, greatWindow) {
|
|
164
164
|
/**
|
|
165
165
|
* The aim strain generated by the hitobject if sliders are considered.
|
|
166
166
|
*/
|
|
@@ -213,18 +213,18 @@ class DifficultyHitObject {
|
|
|
213
213
|
this.normalizedRadius = 50;
|
|
214
214
|
this.maximumSliderRadius = this.normalizedRadius * 2.4;
|
|
215
215
|
this.assumedSliderRadius = this.normalizedRadius * 1.8;
|
|
216
|
-
this.minDeltaTime = 25;
|
|
217
216
|
this.object = object;
|
|
218
217
|
this.lastObject = lastObject;
|
|
219
218
|
this.lastLastObject = lastLastObject;
|
|
220
219
|
this.hitObjects = difficultyHitObjects;
|
|
220
|
+
this.fullGreatWindow = greatWindow * 2;
|
|
221
221
|
this.index = difficultyHitObjects.length - 1;
|
|
222
222
|
// Capped to 25ms to prevent difficulty calculation breaking from simultaneous objects.
|
|
223
223
|
this.startTime = object.startTime / clockRate;
|
|
224
224
|
this.endTime = object.endTime / clockRate;
|
|
225
225
|
if (lastObject) {
|
|
226
226
|
this.deltaTime = this.startTime - lastObject.startTime / clockRate;
|
|
227
|
-
this.strainTime = Math.max(this.deltaTime,
|
|
227
|
+
this.strainTime = Math.max(this.deltaTime, DifficultyHitObject.minDeltaTime);
|
|
228
228
|
}
|
|
229
229
|
else {
|
|
230
230
|
this.deltaTime = 0;
|
|
@@ -295,6 +295,24 @@ class DifficultyHitObject {
|
|
|
295
295
|
}
|
|
296
296
|
return osuBase.MathUtils.clamp((time - fadeInStartTime) / fadeInDuration, 0, 1);
|
|
297
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* How possible is it to doubletap this object together with the next one and get perfect
|
|
300
|
+
* judgement in range from 0 to 1.
|
|
301
|
+
*
|
|
302
|
+
* A value closer to 1 indicates a higher possibility.
|
|
303
|
+
*/
|
|
304
|
+
get doubletapness() {
|
|
305
|
+
const next = this.next(0);
|
|
306
|
+
if (!next) {
|
|
307
|
+
return 0;
|
|
308
|
+
}
|
|
309
|
+
const currentDeltaTime = Math.max(1, this.deltaTime);
|
|
310
|
+
const nextDeltaTime = Math.max(1, next.deltaTime);
|
|
311
|
+
const deltaDifference = Math.abs(nextDeltaTime - currentDeltaTime);
|
|
312
|
+
const speedRatio = currentDeltaTime / Math.max(currentDeltaTime, deltaDifference);
|
|
313
|
+
const windowRatio = Math.pow(Math.min(1, currentDeltaTime / this.fullGreatWindow), 2);
|
|
314
|
+
return 1 - Math.pow(speedRatio, 1 - windowRatio);
|
|
315
|
+
}
|
|
298
316
|
setDistances(clockRate) {
|
|
299
317
|
if (this.object instanceof osuBase.Slider) {
|
|
300
318
|
this.calculateSliderCursorPosition(this.object);
|
|
@@ -306,7 +324,7 @@ class DifficultyHitObject {
|
|
|
306
324
|
else {
|
|
307
325
|
this.travelDistance *= Math.pow(1 + this.object.repeatCount / 2.5, 1 / 2.5);
|
|
308
326
|
}
|
|
309
|
-
this.travelTime = Math.max(this.object.lazyTravelTime / clockRate,
|
|
327
|
+
this.travelTime = Math.max(this.object.lazyTravelTime / clockRate, DifficultyHitObject.minDeltaTime);
|
|
310
328
|
}
|
|
311
329
|
// We don't need to calculate either angle or distance when one of the last->curr objects is a spinner.
|
|
312
330
|
if (!this.lastObject ||
|
|
@@ -324,8 +342,8 @@ class DifficultyHitObject {
|
|
|
324
342
|
this.minimumJumpTime = this.strainTime;
|
|
325
343
|
this.minimumJumpDistance = this.lazyJumpDistance;
|
|
326
344
|
if (this.lastObject instanceof osuBase.Slider) {
|
|
327
|
-
const lastTravelTime = Math.max(this.lastObject.lazyTravelTime / clockRate,
|
|
328
|
-
this.minimumJumpTime = Math.max(this.strainTime - lastTravelTime,
|
|
345
|
+
const lastTravelTime = Math.max(this.lastObject.lazyTravelTime / clockRate, DifficultyHitObject.minDeltaTime);
|
|
346
|
+
this.minimumJumpTime = Math.max(this.strainTime - lastTravelTime, DifficultyHitObject.minDeltaTime);
|
|
329
347
|
// There are two types of slider-to-object patterns to consider in order to better approximate the real movement a player will take to jump between the hitobjects.
|
|
330
348
|
//
|
|
331
349
|
// 1. The anti-flow pattern, where players cut the slider short in order to move to the next hitobject.
|
|
@@ -440,6 +458,10 @@ class DifficultyHitObject {
|
|
|
440
458
|
return pos;
|
|
441
459
|
}
|
|
442
460
|
}
|
|
461
|
+
/**
|
|
462
|
+
* The lowest possible delta time value.
|
|
463
|
+
*/
|
|
464
|
+
DifficultyHitObject.minDeltaTime = 25;
|
|
443
465
|
|
|
444
466
|
/**
|
|
445
467
|
* An evaluator for calculating osu!droid Aim skill.
|
|
@@ -604,10 +626,11 @@ class DroidAimEvaluator extends AimEvaluator {
|
|
|
604
626
|
const shortDistancePenalty = Math.min(1, Math.pow(distance / this.singleSpacingThreshold, 3.5));
|
|
605
627
|
let adjustedDistanceScale = 1;
|
|
606
628
|
// Reward for inconsistent angles while punishing consistent ones.
|
|
629
|
+
// Only apply the adjustment to patterns with the same delta time.
|
|
607
630
|
// Graph: https://www.desmos.com/calculator/soomupyfwp
|
|
608
631
|
if (current.angle !== null &&
|
|
609
632
|
typeof (prev === null || prev === void 0 ? void 0 : prev.angle) === "number" &&
|
|
610
|
-
current.
|
|
633
|
+
Math.abs(current.deltaTime - prev.deltaTime) < 10) {
|
|
611
634
|
const angleDiff = Math.abs(current.angle - prev.angle);
|
|
612
635
|
const adjustedAngleDiff = Math.sin(angleDiff / 2) * 180;
|
|
613
636
|
const angularVelocity = adjustedAngleDiff / (0.1 + current.strainTime);
|
|
@@ -862,31 +885,18 @@ class DroidTapEvaluator extends SpeedEvaluator {
|
|
|
862
885
|
* - and the strain time cap.
|
|
863
886
|
*
|
|
864
887
|
* @param current The current object.
|
|
865
|
-
* @param greatWindow The great hit window of the current object.
|
|
866
888
|
* @param considerCheesability Whether to consider cheesability.
|
|
867
889
|
* @param strainTimeCap The strain time to cap the object's strain time to.
|
|
868
890
|
*/
|
|
869
|
-
static evaluateDifficultyOf(current,
|
|
891
|
+
static evaluateDifficultyOf(current, considerCheesability, strainTimeCap) {
|
|
870
892
|
if (current.object instanceof osuBase.Spinner ||
|
|
871
893
|
// Exclude overlapping objects that can be tapped at once.
|
|
872
894
|
current.isOverlapping(false)) {
|
|
873
895
|
return 0;
|
|
874
896
|
}
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
const next = current.next(0);
|
|
879
|
-
if (next) {
|
|
880
|
-
const greatWindowFull = greatWindow * 2;
|
|
881
|
-
const currentDeltaTime = Math.max(1, current.deltaTime);
|
|
882
|
-
const nextDeltaTime = Math.max(1, next.deltaTime);
|
|
883
|
-
const deltaDifference = Math.abs(nextDeltaTime - currentDeltaTime);
|
|
884
|
-
const speedRatio = currentDeltaTime /
|
|
885
|
-
Math.max(currentDeltaTime, deltaDifference);
|
|
886
|
-
const windowRatio = Math.pow(Math.min(1, currentDeltaTime / greatWindowFull), 2);
|
|
887
|
-
doubletapness = Math.pow(speedRatio, 1 - windowRatio);
|
|
888
|
-
}
|
|
889
|
-
}
|
|
897
|
+
const doubletapness = considerCheesability
|
|
898
|
+
? 1 - current.doubletapness
|
|
899
|
+
: 1;
|
|
890
900
|
const strainTime = strainTimeCap !== undefined
|
|
891
901
|
? // We cap the strain time to 50 here as the chance of vibro is higher in any BPM higher than 300.
|
|
892
902
|
Math.max(50, strainTimeCap, current.strainTime)
|
|
@@ -911,7 +921,7 @@ class DroidTap extends DroidSkill {
|
|
|
911
921
|
get objectDeltaTimes() {
|
|
912
922
|
return this._objectDeltaTimes;
|
|
913
923
|
}
|
|
914
|
-
constructor(mods,
|
|
924
|
+
constructor(mods, considerCheesability, strainTimeCap) {
|
|
915
925
|
super(mods);
|
|
916
926
|
this.reducedSectionCount = 10;
|
|
917
927
|
this.reducedSectionBaseline = 0.75;
|
|
@@ -922,7 +932,6 @@ class DroidTap extends DroidSkill {
|
|
|
922
932
|
this.currentRhythmMultiplier = 0;
|
|
923
933
|
this.skillMultiplier = 1375;
|
|
924
934
|
this._objectDeltaTimes = [];
|
|
925
|
-
this.greatWindow = new osuBase.OsuHitWindow(overallDifficulty).hitWindowFor300();
|
|
926
935
|
this.considerCheesability = considerCheesability;
|
|
927
936
|
this.strainTimeCap = strainTimeCap;
|
|
928
937
|
}
|
|
@@ -961,7 +970,7 @@ class DroidTap extends DroidSkill {
|
|
|
961
970
|
strainValueAt(current) {
|
|
962
971
|
this.currentTapStrain *= this.strainDecay(current.strainTime);
|
|
963
972
|
this.currentTapStrain +=
|
|
964
|
-
DroidTapEvaluator.evaluateDifficultyOf(current, this.
|
|
973
|
+
DroidTapEvaluator.evaluateDifficultyOf(current, this.considerCheesability, this.strainTimeCap) * this.skillMultiplier;
|
|
965
974
|
this.currentRhythmMultiplier = current.rhythmMultiplier;
|
|
966
975
|
this._objectDeltaTimes.push(current.deltaTime);
|
|
967
976
|
return this.currentTapStrain * current.rhythmMultiplier;
|
|
@@ -1145,6 +1154,46 @@ class RhythmEvaluator {
|
|
|
1145
1154
|
RhythmEvaluator.rhythmMultiplier = 0.75;
|
|
1146
1155
|
RhythmEvaluator.historyTimeMax = 5000; // 5 seconds of calculateRhythmBonus max.
|
|
1147
1156
|
|
|
1157
|
+
class Island {
|
|
1158
|
+
constructor(firstDelta, epsilon) {
|
|
1159
|
+
this.deltas = [];
|
|
1160
|
+
if (epsilon === undefined) {
|
|
1161
|
+
this.deltaDifferenceEpsilon = firstDelta;
|
|
1162
|
+
return;
|
|
1163
|
+
}
|
|
1164
|
+
this.deltaDifferenceEpsilon = epsilon;
|
|
1165
|
+
this.addDelta(firstDelta);
|
|
1166
|
+
}
|
|
1167
|
+
addDelta(delta) {
|
|
1168
|
+
// Convert to integer
|
|
1169
|
+
delta = Math.trunc(delta);
|
|
1170
|
+
const existingDelta = this.deltas.find((v) => Math.abs(v - delta) >= this.deltaDifferenceEpsilon);
|
|
1171
|
+
this.deltas.push(existingDelta !== null && existingDelta !== void 0 ? existingDelta : delta);
|
|
1172
|
+
}
|
|
1173
|
+
get averageDelta() {
|
|
1174
|
+
return this.deltas.length > 0
|
|
1175
|
+
? Math.max(this.deltas.reduce((a, b) => a + b) / this.deltas.length, DifficultyHitObject.minDeltaTime)
|
|
1176
|
+
: 0;
|
|
1177
|
+
}
|
|
1178
|
+
isSimilarPolarity(other) {
|
|
1179
|
+
// Consider islands to be of similar polarity only if they're having the same
|
|
1180
|
+
// average delta (we don't want to consider 3 singletaps similar to a triple)
|
|
1181
|
+
return (Math.abs(this.averageDelta - other.averageDelta) <
|
|
1182
|
+
this.deltaDifferenceEpsilon &&
|
|
1183
|
+
this.deltas.length % 2 === other.deltas.length % 2);
|
|
1184
|
+
}
|
|
1185
|
+
equals(other) {
|
|
1186
|
+
if (this.deltas.length !== other.deltas.length) {
|
|
1187
|
+
return false;
|
|
1188
|
+
}
|
|
1189
|
+
for (let i = 0; i < this.deltas.length; ++i) {
|
|
1190
|
+
if (this.deltas[i] !== other.deltas[i]) {
|
|
1191
|
+
return false;
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
return true;
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1148
1197
|
/**
|
|
1149
1198
|
* An evaluator for calculating osu!droid Rhythm skill.
|
|
1150
1199
|
*/
|
|
@@ -1154,22 +1203,23 @@ class DroidRhythmEvaluator extends RhythmEvaluator {
|
|
|
1154
1203
|
* with historic data of the current object.
|
|
1155
1204
|
*
|
|
1156
1205
|
* @param current The current object.
|
|
1157
|
-
* @param greatWindow The great hit window of the current object.
|
|
1158
1206
|
*/
|
|
1159
|
-
static evaluateDifficultyOf(current
|
|
1207
|
+
static evaluateDifficultyOf(current) {
|
|
1160
1208
|
if (current.object instanceof osuBase.Spinner ||
|
|
1161
1209
|
// Exclude overlapping objects that can be tapped at once.
|
|
1162
1210
|
current.isOverlapping(false)) {
|
|
1163
1211
|
return 1;
|
|
1164
1212
|
}
|
|
1165
|
-
|
|
1213
|
+
const deltaDifferenceEpsilon = current.fullGreatWindow * 0.3;
|
|
1166
1214
|
let rhythmComplexitySum = 0;
|
|
1167
|
-
let
|
|
1215
|
+
let island = new Island(deltaDifferenceEpsilon);
|
|
1216
|
+
let previousIsland = new Island(deltaDifferenceEpsilon);
|
|
1217
|
+
const islandCounts = new Map();
|
|
1168
1218
|
// Store the ratio of the current start of an island to buff for tighter rhythms.
|
|
1169
1219
|
let startRatio = 0;
|
|
1170
1220
|
let firstDeltaSwitch = false;
|
|
1171
1221
|
let rhythmStart = 0;
|
|
1172
|
-
const historicalNoteCount = Math.min(current.index,
|
|
1222
|
+
const historicalNoteCount = Math.min(current.index, this.historyObjectsMax);
|
|
1173
1223
|
// Exclude overlapping objects that can be tapped at once.
|
|
1174
1224
|
const validPrevious = [];
|
|
1175
1225
|
for (let i = 0; i < historicalNoteCount; ++i) {
|
|
@@ -1193,105 +1243,125 @@ class DroidRhythmEvaluator extends RhythmEvaluator {
|
|
|
1193
1243
|
this.historyTimeMax;
|
|
1194
1244
|
// Either we're limited by time or limited by object count.
|
|
1195
1245
|
currentHistoricalDecay = Math.min(currentHistoricalDecay, (validPrevious.length - i) / validPrevious.length);
|
|
1196
|
-
const
|
|
1197
|
-
const
|
|
1198
|
-
const
|
|
1246
|
+
const currentObject = validPrevious[i - 1];
|
|
1247
|
+
const prevObject = validPrevious[i];
|
|
1248
|
+
const lastObject = validPrevious[i + 1];
|
|
1249
|
+
const currentDelta = currentObject.strainTime;
|
|
1250
|
+
const prevDelta = prevObject.strainTime;
|
|
1251
|
+
const lastDelta = lastObject.strainTime;
|
|
1199
1252
|
const currentRatio = 1 +
|
|
1200
|
-
|
|
1253
|
+
10 *
|
|
1201
1254
|
Math.min(0.5, Math.pow(Math.sin(Math.PI /
|
|
1202
1255
|
(Math.min(prevDelta, currentDelta) /
|
|
1203
1256
|
Math.max(prevDelta, currentDelta))), 2));
|
|
1204
|
-
const windowPenalty =
|
|
1205
|
-
|
|
1257
|
+
const windowPenalty = osuBase.MathUtils.clamp((Math.abs(prevDelta - currentDelta) - deltaDifferenceEpsilon) /
|
|
1258
|
+
deltaDifferenceEpsilon, 0, 1);
|
|
1206
1259
|
let effectiveRatio = windowPenalty * currentRatio;
|
|
1207
1260
|
if (firstDeltaSwitch) {
|
|
1208
|
-
if (prevDelta
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
++islandSize;
|
|
1261
|
+
if (Math.abs(prevDelta - currentDelta) <= deltaDifferenceEpsilon) {
|
|
1262
|
+
if (island.deltas.length < this.maxIslandSize) {
|
|
1263
|
+
// Island is still progressing.
|
|
1264
|
+
island.addDelta(currentDelta);
|
|
1213
1265
|
}
|
|
1214
1266
|
}
|
|
1215
1267
|
else {
|
|
1216
|
-
|
|
1217
|
-
|
|
1268
|
+
// BPM change is into slider, this is easy acc window.
|
|
1269
|
+
if (currentObject.object instanceof osuBase.Slider) {
|
|
1218
1270
|
effectiveRatio /= 8;
|
|
1219
1271
|
}
|
|
1220
|
-
|
|
1221
|
-
|
|
1272
|
+
// BPM change was from a slider, this is typically easier than circle -> circle.
|
|
1273
|
+
// Unintentional side effect is that bursts with kicksliders at the ends might
|
|
1274
|
+
// have lower difficulty than bursts without sliders.
|
|
1275
|
+
if (prevObject.object instanceof osuBase.Slider) {
|
|
1222
1276
|
effectiveRatio /= 4;
|
|
1223
1277
|
}
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
effectiveRatio
|
|
1278
|
+
// Repeated island polarity (2 -> 4, 3 -> 5).
|
|
1279
|
+
if (island.isSimilarPolarity(previousIsland)) {
|
|
1280
|
+
effectiveRatio *= 0.3;
|
|
1227
1281
|
}
|
|
1228
|
-
|
|
1229
|
-
|
|
1282
|
+
// Previous increase happened a note ago.
|
|
1283
|
+
// Albeit this is a 1/1 -> 1/2-1/4 type of transition, we don't want to buff this.
|
|
1284
|
+
if (lastDelta > prevDelta + deltaDifferenceEpsilon &&
|
|
1285
|
+
prevDelta > currentDelta + deltaDifferenceEpsilon) {
|
|
1286
|
+
effectiveRatio /= 8;
|
|
1287
|
+
}
|
|
1288
|
+
// Singletaps are easier to control.
|
|
1289
|
+
if (island.deltas.length === 1) {
|
|
1230
1290
|
effectiveRatio /= 2;
|
|
1231
1291
|
}
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1292
|
+
let islandFound = false;
|
|
1293
|
+
for (const [currentIsland, count] of islandCounts) {
|
|
1294
|
+
if (!island.equals(currentIsland)) {
|
|
1295
|
+
continue;
|
|
1296
|
+
}
|
|
1297
|
+
islandFound = true;
|
|
1298
|
+
let islandCount = count;
|
|
1299
|
+
if (previousIsland.equals(island)) {
|
|
1300
|
+
// Only add island to island counts if they're going one after another.
|
|
1301
|
+
++islandCount;
|
|
1302
|
+
islandCounts.set(currentIsland, islandCount);
|
|
1303
|
+
}
|
|
1304
|
+
// Repeated island (ex: triplet -> triplet).
|
|
1305
|
+
// Graph: https://www.desmos.com/calculator/pj7an56zwf
|
|
1306
|
+
effectiveRatio *= Math.min(1 / islandCount, Math.pow(1 / islandCount, 4 /
|
|
1307
|
+
(1 +
|
|
1308
|
+
Math.exp(10 - 0.165 * island.averageDelta))));
|
|
1309
|
+
break;
|
|
1237
1310
|
}
|
|
1311
|
+
if (!islandFound) {
|
|
1312
|
+
islandCounts.set(island, 1);
|
|
1313
|
+
}
|
|
1314
|
+
// Scale down the difficulty if the object is doubletappable.
|
|
1315
|
+
effectiveRatio *= 1 - prevObject.doubletapness * 0.75;
|
|
1238
1316
|
rhythmComplexitySum +=
|
|
1239
|
-
|
|
1240
|
-
currentHistoricalDecay
|
|
1241
|
-
Math.sqrt(4 + islandSize)) /
|
|
1242
|
-
2) *
|
|
1243
|
-
Math.sqrt(4 + previousIslandSize)) /
|
|
1244
|
-
2;
|
|
1317
|
+
Math.sqrt(effectiveRatio * startRatio) *
|
|
1318
|
+
currentHistoricalDecay;
|
|
1245
1319
|
startRatio = effectiveRatio;
|
|
1246
|
-
|
|
1247
|
-
if (prevDelta
|
|
1320
|
+
previousIsland = island;
|
|
1321
|
+
if (prevDelta + deltaDifferenceEpsilon < currentDelta) {
|
|
1248
1322
|
// We're slowing down, stop counting.
|
|
1249
1323
|
// If we're speeding up, this stays as is and we keep counting island size.
|
|
1250
1324
|
firstDeltaSwitch = false;
|
|
1251
1325
|
}
|
|
1252
|
-
|
|
1326
|
+
island = new Island(Math.trunc(currentDelta), deltaDifferenceEpsilon);
|
|
1253
1327
|
}
|
|
1254
1328
|
}
|
|
1255
|
-
else if (prevDelta >
|
|
1256
|
-
// We
|
|
1329
|
+
else if (prevDelta > deltaDifferenceEpsilon + currentDelta) {
|
|
1330
|
+
// We're speeding up.
|
|
1257
1331
|
// Begin counting island until we change speed again.
|
|
1258
1332
|
firstDeltaSwitch = true;
|
|
1333
|
+
// Reduce ratio if we're starting after a slider.
|
|
1334
|
+
if (prevObject.object instanceof osuBase.Slider) {
|
|
1335
|
+
effectiveRatio *= 0.3;
|
|
1336
|
+
}
|
|
1259
1337
|
startRatio = effectiveRatio;
|
|
1260
|
-
|
|
1338
|
+
island = new Island(Math.trunc(currentDelta), deltaDifferenceEpsilon);
|
|
1261
1339
|
}
|
|
1262
1340
|
}
|
|
1263
|
-
|
|
1264
|
-
const next = current.next(0);
|
|
1265
|
-
let doubletapness = 1;
|
|
1266
|
-
if (next) {
|
|
1267
|
-
const currentDeltaTime = Math.max(1, current.deltaTime);
|
|
1268
|
-
const nextDeltaTime = Math.max(1, next.deltaTime);
|
|
1269
|
-
const deltaDifference = Math.abs(nextDeltaTime - currentDeltaTime);
|
|
1270
|
-
const speedRatio = currentDeltaTime / Math.max(currentDeltaTime, deltaDifference);
|
|
1271
|
-
const windowRatio = Math.pow(Math.min(1, currentDeltaTime / (greatWindow * 2)), 2);
|
|
1272
|
-
doubletapness = Math.pow(speedRatio, 1 - windowRatio);
|
|
1273
|
-
}
|
|
1274
|
-
return (Math.sqrt(4 + rhythmComplexitySum * this.rhythmMultiplier * doubletapness) / 2);
|
|
1341
|
+
return Math.sqrt(4 + rhythmComplexitySum * this.rhythmMultiplier) / 2;
|
|
1275
1342
|
}
|
|
1276
1343
|
}
|
|
1344
|
+
DroidRhythmEvaluator.rhythmMultiplier = 1.2;
|
|
1345
|
+
DroidRhythmEvaluator.historyTimeMax = 4000;
|
|
1346
|
+
DroidRhythmEvaluator.maxIslandSize = 7;
|
|
1347
|
+
DroidRhythmEvaluator.historyObjectsMax = 24;
|
|
1277
1348
|
|
|
1278
1349
|
/**
|
|
1279
1350
|
* Represents the skill required to properly follow a beatmap's rhythm.
|
|
1280
1351
|
*/
|
|
1281
1352
|
class DroidRhythm extends DroidSkill {
|
|
1282
|
-
constructor(
|
|
1283
|
-
super(
|
|
1353
|
+
constructor() {
|
|
1354
|
+
super(...arguments);
|
|
1284
1355
|
this.reducedSectionCount = 5;
|
|
1285
1356
|
this.reducedSectionBaseline = 0.75;
|
|
1286
1357
|
this.strainDecayBase = 0.3;
|
|
1287
1358
|
this.starsPerDouble = 1.75;
|
|
1288
1359
|
this.currentRhythmStrain = 0;
|
|
1289
1360
|
this.currentRhythmMultiplier = 1;
|
|
1290
|
-
this.hitWindow = new osuBase.OsuHitWindow(overallDifficulty);
|
|
1291
1361
|
}
|
|
1292
1362
|
strainValueAt(current) {
|
|
1293
1363
|
this.currentRhythmMultiplier =
|
|
1294
|
-
DroidRhythmEvaluator.evaluateDifficultyOf(current
|
|
1364
|
+
DroidRhythmEvaluator.evaluateDifficultyOf(current);
|
|
1295
1365
|
this.currentRhythmStrain *= this.strainDecay(current.deltaTime);
|
|
1296
1366
|
this.currentRhythmStrain += this.currentRhythmMultiplier - 1;
|
|
1297
1367
|
return this.currentRhythmStrain;
|
|
@@ -1475,10 +1545,11 @@ class DroidDifficultyHitObject extends DifficultyHitObject {
|
|
|
1475
1545
|
* @param lastLastObject The hitobject before the last hitobject.
|
|
1476
1546
|
* @param difficultyHitObjects All difficulty hitobjects in the processed beatmap.
|
|
1477
1547
|
* @param clockRate The clock rate of the beatmap.
|
|
1548
|
+
* @param greatWindow The great window of the hitobject.
|
|
1478
1549
|
* @param isForceAR Whether force AR is enabled.
|
|
1479
1550
|
*/
|
|
1480
|
-
constructor(object, lastObject, lastLastObject, difficultyHitObjects, clockRate, isForceAR) {
|
|
1481
|
-
super(object, lastObject, lastLastObject, difficultyHitObjects, clockRate);
|
|
1551
|
+
constructor(object, lastObject, lastLastObject, difficultyHitObjects, clockRate, greatWindow, isForceAR) {
|
|
1552
|
+
super(object, lastObject, lastLastObject, difficultyHitObjects, clockRate, greatWindow);
|
|
1482
1553
|
/**
|
|
1483
1554
|
* The tap strain generated by the hitobject.
|
|
1484
1555
|
*/
|
|
@@ -1617,7 +1688,9 @@ class DroidDifficultyHitObject extends DifficultyHitObject {
|
|
|
1617
1688
|
Math.max(0, 1 - distance / (2.5 * this.object.radius)) *
|
|
1618
1689
|
(7.5 /
|
|
1619
1690
|
(1 +
|
|
1620
|
-
Math.exp(0.15 *
|
|
1691
|
+
Math.exp(0.15 *
|
|
1692
|
+
(Math.max(deltaTime, DifficultyHitObject.minDeltaTime) -
|
|
1693
|
+
75))));
|
|
1621
1694
|
}
|
|
1622
1695
|
}
|
|
1623
1696
|
|
|
@@ -1729,11 +1802,10 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1729
1802
|
* Calculates the tap star rating of the beatmap and stores it in this instance.
|
|
1730
1803
|
*/
|
|
1731
1804
|
calculateTap() {
|
|
1732
|
-
const
|
|
1733
|
-
const
|
|
1734
|
-
const tapSkillNoCheese = new DroidTap(this.mods, od, false);
|
|
1805
|
+
const tapSkillCheese = new DroidTap(this.mods, true);
|
|
1806
|
+
const tapSkillNoCheese = new DroidTap(this.mods, false);
|
|
1735
1807
|
this.calculateSkills(tapSkillCheese, tapSkillNoCheese);
|
|
1736
|
-
const tapSkillVibro = new DroidTap(this.mods,
|
|
1808
|
+
const tapSkillVibro = new DroidTap(this.mods, true, tapSkillCheese.relevantDeltaTime());
|
|
1737
1809
|
this.calculateSkills(tapSkillVibro);
|
|
1738
1810
|
this.postCalculateTap(tapSkillCheese, tapSkillVibro);
|
|
1739
1811
|
}
|
|
@@ -1741,7 +1813,7 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1741
1813
|
* Calculates the rhythm star rating of the beatmap and stores it in this instance.
|
|
1742
1814
|
*/
|
|
1743
1815
|
calculateRhythm() {
|
|
1744
|
-
const rhythmSkill = new DroidRhythm(this.mods
|
|
1816
|
+
const rhythmSkill = new DroidRhythm(this.mods);
|
|
1745
1817
|
this.calculateSkills(rhythmSkill);
|
|
1746
1818
|
this.postCalculateRhythm(rhythmSkill);
|
|
1747
1819
|
}
|
|
@@ -1801,7 +1873,7 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1801
1873
|
const flashlightSkillWithoutSliders = skills[6];
|
|
1802
1874
|
const visualSkill = skills[7];
|
|
1803
1875
|
const visualSkillWithoutSliders = skills[8];
|
|
1804
|
-
const tapSkillVibro = new DroidTap(this.mods,
|
|
1876
|
+
const tapSkillVibro = new DroidTap(this.mods, true, tapSkillCheese.relevantDeltaTime());
|
|
1805
1877
|
this.calculateSkills(tapSkillVibro);
|
|
1806
1878
|
this.postCalculateAim(aimSkill, aimSkillWithoutSliders);
|
|
1807
1879
|
this.postCalculateTap(tapSkillCheese, tapSkillVibro);
|
|
@@ -1829,19 +1901,19 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1829
1901
|
const difficultyObjects = [];
|
|
1830
1902
|
const { objects } = convertedBeatmap.hitObjects;
|
|
1831
1903
|
const difficultyAdjustMod = this.mods.find((m) => m instanceof osuBase.ModDifficultyAdjust);
|
|
1904
|
+
const greatWindow = new osuBase.OsuHitWindow(this.difficultyStatistics.overallDifficulty).hitWindowFor300();
|
|
1832
1905
|
for (let i = 0; i < objects.length; ++i) {
|
|
1833
|
-
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, this.difficultyStatistics.overallSpeedMultiplier, (difficultyAdjustMod === null || difficultyAdjustMod === void 0 ? void 0 : difficultyAdjustMod.ar) !== undefined);
|
|
1906
|
+
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, this.difficultyStatistics.overallSpeedMultiplier, greatWindow, (difficultyAdjustMod === null || difficultyAdjustMod === void 0 ? void 0 : difficultyAdjustMod.ar) !== undefined);
|
|
1834
1907
|
difficultyObject.computeProperties(this.difficultyStatistics.overallSpeedMultiplier, objects);
|
|
1835
1908
|
difficultyObjects.push(difficultyObject);
|
|
1836
1909
|
}
|
|
1837
1910
|
return difficultyObjects;
|
|
1838
1911
|
}
|
|
1839
1912
|
computeDifficultyStatistics(options) {
|
|
1840
|
-
var _a;
|
|
1841
1913
|
const { difficulty } = this.beatmap;
|
|
1842
1914
|
return osuBase.calculateDroidDifficultyStatistics({
|
|
1843
1915
|
circleSize: difficulty.cs,
|
|
1844
|
-
approachRate:
|
|
1916
|
+
approachRate: difficulty.ar,
|
|
1845
1917
|
overallDifficulty: difficulty.od,
|
|
1846
1918
|
healthDrain: difficulty.hp,
|
|
1847
1919
|
mods: this.mods,
|
|
@@ -1850,16 +1922,15 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1850
1922
|
});
|
|
1851
1923
|
}
|
|
1852
1924
|
createSkills() {
|
|
1853
|
-
const od = this.difficultyStatistics.overallDifficulty;
|
|
1854
1925
|
return [
|
|
1855
1926
|
new DroidAim(this.mods, true),
|
|
1856
1927
|
new DroidAim(this.mods, false),
|
|
1857
1928
|
// Tap skill depends on rhythm skill, so we put it first
|
|
1858
|
-
new DroidRhythm(this.mods
|
|
1929
|
+
new DroidRhythm(this.mods),
|
|
1859
1930
|
// Cheesability tap
|
|
1860
|
-
new DroidTap(this.mods,
|
|
1931
|
+
new DroidTap(this.mods, true),
|
|
1861
1932
|
// Non-cheesability tap
|
|
1862
|
-
new DroidTap(this.mods,
|
|
1933
|
+
new DroidTap(this.mods, false),
|
|
1863
1934
|
new DroidFlashlight(this.mods, true),
|
|
1864
1935
|
new DroidFlashlight(this.mods, false),
|
|
1865
1936
|
new DroidVisual(this.mods, true),
|
|
@@ -1876,8 +1947,9 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1876
1947
|
this.strainPeaks.aimWithSliders = aimSkill.strainPeaks;
|
|
1877
1948
|
this.strainPeaks.aimWithoutSliders = aimSkillWithoutSliders.strainPeaks;
|
|
1878
1949
|
const retryabilityScaling = this.calculateRetryabilityScaling(aimSkill.countRetryability());
|
|
1879
|
-
this.attributes.aimDifficulty =
|
|
1880
|
-
|
|
1950
|
+
this.attributes.aimDifficulty = this.mods.some((m) => m instanceof osuBase.ModAutopilot)
|
|
1951
|
+
? 0
|
|
1952
|
+
: this.starValue(aimSkill.difficultyValue()) * retryabilityScaling;
|
|
1881
1953
|
if (this.aim) {
|
|
1882
1954
|
this.attributes.sliderFactor =
|
|
1883
1955
|
(this.starValue(aimSkillWithoutSliders.difficultyValue()) *
|
|
@@ -1895,6 +1967,7 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1895
1967
|
* Calculates aim-related attributes.
|
|
1896
1968
|
*/
|
|
1897
1969
|
calculateAimAttributes() {
|
|
1970
|
+
this.attributes.difficultSliders = [];
|
|
1898
1971
|
const topDifficultSliders = [];
|
|
1899
1972
|
for (let i = 0; i < this.objects.length; ++i) {
|
|
1900
1973
|
const object = this.objects[i];
|
|
@@ -2019,10 +2092,12 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
2019
2092
|
this.attributes.flashlightSliderFactor =
|
|
2020
2093
|
this.starValue(flashlightSkillWithoutSliders.difficultyValue()) / this.flashlight;
|
|
2021
2094
|
}
|
|
2095
|
+
if (this.mods.some((m) => m instanceof osuBase.ModAutopilot)) {
|
|
2096
|
+
this.attributes.flashlightDifficulty *= 0.3;
|
|
2097
|
+
}
|
|
2022
2098
|
if (this.mods.some((m) => m instanceof osuBase.ModRelax)) {
|
|
2023
2099
|
this.attributes.flashlightDifficulty *= 0.7;
|
|
2024
2100
|
}
|
|
2025
|
-
this.attributes.flashlightDifficulty = this.flashlight;
|
|
2026
2101
|
this.attributes.flashlightDifficultStrainCount =
|
|
2027
2102
|
flashlightSkill.countDifficultStrains();
|
|
2028
2103
|
}
|
|
@@ -2041,6 +2116,9 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
2041
2116
|
this.starValue(visualSkillWithoutSliders.difficultyValue()) /
|
|
2042
2117
|
this.visual;
|
|
2043
2118
|
}
|
|
2119
|
+
if (this.mods.some((m) => m instanceof osuBase.ModAutopilot)) {
|
|
2120
|
+
this.attributes.visualDifficulty *= 0.8;
|
|
2121
|
+
}
|
|
2044
2122
|
this.attributes.visualDifficultStrainCount =
|
|
2045
2123
|
visualSkillWithSliders.countDifficultStrains();
|
|
2046
2124
|
}
|
|
@@ -2980,30 +3058,19 @@ class OsuSpeedEvaluator extends SpeedEvaluator {
|
|
|
2980
3058
|
* - and how easily they can be cheesed.
|
|
2981
3059
|
*
|
|
2982
3060
|
* @param current The current object.
|
|
2983
|
-
* @param greatWindow The great hit window of the current object.
|
|
2984
3061
|
*/
|
|
2985
|
-
static evaluateDifficultyOf(current
|
|
3062
|
+
static evaluateDifficultyOf(current) {
|
|
2986
3063
|
var _a;
|
|
2987
3064
|
if (current.object instanceof osuBase.Spinner) {
|
|
2988
3065
|
return 0;
|
|
2989
3066
|
}
|
|
2990
3067
|
const prev = current.previous(0);
|
|
2991
3068
|
let strainTime = current.strainTime;
|
|
2992
|
-
const greatWindowFull = greatWindow * 2;
|
|
2993
3069
|
// Nerf doubletappable doubles.
|
|
2994
|
-
const
|
|
2995
|
-
let doubletapness = 1;
|
|
2996
|
-
if (next) {
|
|
2997
|
-
const currentDeltaTime = Math.max(1, current.deltaTime);
|
|
2998
|
-
const nextDeltaTime = Math.max(1, next.deltaTime);
|
|
2999
|
-
const deltaDifference = Math.abs(nextDeltaTime - currentDeltaTime);
|
|
3000
|
-
const speedRatio = currentDeltaTime / Math.max(currentDeltaTime, deltaDifference);
|
|
3001
|
-
const windowRatio = Math.pow(Math.min(1, currentDeltaTime / greatWindowFull), 2);
|
|
3002
|
-
doubletapness = Math.pow(speedRatio, 1 - windowRatio);
|
|
3003
|
-
}
|
|
3070
|
+
const doubletapness = 1 - current.doubletapness;
|
|
3004
3071
|
// Cap deltatime to the OD 300 hitwindow.
|
|
3005
3072
|
// 0.93 is derived from making sure 260 BPM 1/4 OD8 streams aren't nerfed harshly, whilst 0.92 limits the effect of the cap.
|
|
3006
|
-
strainTime /= osuBase.MathUtils.clamp(strainTime /
|
|
3073
|
+
strainTime /= osuBase.MathUtils.clamp(strainTime / current.fullGreatWindow / 0.93, 0.92, 1);
|
|
3007
3074
|
let speedBonus = 1;
|
|
3008
3075
|
if (strainTime < this.minSpeedBonus) {
|
|
3009
3076
|
speedBonus +=
|
|
@@ -3032,9 +3099,8 @@ class OsuRhythmEvaluator extends RhythmEvaluator {
|
|
|
3032
3099
|
* with historic data of the current object.
|
|
3033
3100
|
*
|
|
3034
3101
|
* @param current The current object.
|
|
3035
|
-
* @param greatWindow The great hit window of the current object.
|
|
3036
3102
|
*/
|
|
3037
|
-
static evaluateDifficultyOf(current
|
|
3103
|
+
static evaluateDifficultyOf(current) {
|
|
3038
3104
|
if (current.object instanceof osuBase.Spinner) {
|
|
3039
3105
|
return 0;
|
|
3040
3106
|
}
|
|
@@ -3069,8 +3135,9 @@ class OsuRhythmEvaluator extends RhythmEvaluator {
|
|
|
3069
3135
|
Math.min(0.5, Math.pow(Math.sin(Math.PI /
|
|
3070
3136
|
(Math.min(prevDelta, currentDelta) /
|
|
3071
3137
|
Math.max(prevDelta, currentDelta))), 2));
|
|
3072
|
-
const windowPenalty = Math.min(1, Math.max(0, Math.abs(prevDelta - currentDelta) -
|
|
3073
|
-
|
|
3138
|
+
const windowPenalty = Math.min(1, Math.max(0, Math.abs(prevDelta - currentDelta) -
|
|
3139
|
+
current.fullGreatWindow * 0.3) /
|
|
3140
|
+
(current.fullGreatWindow * 0.3));
|
|
3074
3141
|
let effectiveRatio = windowPenalty * currentRatio;
|
|
3075
3142
|
if (firstDeltaSwitch) {
|
|
3076
3143
|
if (prevDelta <= 1.25 * currentDelta &&
|
|
@@ -3136,8 +3203,8 @@ class OsuRhythmEvaluator extends RhythmEvaluator {
|
|
|
3136
3203
|
* Represents the skill required to press keys or tap with regards to keeping up with the speed at which objects need to be hit.
|
|
3137
3204
|
*/
|
|
3138
3205
|
class OsuSpeed extends OsuSkill {
|
|
3139
|
-
constructor(
|
|
3140
|
-
super(
|
|
3206
|
+
constructor() {
|
|
3207
|
+
super(...arguments);
|
|
3141
3208
|
this.strainDecayBase = 0.3;
|
|
3142
3209
|
this.reducedSectionCount = 5;
|
|
3143
3210
|
this.reducedSectionBaseline = 0.75;
|
|
@@ -3146,7 +3213,6 @@ class OsuSpeed extends OsuSkill {
|
|
|
3146
3213
|
this.currentSpeedStrain = 0;
|
|
3147
3214
|
this.currentRhythm = 0;
|
|
3148
3215
|
this.skillMultiplier = 1375;
|
|
3149
|
-
this.greatWindow = new osuBase.OsuHitWindow(overallDifficulty).hitWindowFor300();
|
|
3150
3216
|
}
|
|
3151
3217
|
/**
|
|
3152
3218
|
* @param current The hitobject to calculate.
|
|
@@ -3154,9 +3220,9 @@ class OsuSpeed extends OsuSkill {
|
|
|
3154
3220
|
strainValueAt(current) {
|
|
3155
3221
|
this.currentSpeedStrain *= this.strainDecay(current.strainTime);
|
|
3156
3222
|
this.currentSpeedStrain +=
|
|
3157
|
-
OsuSpeedEvaluator.evaluateDifficultyOf(current
|
|
3223
|
+
OsuSpeedEvaluator.evaluateDifficultyOf(current) *
|
|
3158
3224
|
this.skillMultiplier;
|
|
3159
|
-
this.currentRhythm = OsuRhythmEvaluator.evaluateDifficultyOf(current
|
|
3225
|
+
this.currentRhythm = OsuRhythmEvaluator.evaluateDifficultyOf(current);
|
|
3160
3226
|
return this.currentSpeedStrain * this.currentRhythm;
|
|
3161
3227
|
}
|
|
3162
3228
|
calculateInitialStrain(time, current) {
|
|
@@ -3290,29 +3356,8 @@ class OsuFlashlight extends OsuSkill {
|
|
|
3290
3356
|
* Represents an osu!standard hit object with difficulty calculation values.
|
|
3291
3357
|
*/
|
|
3292
3358
|
class OsuDifficultyHitObject extends DifficultyHitObject {
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
// We will scale distances by this factor, so we can assume a uniform CircleSize among beatmaps.
|
|
3296
|
-
let scalingFactor = this.normalizedRadius / radius;
|
|
3297
|
-
// High circle size (small CS) bonus
|
|
3298
|
-
if (radius < this.radiusBuffThreshold) {
|
|
3299
|
-
scalingFactor *=
|
|
3300
|
-
1 + Math.min(this.radiusBuffThreshold - radius, 5) / 50;
|
|
3301
|
-
}
|
|
3302
|
-
return scalingFactor;
|
|
3303
|
-
}
|
|
3304
|
-
/**
|
|
3305
|
-
* Note: You **must** call `computeProperties` at some point due to how TypeScript handles
|
|
3306
|
-
* overridden properties (see [this](https://github.com/microsoft/TypeScript/issues/1617) GitHub issue).
|
|
3307
|
-
*
|
|
3308
|
-
* @param object The underlying hitobject.
|
|
3309
|
-
* @param lastObject The hitobject before this hitobject.
|
|
3310
|
-
* @param lastLastObject The hitobject before the last hitobject.
|
|
3311
|
-
* @param difficultyHitObjects All difficulty hitobjects in the processed beatmap.
|
|
3312
|
-
* @param clockRate The clock rate of the beatmap.
|
|
3313
|
-
*/
|
|
3314
|
-
constructor(object, lastObject, lastLastObject, difficultyHitObjects, clockRate) {
|
|
3315
|
-
super(object, lastObject, lastLastObject, difficultyHitObjects, clockRate);
|
|
3359
|
+
constructor() {
|
|
3360
|
+
super(...arguments);
|
|
3316
3361
|
/**
|
|
3317
3362
|
* The speed strain generated by the hitobject.
|
|
3318
3363
|
*/
|
|
@@ -3324,6 +3369,17 @@ class OsuDifficultyHitObject extends DifficultyHitObject {
|
|
|
3324
3369
|
this.radiusBuffThreshold = 30;
|
|
3325
3370
|
this.mode = osuBase.Modes.osu;
|
|
3326
3371
|
}
|
|
3372
|
+
get scalingFactor() {
|
|
3373
|
+
const radius = this.object.radius;
|
|
3374
|
+
// We will scale distances by this factor, so we can assume a uniform CircleSize among beatmaps.
|
|
3375
|
+
let scalingFactor = this.normalizedRadius / radius;
|
|
3376
|
+
// High circle size (small CS) bonus
|
|
3377
|
+
if (radius < this.radiusBuffThreshold) {
|
|
3378
|
+
scalingFactor *=
|
|
3379
|
+
1 + Math.min(this.radiusBuffThreshold - radius, 5) / 50;
|
|
3380
|
+
}
|
|
3381
|
+
return scalingFactor;
|
|
3382
|
+
}
|
|
3327
3383
|
}
|
|
3328
3384
|
|
|
3329
3385
|
/**
|
|
@@ -3385,7 +3441,7 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3385
3441
|
* Calculates the speed star rating of the beatmap and stores it in this instance.
|
|
3386
3442
|
*/
|
|
3387
3443
|
calculateSpeed() {
|
|
3388
|
-
const speedSkill = new OsuSpeed(this.mods
|
|
3444
|
+
const speedSkill = new OsuSpeed(this.mods);
|
|
3389
3445
|
this.calculateSkills(speedSkill);
|
|
3390
3446
|
this.postCalculateSpeed(speedSkill);
|
|
3391
3447
|
}
|
|
@@ -3447,19 +3503,19 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3447
3503
|
var _a, _b;
|
|
3448
3504
|
const difficultyObjects = [];
|
|
3449
3505
|
const { objects } = convertedBeatmap.hitObjects;
|
|
3506
|
+
const greatWindow = new osuBase.OsuHitWindow(this.difficultyStatistics.overallDifficulty).hitWindowFor300();
|
|
3450
3507
|
for (let i = 0; i < objects.length; ++i) {
|
|
3451
|
-
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, this.difficultyStatistics.overallSpeedMultiplier);
|
|
3508
|
+
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, this.difficultyStatistics.overallSpeedMultiplier, greatWindow);
|
|
3452
3509
|
difficultyObject.computeProperties(this.difficultyStatistics.overallSpeedMultiplier, objects);
|
|
3453
3510
|
difficultyObjects.push(difficultyObject);
|
|
3454
3511
|
}
|
|
3455
3512
|
return difficultyObjects;
|
|
3456
3513
|
}
|
|
3457
3514
|
computeDifficultyStatistics(options) {
|
|
3458
|
-
var _a;
|
|
3459
3515
|
const { difficulty } = this.beatmap;
|
|
3460
3516
|
return osuBase.calculateOsuDifficultyStatistics({
|
|
3461
3517
|
circleSize: difficulty.cs,
|
|
3462
|
-
approachRate:
|
|
3518
|
+
approachRate: difficulty.ar,
|
|
3463
3519
|
overallDifficulty: difficulty.od,
|
|
3464
3520
|
healthDrain: difficulty.hp,
|
|
3465
3521
|
mods: options === null || options === void 0 ? void 0 : options.mods,
|
|
@@ -3470,7 +3526,7 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3470
3526
|
return [
|
|
3471
3527
|
new OsuAim(this.mods, true),
|
|
3472
3528
|
new OsuAim(this.mods, false),
|
|
3473
|
-
new OsuSpeed(this.mods
|
|
3529
|
+
new OsuSpeed(this.mods),
|
|
3474
3530
|
new OsuFlashlight(this.mods),
|
|
3475
3531
|
];
|
|
3476
3532
|
}
|
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.25",
|
|
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.25"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "2d6271ea24c787caad1d24c3d20dbeeaf450359e"
|
|
42
42
|
}
|
package/typings/index.d.ts
CHANGED
|
@@ -191,6 +191,10 @@ declare abstract class DifficultyHitObject {
|
|
|
191
191
|
* Adjusted end time of the hitobject, taking speed multiplier into account.
|
|
192
192
|
*/
|
|
193
193
|
readonly endTime: number;
|
|
194
|
+
/**
|
|
195
|
+
* The full great window of the hitobject.
|
|
196
|
+
*/
|
|
197
|
+
readonly fullGreatWindow: number;
|
|
194
198
|
/**
|
|
195
199
|
* Other hitobjects in the beatmap, including this hitobject.
|
|
196
200
|
*/
|
|
@@ -199,7 +203,10 @@ declare abstract class DifficultyHitObject {
|
|
|
199
203
|
protected readonly normalizedRadius = 50;
|
|
200
204
|
protected readonly maximumSliderRadius: number;
|
|
201
205
|
protected readonly assumedSliderRadius: number;
|
|
202
|
-
|
|
206
|
+
/**
|
|
207
|
+
* The lowest possible delta time value.
|
|
208
|
+
*/
|
|
209
|
+
static readonly minDeltaTime = 25;
|
|
203
210
|
private readonly lastObject;
|
|
204
211
|
private readonly lastLastObject;
|
|
205
212
|
/**
|
|
@@ -211,8 +218,9 @@ declare abstract class DifficultyHitObject {
|
|
|
211
218
|
* @param lastLastObject The hitobject before the last hitobject.
|
|
212
219
|
* @param difficultyHitObjects All difficulty hitobjects in the processed beatmap.
|
|
213
220
|
* @param clockRate The clock rate of the beatmap.
|
|
221
|
+
* @param greatWindow The great window of the hitobject.
|
|
214
222
|
*/
|
|
215
|
-
|
|
223
|
+
constructor(object: PlaceableHitObject, lastObject: PlaceableHitObject | null, lastLastObject: PlaceableHitObject | null, difficultyHitObjects: readonly DifficultyHitObject[], clockRate: number, greatWindow: number);
|
|
216
224
|
/**
|
|
217
225
|
* Computes the properties of this hitobject.
|
|
218
226
|
*
|
|
@@ -250,6 +258,13 @@ declare abstract class DifficultyHitObject {
|
|
|
250
258
|
* @returns The opacity of the hitobject at the given time.
|
|
251
259
|
*/
|
|
252
260
|
opacityAt(time: number, isHidden: boolean): number;
|
|
261
|
+
/**
|
|
262
|
+
* How possible is it to doubletap this object together with the next one and get perfect
|
|
263
|
+
* judgement in range from 0 to 1.
|
|
264
|
+
*
|
|
265
|
+
* A value closer to 1 indicates a higher possibility.
|
|
266
|
+
*/
|
|
267
|
+
get doubletapness(): number;
|
|
253
268
|
protected abstract get scalingFactor(): number;
|
|
254
269
|
protected setDistances(clockRate: number): void;
|
|
255
270
|
private calculateSliderCursorPosition;
|
|
@@ -613,9 +628,10 @@ declare class DroidDifficultyHitObject extends DifficultyHitObject {
|
|
|
613
628
|
* @param lastLastObject The hitobject before the last hitobject.
|
|
614
629
|
* @param difficultyHitObjects All difficulty hitobjects in the processed beatmap.
|
|
615
630
|
* @param clockRate The clock rate of the beatmap.
|
|
631
|
+
* @param greatWindow The great window of the hitobject.
|
|
616
632
|
* @param isForceAR Whether force AR is enabled.
|
|
617
633
|
*/
|
|
618
|
-
constructor(object: PlaceableHitObject, lastObject: PlaceableHitObject | null, lastLastObject: PlaceableHitObject | null, difficultyHitObjects: readonly DifficultyHitObject[], clockRate: number, isForceAR: boolean);
|
|
634
|
+
constructor(object: PlaceableHitObject, lastObject: PlaceableHitObject | null, lastLastObject: PlaceableHitObject | null, difficultyHitObjects: readonly DifficultyHitObject[], clockRate: number, greatWindow: number, isForceAR: boolean);
|
|
619
635
|
computeProperties(clockRate: number, hitObjects: readonly PlaceableHitObject[]): void;
|
|
620
636
|
/**
|
|
621
637
|
* Determines whether this hitobject is considered overlapping with the hitobject before it.
|
|
@@ -1258,8 +1274,6 @@ declare class DroidRhythm extends DroidSkill {
|
|
|
1258
1274
|
protected readonly starsPerDouble = 1.75;
|
|
1259
1275
|
private currentRhythmStrain;
|
|
1260
1276
|
private currentRhythmMultiplier;
|
|
1261
|
-
private readonly hitWindow;
|
|
1262
|
-
constructor(mods: Mod[], overallDifficulty: number);
|
|
1263
1277
|
protected strainValueAt(current: DroidDifficultyHitObject): number;
|
|
1264
1278
|
protected calculateInitialStrain(time: number, current: DroidDifficultyHitObject): number;
|
|
1265
1279
|
protected getObjectStrain(): number;
|
|
@@ -1280,14 +1294,17 @@ declare abstract class RhythmEvaluator {
|
|
|
1280
1294
|
* An evaluator for calculating osu!droid Rhythm skill.
|
|
1281
1295
|
*/
|
|
1282
1296
|
declare abstract class DroidRhythmEvaluator extends RhythmEvaluator {
|
|
1297
|
+
protected static readonly rhythmMultiplier = 1.2;
|
|
1298
|
+
protected static readonly historyTimeMax = 4000;
|
|
1299
|
+
private static readonly maxIslandSize;
|
|
1300
|
+
private static readonly historyObjectsMax;
|
|
1283
1301
|
/**
|
|
1284
1302
|
* Calculates a rhythm multiplier for the difficulty of the tap associated
|
|
1285
1303
|
* with historic data of the current object.
|
|
1286
1304
|
*
|
|
1287
1305
|
* @param current The current object.
|
|
1288
|
-
* @param greatWindow The great hit window of the current object.
|
|
1289
1306
|
*/
|
|
1290
|
-
static evaluateDifficultyOf(current: DroidDifficultyHitObject
|
|
1307
|
+
static evaluateDifficultyOf(current: DroidDifficultyHitObject): number;
|
|
1291
1308
|
}
|
|
1292
1309
|
|
|
1293
1310
|
/**
|
|
@@ -1302,7 +1319,6 @@ declare class DroidTap extends DroidSkill {
|
|
|
1302
1319
|
private currentTapStrain;
|
|
1303
1320
|
private currentRhythmMultiplier;
|
|
1304
1321
|
private readonly skillMultiplier;
|
|
1305
|
-
private readonly greatWindow;
|
|
1306
1322
|
private readonly considerCheesability;
|
|
1307
1323
|
private readonly strainTimeCap?;
|
|
1308
1324
|
private readonly _objectDeltaTimes;
|
|
@@ -1310,7 +1326,7 @@ declare class DroidTap extends DroidSkill {
|
|
|
1310
1326
|
* The delta time of hitobjects.
|
|
1311
1327
|
*/
|
|
1312
1328
|
get objectDeltaTimes(): readonly number[];
|
|
1313
|
-
constructor(mods: Mod[],
|
|
1329
|
+
constructor(mods: Mod[], considerCheesability: boolean, strainTimeCap?: number);
|
|
1314
1330
|
/**
|
|
1315
1331
|
* The amount of notes that are relevant to the difficulty.
|
|
1316
1332
|
*/
|
|
@@ -1350,11 +1366,10 @@ declare abstract class DroidTapEvaluator extends SpeedEvaluator {
|
|
|
1350
1366
|
* - and the strain time cap.
|
|
1351
1367
|
*
|
|
1352
1368
|
* @param current The current object.
|
|
1353
|
-
* @param greatWindow The great hit window of the current object.
|
|
1354
1369
|
* @param considerCheesability Whether to consider cheesability.
|
|
1355
1370
|
* @param strainTimeCap The strain time to cap the object's strain time to.
|
|
1356
1371
|
*/
|
|
1357
|
-
static evaluateDifficultyOf(current: DroidDifficultyHitObject,
|
|
1372
|
+
static evaluateDifficultyOf(current: DroidDifficultyHitObject, considerCheesability: boolean, strainTimeCap?: number): number;
|
|
1358
1373
|
}
|
|
1359
1374
|
|
|
1360
1375
|
/**
|
|
@@ -1436,17 +1451,6 @@ declare class OsuDifficultyHitObject extends DifficultyHitObject {
|
|
|
1436
1451
|
private readonly radiusBuffThreshold;
|
|
1437
1452
|
protected readonly mode = Modes.osu;
|
|
1438
1453
|
protected get scalingFactor(): number;
|
|
1439
|
-
/**
|
|
1440
|
-
* Note: You **must** call `computeProperties` at some point due to how TypeScript handles
|
|
1441
|
-
* overridden properties (see [this](https://github.com/microsoft/TypeScript/issues/1617) GitHub issue).
|
|
1442
|
-
*
|
|
1443
|
-
* @param object The underlying hitobject.
|
|
1444
|
-
* @param lastObject The hitobject before this hitobject.
|
|
1445
|
-
* @param lastLastObject The hitobject before the last hitobject.
|
|
1446
|
-
* @param difficultyHitObjects All difficulty hitobjects in the processed beatmap.
|
|
1447
|
-
* @param clockRate The clock rate of the beatmap.
|
|
1448
|
-
*/
|
|
1449
|
-
constructor(object: PlaceableHitObject, lastObject: PlaceableHitObject | null, lastLastObject: PlaceableHitObject | null, difficultyHitObjects: readonly DifficultyHitObject[], clockRate: number);
|
|
1450
1454
|
}
|
|
1451
1455
|
|
|
1452
1456
|
/**
|
|
@@ -1648,9 +1652,8 @@ declare abstract class OsuRhythmEvaluator extends RhythmEvaluator {
|
|
|
1648
1652
|
* with historic data of the current object.
|
|
1649
1653
|
*
|
|
1650
1654
|
* @param current The current object.
|
|
1651
|
-
* @param greatWindow The great hit window of the current object.
|
|
1652
1655
|
*/
|
|
1653
|
-
static evaluateDifficultyOf(current: OsuDifficultyHitObject
|
|
1656
|
+
static evaluateDifficultyOf(current: OsuDifficultyHitObject): number;
|
|
1654
1657
|
}
|
|
1655
1658
|
|
|
1656
1659
|
/**
|
|
@@ -1665,8 +1668,6 @@ declare class OsuSpeed extends OsuSkill {
|
|
|
1665
1668
|
private currentSpeedStrain;
|
|
1666
1669
|
private currentRhythm;
|
|
1667
1670
|
private readonly skillMultiplier;
|
|
1668
|
-
private readonly greatWindow;
|
|
1669
|
-
constructor(mods: Mod[], overallDifficulty: number);
|
|
1670
1671
|
/**
|
|
1671
1672
|
* @param current The hitobject to calculate.
|
|
1672
1673
|
*/
|
|
@@ -1694,9 +1695,8 @@ declare abstract class OsuSpeedEvaluator extends SpeedEvaluator {
|
|
|
1694
1695
|
* - and how easily they can be cheesed.
|
|
1695
1696
|
*
|
|
1696
1697
|
* @param current The current object.
|
|
1697
|
-
* @param greatWindow The great hit window of the current object.
|
|
1698
1698
|
*/
|
|
1699
|
-
static evaluateDifficultyOf(current: OsuDifficultyHitObject
|
|
1699
|
+
static evaluateDifficultyOf(current: OsuDifficultyHitObject): number;
|
|
1700
1700
|
}
|
|
1701
1701
|
|
|
1702
1702
|
export { AimEvaluator, type CacheableDifficultyAttributes, type DifficultSlider, type DifficultyAttributes, type DifficultyCalculationOptions, DifficultyCalculator, DifficultyHitObject, DroidAim, DroidAimEvaluator, type DroidDifficultyAttributes, type DroidDifficultyCalculationOptions, DroidDifficultyCalculator, DroidDifficultyHitObject, DroidFlashlight, DroidFlashlightEvaluator, DroidPerformanceCalculator, DroidRhythm, DroidRhythmEvaluator, DroidTap, DroidTapEvaluator, DroidVisual, DroidVisualEvaluator, type ExtendedDroidDifficultyAttributes, FlashlightEvaluator, type HighStrainSection, OsuAim, OsuAimEvaluator, type OsuDifficultyAttributes, OsuDifficultyCalculator, OsuDifficultyHitObject, OsuFlashlight, OsuFlashlightEvaluator, OsuPerformanceCalculator, OsuRhythmEvaluator, OsuSpeed, OsuSpeedEvaluator, type PerformanceCalculationOptions, PerformanceCalculator, RhythmEvaluator, SpeedEvaluator, type StrainPeaks };
|