@rian8337/osu-rebalance-difficulty-calculator 4.0.0-beta.94 → 4.0.0-beta.96
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 +127 -76
- package/package.json +3 -3
- package/typings/index.d.ts +12 -7
package/dist/index.js
CHANGED
|
@@ -223,17 +223,8 @@ class Skill {
|
|
|
223
223
|
get objectDifficulties() {
|
|
224
224
|
return this._objectDifficulties;
|
|
225
225
|
}
|
|
226
|
-
/**
|
|
227
|
-
* The start times of {@link DifficultyHitObject}s, populated by {@link Skill.process}.
|
|
228
|
-
*
|
|
229
|
-
* Indices correspond to {@link objectDifficulties}.
|
|
230
|
-
*/
|
|
231
|
-
get objectTimes() {
|
|
232
|
-
return this._objectTimes;
|
|
233
|
-
}
|
|
234
226
|
constructor(mods) {
|
|
235
227
|
this._objectDifficulties = [];
|
|
236
|
-
this._objectTimes = [];
|
|
237
228
|
this.mods = mods;
|
|
238
229
|
}
|
|
239
230
|
/**
|
|
@@ -249,7 +240,6 @@ class Skill {
|
|
|
249
240
|
const difficultyValue = this.processInternal(current);
|
|
250
241
|
this.saveToHitObject(current, difficultyValue);
|
|
251
242
|
this._objectDifficulties.push(difficultyValue);
|
|
252
|
-
this._objectTimes.push(current.startTime);
|
|
253
243
|
}
|
|
254
244
|
/**
|
|
255
245
|
* Saves the calculated difficulty to a {@link DifficultyHitObject}.
|
|
@@ -543,16 +533,16 @@ class DroidSnapAimEvaluator {
|
|
|
543
533
|
const radius = current.normalizedRadius;
|
|
544
534
|
const diameter = current.normalizedDiameter;
|
|
545
535
|
// Calculate the velocity to the current hitobject, which starts with a base distance / time assuming the last object is a hitcircle.
|
|
546
|
-
const currentDistance = withSliders
|
|
536
|
+
const currentDistance = withSliders && !current.is2BSlider
|
|
547
537
|
? current.lazyJumpDistance
|
|
548
538
|
: current.jumpDistance;
|
|
549
539
|
let currentVelocity = currentDistance / current.strainTime;
|
|
550
540
|
// But if the last object is a slider, then we extend the travel velocity through the slider into the current object.
|
|
551
|
-
if (last.object instanceof osuBase.Slider && withSliders) {
|
|
541
|
+
if (last.object instanceof osuBase.Slider && !last.is2BSlider && withSliders) {
|
|
552
542
|
const sliderDistance = last.lazyTravelDistance + current.lazyJumpDistance;
|
|
553
543
|
currentVelocity = Math.max(currentVelocity, sliderDistance / current.strainTime);
|
|
554
544
|
}
|
|
555
|
-
const prevDistance = withSliders
|
|
545
|
+
const prevDistance = withSliders && !last.is2BSlider
|
|
556
546
|
? last.lazyJumpDistance
|
|
557
547
|
: last.jumpDistance;
|
|
558
548
|
const prevVelocity = prevDistance / last.strainTime;
|
|
@@ -726,14 +716,14 @@ class DroidFlowAimEvaluator {
|
|
|
726
716
|
}
|
|
727
717
|
const last = current.previous(0);
|
|
728
718
|
const lastLast = current.previous(1);
|
|
729
|
-
const currentDistance = withSliders
|
|
719
|
+
const currentDistance = withSliders && !current.is2BSlider
|
|
730
720
|
? current.lazyJumpDistance
|
|
731
721
|
: current.jumpDistance;
|
|
732
|
-
const prevDistance = withSliders
|
|
722
|
+
const prevDistance = withSliders && !last.is2BSlider
|
|
733
723
|
? last.lazyJumpDistance
|
|
734
724
|
: last.jumpDistance;
|
|
735
725
|
let currentVelocity = currentDistance / current.strainTime;
|
|
736
|
-
if (last.object instanceof osuBase.Slider && withSliders) {
|
|
726
|
+
if (last.object instanceof osuBase.Slider && !last.is2BSlider && withSliders) {
|
|
737
727
|
// If the last object is a slider, then we extend the travel velocity through the slider into the current object.
|
|
738
728
|
const sliderDistance = last.lazyTravelDistance + current.lazyJumpDistance;
|
|
739
729
|
currentVelocity = Math.max(currentVelocity, sliderDistance / current.strainTime);
|
|
@@ -1015,6 +1005,7 @@ class DroidFlashlightEvaluator {
|
|
|
1015
1005
|
* @param mods The mods used.
|
|
1016
1006
|
*/
|
|
1017
1007
|
static evaluateDifficultyOf(current, mods) {
|
|
1008
|
+
var _a;
|
|
1018
1009
|
if (current.object instanceof osuBase.Spinner ||
|
|
1019
1010
|
// Exclude overlapping objects that can be tapped at once.
|
|
1020
1011
|
current.isOverlapping(true)) {
|
|
@@ -1026,6 +1017,10 @@ class DroidFlashlightEvaluator {
|
|
|
1026
1017
|
let result = 0;
|
|
1027
1018
|
let last = current;
|
|
1028
1019
|
let angleRepeatCount = 0;
|
|
1020
|
+
// Hidden's fade-out only affects opacity when the "only fade approach circles" setting is off.
|
|
1021
|
+
const opacityMods = ((_a = mods.get(osuBase.ModHidden)) === null || _a === void 0 ? void 0 : _a.onlyFadeApproachCircles.value)
|
|
1022
|
+
? undefined
|
|
1023
|
+
: mods;
|
|
1029
1024
|
for (let i = 0; i < Math.min(current.index, 10); ++i) {
|
|
1030
1025
|
const currentObject = current.previous(i);
|
|
1031
1026
|
cumulativeStrainTime += last.strainTime;
|
|
@@ -1043,7 +1038,7 @@ class DroidFlashlightEvaluator {
|
|
|
1043
1038
|
const opacityBonus = 1 +
|
|
1044
1039
|
this.maxOpacityBonus *
|
|
1045
1040
|
(1 -
|
|
1046
|
-
current.opacityAt(currentObject.object.startTime,
|
|
1041
|
+
current.opacityAt(currentObject.object.startTime, opacityMods));
|
|
1047
1042
|
result +=
|
|
1048
1043
|
(stackNerf * opacityBonus * scalingFactor * jumpDistance) /
|
|
1049
1044
|
cumulativeStrainTime;
|
|
@@ -1133,7 +1128,10 @@ class StrainSkill extends Skill {
|
|
|
1133
1128
|
get peaks() {
|
|
1134
1129
|
return this.strainPeaks
|
|
1135
1130
|
.map((value, i) => ({ time: this.strainPeakTimes[i], value }))
|
|
1136
|
-
.concat({
|
|
1131
|
+
.concat({
|
|
1132
|
+
time: this.currentSectionEnd,
|
|
1133
|
+
value: this.currentSectionPeak,
|
|
1134
|
+
});
|
|
1137
1135
|
}
|
|
1138
1136
|
/**
|
|
1139
1137
|
* Converts a difficulty value to a performance value.
|
|
@@ -1180,9 +1178,7 @@ class StrainSkill extends Skill {
|
|
|
1180
1178
|
this.startNewSectionFrom(this.currentSectionEnd, current);
|
|
1181
1179
|
this.currentSectionEnd += this.sectionLength;
|
|
1182
1180
|
}
|
|
1183
|
-
// Ignore the first hitobject.
|
|
1184
1181
|
this.currentStrain = this.strainValueAt(current);
|
|
1185
|
-
this.saveToHitObject(current, this.currentStrain);
|
|
1186
1182
|
this.currentSectionPeak = Math.max(this.currentStrain, this.currentSectionPeak);
|
|
1187
1183
|
return this.currentStrain;
|
|
1188
1184
|
}
|
|
@@ -1321,6 +1317,7 @@ class HarmonicSkill extends Skill {
|
|
|
1321
1317
|
constructor() {
|
|
1322
1318
|
super(...arguments);
|
|
1323
1319
|
this._noteWeightSum = 0;
|
|
1320
|
+
this._objectTimes = [];
|
|
1324
1321
|
/**
|
|
1325
1322
|
* Scaling factor applied as `x / (i + 1)`, where `x` is the skill's {@link harmonicScale} and `i`
|
|
1326
1323
|
* is the index of the {@link DifficultyHitObject} being processed.
|
|
@@ -1343,6 +1340,14 @@ class HarmonicSkill extends Skill {
|
|
|
1343
1340
|
get noteWeightSum() {
|
|
1344
1341
|
return this._noteWeightSum;
|
|
1345
1342
|
}
|
|
1343
|
+
/**
|
|
1344
|
+
* The start times of {@link DifficultyHitObject}s, populated by {@link HarmonicSkill.process}.
|
|
1345
|
+
*
|
|
1346
|
+
* Indices correspond to {@link objectDifficulties}.
|
|
1347
|
+
*/
|
|
1348
|
+
get objectTimes() {
|
|
1349
|
+
return this._objectTimes;
|
|
1350
|
+
}
|
|
1346
1351
|
get peaks() {
|
|
1347
1352
|
return this.objectDifficulties.map((value, i) => ({
|
|
1348
1353
|
time: this.objectTimes[i],
|
|
@@ -1408,6 +1413,13 @@ class HarmonicSkill extends Skill {
|
|
|
1408
1413
|
applyDifficultyTransformation(difficulties) {
|
|
1409
1414
|
// Do nothing by default.
|
|
1410
1415
|
}
|
|
1416
|
+
process(current) {
|
|
1417
|
+
const previousLength = this.objectDifficulties.length;
|
|
1418
|
+
super.process(current);
|
|
1419
|
+
if (this.objectDifficulties.length > previousLength) {
|
|
1420
|
+
this._objectTimes.push(current.startTime);
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1411
1423
|
processInternal(current) {
|
|
1412
1424
|
return this.objectDifficultyOf(current);
|
|
1413
1425
|
}
|
|
@@ -1800,20 +1812,29 @@ class DroidTapEvaluator {
|
|
|
1800
1812
|
current.isOverlapping(false)) {
|
|
1801
1813
|
return 0;
|
|
1802
1814
|
}
|
|
1815
|
+
let { strainTime } = current;
|
|
1816
|
+
// Nerf doubletappable doubles.
|
|
1803
1817
|
const doubletapness = considerCheesability
|
|
1804
1818
|
? 1 - current.getDoubletapness(current.next(0))
|
|
1805
1819
|
: 1;
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1820
|
+
// Cap deltatime to the OD 300 hitwindow.
|
|
1821
|
+
// 0.63 is derived from making sure 200 BPM 1/4 OD8 streams aren't nerfed harshly, whilst 0.92 limits the effect of the cap.
|
|
1822
|
+
strainTime /= osuBase.MathUtils.clamp(strainTime / current.hitWindowFor(osuBase.HitResult.Great) / 0.63, 0.92, 1);
|
|
1823
|
+
// speedBonus will be 0 for BPM < 200
|
|
1824
|
+
let speedBonus = 0;
|
|
1825
|
+
// Add additional scaling bonus for streams/bursts higher than 200bpm
|
|
1826
|
+
if (osuBase.MathUtils.millisecondsToBPM(strainTime) > this.minSpeedBonus) {
|
|
1827
|
+
speedBonus =
|
|
1809
1828
|
0.75 *
|
|
1810
1829
|
Math.pow(osuBase.ErrorFunction.erf((osuBase.MathUtils.bpmToMilliseconds(this.minSpeedBonus) -
|
|
1811
|
-
|
|
1830
|
+
strainTime) /
|
|
1812
1831
|
40), 2);
|
|
1813
1832
|
}
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1833
|
+
// Base difficulty with all bonuses
|
|
1834
|
+
let difficulty = ((1 + speedBonus) * 1000) / strainTime;
|
|
1835
|
+
difficulty *= this.highBpmBonus(current.strainTime);
|
|
1836
|
+
// Apply penalty if there's doubletappable doubles
|
|
1837
|
+
return difficulty * doubletapness;
|
|
1817
1838
|
}
|
|
1818
1839
|
static highBpmBonus(ms) {
|
|
1819
1840
|
return 1 / (1 - Math.pow(0.3, ms / 1000));
|
|
@@ -2481,6 +2502,19 @@ class DifficultyHitObject {
|
|
|
2481
2502
|
get angle() {
|
|
2482
2503
|
return this.angleSigned !== null ? Math.abs(this.angleSigned) : null;
|
|
2483
2504
|
}
|
|
2505
|
+
/**
|
|
2506
|
+
* Whether this hitobject is a 2B slider.
|
|
2507
|
+
*/
|
|
2508
|
+
get is2BSlider() {
|
|
2509
|
+
if (!(this.object instanceof osuBase.Slider)) {
|
|
2510
|
+
return false;
|
|
2511
|
+
}
|
|
2512
|
+
const next = this.next(0);
|
|
2513
|
+
if (!next) {
|
|
2514
|
+
return false;
|
|
2515
|
+
}
|
|
2516
|
+
return this.endTime - this.startTime > next.strainTime;
|
|
2517
|
+
}
|
|
2484
2518
|
/**
|
|
2485
2519
|
* The normalized diameter of the hitobject.
|
|
2486
2520
|
*/
|
|
@@ -2994,17 +3028,24 @@ class DroidDifficultyHitObject extends DifficultyHitObject {
|
|
|
2994
3028
|
}
|
|
2995
3029
|
}
|
|
2996
3030
|
|
|
3031
|
+
/**
|
|
3032
|
+
* Represents a group of consecutive objects with the same delta time.
|
|
3033
|
+
*/
|
|
2997
3034
|
class Island {
|
|
2998
|
-
constructor(delta
|
|
3035
|
+
constructor(delta) {
|
|
3036
|
+
/**
|
|
3037
|
+
* Delta time of every object in this island.
|
|
3038
|
+
*/
|
|
2999
3039
|
this.delta = Number.MAX_SAFE_INTEGER;
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3040
|
+
/**
|
|
3041
|
+
* How long the island is.
|
|
3042
|
+
*/
|
|
3043
|
+
this.deltaCount = 1;
|
|
3044
|
+
/**
|
|
3045
|
+
* How many times the island already occured.
|
|
3046
|
+
*/
|
|
3047
|
+
this.occurrences = 1;
|
|
3048
|
+
this.delta = Math.max(Math.trunc(delta), DifficultyHitObject.minDeltaTime);
|
|
3008
3049
|
}
|
|
3009
3050
|
addDelta(delta) {
|
|
3010
3051
|
if (this.delta === Number.MAX_SAFE_INTEGER) {
|
|
@@ -3012,27 +3053,20 @@ class Island {
|
|
|
3012
3053
|
}
|
|
3013
3054
|
++this.deltaCount;
|
|
3014
3055
|
}
|
|
3015
|
-
isSimilarPolarity(other) {
|
|
3056
|
+
isSimilarPolarity(other, epsilon) {
|
|
3016
3057
|
// Single delta islands should not be compared.
|
|
3017
3058
|
if (this.deltaCount <= 1 || other.deltaCount <= 1) {
|
|
3018
3059
|
return false;
|
|
3019
3060
|
}
|
|
3020
|
-
return (Math.abs(this.delta - other.delta) <
|
|
3061
|
+
return (Math.abs(this.delta - other.delta) < epsilon &&
|
|
3021
3062
|
this.deltaCount % 2 === other.deltaCount % 2);
|
|
3022
3063
|
}
|
|
3023
|
-
|
|
3024
|
-
return (Math.abs(this.delta - other.delta) <
|
|
3064
|
+
almostEquals(other, epsilon) {
|
|
3065
|
+
return (Math.abs(this.delta - other.delta) < epsilon &&
|
|
3025
3066
|
this.deltaCount === other.deltaCount);
|
|
3026
3067
|
}
|
|
3027
3068
|
}
|
|
3028
3069
|
|
|
3029
|
-
class IslandCounter {
|
|
3030
|
-
constructor(island, count) {
|
|
3031
|
-
this.island = island;
|
|
3032
|
-
this.count = count;
|
|
3033
|
-
}
|
|
3034
|
-
}
|
|
3035
|
-
|
|
3036
3070
|
/**
|
|
3037
3071
|
* An evaluator for calculating osu!droid Rhythm skill.
|
|
3038
3072
|
*/
|
|
@@ -3050,9 +3084,9 @@ class DroidRhythmEvaluator {
|
|
|
3050
3084
|
}
|
|
3051
3085
|
const deltaDifferenceEpsilon = current.hitWindowFor(osuBase.HitResult.Great) * 0.3;
|
|
3052
3086
|
let rhythmComplexitySum = 0;
|
|
3053
|
-
let island = new Island(
|
|
3054
|
-
let previousIsland = new Island(
|
|
3055
|
-
const
|
|
3087
|
+
let island = new Island(Number.MAX_SAFE_INTEGER);
|
|
3088
|
+
let previousIsland = new Island(Number.MAX_SAFE_INTEGER);
|
|
3089
|
+
const islands = [];
|
|
3056
3090
|
// Store the ratio of the current start of an island to buff for tighter rhythms.
|
|
3057
3091
|
let startRatio = 0;
|
|
3058
3092
|
let firstDeltaSwitch = false;
|
|
@@ -3093,7 +3127,7 @@ class DroidRhythmEvaluator {
|
|
|
3093
3127
|
const prevDelta = Math.max(prevObject.deltaTime, 1e-7);
|
|
3094
3128
|
const lastDelta = Math.max(lastObject.deltaTime, 1e-7);
|
|
3095
3129
|
if (island.delta == Number.MAX_SAFE_INTEGER) {
|
|
3096
|
-
island = new Island(currentDelta
|
|
3130
|
+
island = new Island(currentDelta);
|
|
3097
3131
|
}
|
|
3098
3132
|
// Calculate how much current delta difference deserves a rhythm bonus.
|
|
3099
3133
|
// This function is meant to reduce rhythm bonus for deltas that are multiples of each other (i.e. 100 and 200).
|
|
@@ -3130,7 +3164,7 @@ class DroidRhythmEvaluator {
|
|
|
3130
3164
|
effectiveRatio /= 2;
|
|
3131
3165
|
}
|
|
3132
3166
|
// Repeated island polarity (2 -> 4, 3 -> 5).
|
|
3133
|
-
if (island.isSimilarPolarity(previousIsland)) {
|
|
3167
|
+
if (island.isSimilarPolarity(previousIsland, deltaDifferenceEpsilon)) {
|
|
3134
3168
|
effectiveRatio /= 2;
|
|
3135
3169
|
}
|
|
3136
3170
|
// Previous increase happened a note ago.
|
|
@@ -3147,18 +3181,24 @@ class DroidRhythmEvaluator {
|
|
|
3147
3181
|
if (isSpeedingUp) {
|
|
3148
3182
|
effectiveRatio *= 0.65;
|
|
3149
3183
|
}
|
|
3150
|
-
|
|
3151
|
-
|
|
3184
|
+
let found = false;
|
|
3185
|
+
for (const existingIsland of islands) {
|
|
3186
|
+
if (!existingIsland.almostEquals(island, deltaDifferenceEpsilon)) {
|
|
3187
|
+
continue;
|
|
3188
|
+
}
|
|
3152
3189
|
// Only add island to island counts if they're going one after another.
|
|
3153
|
-
if (previousIsland.
|
|
3154
|
-
++
|
|
3190
|
+
if (previousIsland.almostEquals(island, deltaDifferenceEpsilon)) {
|
|
3191
|
+
++existingIsland.occurrences;
|
|
3155
3192
|
}
|
|
3193
|
+
const power = osuBase.MathUtils.offsetLogistic(island.delta, 58.33, 0.24, 2.75);
|
|
3156
3194
|
// Repeated island (ex: triplet -> triplet).
|
|
3157
3195
|
// Graph: https://www.desmos.com/calculator/pj7an56zwf
|
|
3158
|
-
effectiveRatio *= Math.min(3 /
|
|
3196
|
+
effectiveRatio *= Math.min(3 / existingIsland.occurrences, Math.pow(1 / existingIsland.occurrences, power));
|
|
3197
|
+
found = true;
|
|
3198
|
+
break;
|
|
3159
3199
|
}
|
|
3160
|
-
|
|
3161
|
-
|
|
3200
|
+
if (!found && island.deltaCount > 0) {
|
|
3201
|
+
islands.push(island);
|
|
3162
3202
|
}
|
|
3163
3203
|
// Scale down the difficulty if the object is doubletappable.
|
|
3164
3204
|
effectiveRatio *=
|
|
@@ -3179,7 +3219,7 @@ class DroidRhythmEvaluator {
|
|
|
3179
3219
|
// If we're speeding up, this stays as is and we keep counting island size.
|
|
3180
3220
|
firstDeltaSwitch = false;
|
|
3181
3221
|
}
|
|
3182
|
-
island = new Island(currentDelta
|
|
3222
|
+
island = new Island(currentDelta);
|
|
3183
3223
|
}
|
|
3184
3224
|
}
|
|
3185
3225
|
else if (prevDelta > currentDelta + deltaDifferenceEpsilon) {
|
|
@@ -3197,7 +3237,7 @@ class DroidRhythmEvaluator {
|
|
|
3197
3237
|
effectiveRatio *= 0.6;
|
|
3198
3238
|
}
|
|
3199
3239
|
startRatio = effectiveRatio;
|
|
3200
|
-
island = new Island(currentDelta
|
|
3240
|
+
island = new Island(currentDelta);
|
|
3201
3241
|
}
|
|
3202
3242
|
lastObject = prevObject;
|
|
3203
3243
|
prevObject = currentObject;
|
|
@@ -3694,6 +3734,7 @@ class OsuFlashlightEvaluator {
|
|
|
3694
3734
|
* @param mods The mods used.
|
|
3695
3735
|
*/
|
|
3696
3736
|
static evaluateDifficultyOf(current, mods) {
|
|
3737
|
+
var _a;
|
|
3697
3738
|
if (current.object instanceof osuBase.Spinner) {
|
|
3698
3739
|
return 0;
|
|
3699
3740
|
}
|
|
@@ -3703,6 +3744,10 @@ class OsuFlashlightEvaluator {
|
|
|
3703
3744
|
let result = 0;
|
|
3704
3745
|
let last = current;
|
|
3705
3746
|
let angleRepeatCount = 0;
|
|
3747
|
+
// Hidden's fade-out only affects opacity when the "only fade approach circles" setting is off.
|
|
3748
|
+
const opacityMods = ((_a = mods.get(osuBase.ModHidden)) === null || _a === void 0 ? void 0 : _a.onlyFadeApproachCircles.value)
|
|
3749
|
+
? undefined
|
|
3750
|
+
: mods;
|
|
3706
3751
|
for (let i = 0; i < Math.min(current.index, 10); ++i) {
|
|
3707
3752
|
const currentObject = current.previous(i);
|
|
3708
3753
|
cumulativeStrainTime += last.strainTime;
|
|
@@ -3718,7 +3763,7 @@ class OsuFlashlightEvaluator {
|
|
|
3718
3763
|
const opacityBonus = 1 +
|
|
3719
3764
|
this.maxOpacityBonus *
|
|
3720
3765
|
(1 -
|
|
3721
|
-
current.opacityAt(currentObject.object.startTime,
|
|
3766
|
+
current.opacityAt(currentObject.object.startTime, opacityMods));
|
|
3722
3767
|
result +=
|
|
3723
3768
|
(stackNerf * opacityBonus * scalingFactor * jumpDistance) /
|
|
3724
3769
|
cumulativeStrainTime;
|
|
@@ -4300,9 +4345,9 @@ class OsuRhythmEvaluator {
|
|
|
4300
4345
|
}
|
|
4301
4346
|
const deltaDifferenceEpsilon = current.hitWindowFor(osuBase.HitResult.Great) * 0.3;
|
|
4302
4347
|
let rhythmComplexitySum = 0;
|
|
4303
|
-
let island = new Island(
|
|
4304
|
-
let previousIsland = new Island(
|
|
4305
|
-
const
|
|
4348
|
+
let island = new Island(Number.MAX_SAFE_INTEGER);
|
|
4349
|
+
let previousIsland = new Island(Number.MAX_SAFE_INTEGER);
|
|
4350
|
+
const islands = [];
|
|
4306
4351
|
// Store the ratio of the current start of an island to buff for tighter rhythms.
|
|
4307
4352
|
let startRatio = 0;
|
|
4308
4353
|
let firstDeltaSwitch = false;
|
|
@@ -4332,7 +4377,7 @@ class OsuRhythmEvaluator {
|
|
|
4332
4377
|
const prevDelta = Math.max(prevObject.deltaTime, 1e-7);
|
|
4333
4378
|
const lastDelta = Math.max(lastObject.deltaTime, 1e-7);
|
|
4334
4379
|
if (island.delta == Number.MAX_SAFE_INTEGER) {
|
|
4335
|
-
island = new Island(currentDelta
|
|
4380
|
+
island = new Island(currentDelta);
|
|
4336
4381
|
}
|
|
4337
4382
|
// Calculate how much current delta difference deserves a rhythm bonus
|
|
4338
4383
|
// This function is meant to reduce rhythm bonus for deltas that are multiples of each other (i.e. 100 and 200)
|
|
@@ -4368,7 +4413,7 @@ class OsuRhythmEvaluator {
|
|
|
4368
4413
|
effectiveRatio /= 2;
|
|
4369
4414
|
}
|
|
4370
4415
|
// Repeated island polarity (2 -> 4, 3 -> 5).
|
|
4371
|
-
if (island.isSimilarPolarity(previousIsland)) {
|
|
4416
|
+
if (island.isSimilarPolarity(previousIsland, deltaDifferenceEpsilon)) {
|
|
4372
4417
|
effectiveRatio /= 2;
|
|
4373
4418
|
}
|
|
4374
4419
|
// Previous increase happened a note ago.
|
|
@@ -4385,18 +4430,24 @@ class OsuRhythmEvaluator {
|
|
|
4385
4430
|
if (isSpeedingUp) {
|
|
4386
4431
|
effectiveRatio *= 0.65;
|
|
4387
4432
|
}
|
|
4388
|
-
|
|
4389
|
-
|
|
4433
|
+
let found = false;
|
|
4434
|
+
for (const existingIsland of islands) {
|
|
4435
|
+
if (!existingIsland.almostEquals(island, deltaDifferenceEpsilon)) {
|
|
4436
|
+
continue;
|
|
4437
|
+
}
|
|
4390
4438
|
// Only add island to island counts if they're going one after another.
|
|
4391
|
-
if (previousIsland.
|
|
4392
|
-
++
|
|
4439
|
+
if (previousIsland.almostEquals(island, deltaDifferenceEpsilon)) {
|
|
4440
|
+
++existingIsland.occurrences;
|
|
4393
4441
|
}
|
|
4442
|
+
const power = osuBase.MathUtils.offsetLogistic(island.delta, 58.33, 0.24, 2.75);
|
|
4394
4443
|
// Repeated island (ex: triplet -> triplet).
|
|
4395
4444
|
// Graph: https://www.desmos.com/calculator/pj7an56zwf
|
|
4396
|
-
effectiveRatio *= Math.min(3 /
|
|
4445
|
+
effectiveRatio *= Math.min(3 / existingIsland.occurrences, Math.pow(1 / existingIsland.occurrences, power));
|
|
4446
|
+
found = true;
|
|
4447
|
+
break;
|
|
4397
4448
|
}
|
|
4398
|
-
|
|
4399
|
-
|
|
4449
|
+
if (!found && island.deltaCount > 0) {
|
|
4450
|
+
islands.push(island);
|
|
4400
4451
|
}
|
|
4401
4452
|
// Scale down the difficulty if the object is doubletappable.
|
|
4402
4453
|
effectiveRatio *=
|
|
@@ -4417,7 +4468,7 @@ class OsuRhythmEvaluator {
|
|
|
4417
4468
|
// If we're speeding up, this stays as is and we keep counting island size.
|
|
4418
4469
|
firstDeltaSwitch = false;
|
|
4419
4470
|
}
|
|
4420
|
-
island = new Island(currentDelta
|
|
4471
|
+
island = new Island(currentDelta);
|
|
4421
4472
|
}
|
|
4422
4473
|
}
|
|
4423
4474
|
else if (prevDelta > currentDelta + deltaDifferenceEpsilon) {
|
|
@@ -4435,7 +4486,7 @@ class OsuRhythmEvaluator {
|
|
|
4435
4486
|
effectiveRatio *= 0.6;
|
|
4436
4487
|
}
|
|
4437
4488
|
startRatio = effectiveRatio;
|
|
4438
|
-
island = new Island(currentDelta
|
|
4489
|
+
island = new Island(currentDelta);
|
|
4439
4490
|
}
|
|
4440
4491
|
lastObject = prevObject;
|
|
4441
4492
|
prevObject = currentObject;
|
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.96",
|
|
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.96"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "13af8d35ad74141c270c6b985941b5f2a14e248b"
|
|
42
42
|
}
|
package/typings/index.d.ts
CHANGED
|
@@ -130,6 +130,10 @@ declare abstract class DifficultyHitObject {
|
|
|
130
130
|
* The beatmap clock rate.
|
|
131
131
|
*/
|
|
132
132
|
readonly clockRate: number;
|
|
133
|
+
/**
|
|
134
|
+
* Whether this hitobject is a 2B slider.
|
|
135
|
+
*/
|
|
136
|
+
get is2BSlider(): boolean;
|
|
133
137
|
/**
|
|
134
138
|
* Selective bonus for beatmaps with higher circle size.
|
|
135
139
|
*/
|
|
@@ -415,17 +419,10 @@ declare abstract class Skill {
|
|
|
415
419
|
*/
|
|
416
420
|
protected readonly mods: ModMap;
|
|
417
421
|
private _objectDifficulties;
|
|
418
|
-
private _objectTimes;
|
|
419
422
|
/**
|
|
420
423
|
* The difficulties of {@link DifficultyHitObject}s, populated by {@link Skill.process}.
|
|
421
424
|
*/
|
|
422
425
|
protected get objectDifficulties(): readonly number[];
|
|
423
|
-
/**
|
|
424
|
-
* The start times of {@link DifficultyHitObject}s, populated by {@link Skill.process}.
|
|
425
|
-
*
|
|
426
|
-
* Indices correspond to {@link objectDifficulties}.
|
|
427
|
-
*/
|
|
428
|
-
protected get objectTimes(): readonly number[];
|
|
429
426
|
constructor(mods: ModMap);
|
|
430
427
|
/**
|
|
431
428
|
* Calculates the strain value of a hitobject and stores the value in it.
|
|
@@ -1797,12 +1794,19 @@ declare class DroidFlashlight extends DroidSkill {
|
|
|
1797
1794
|
*/
|
|
1798
1795
|
declare abstract class HarmonicSkill extends Skill implements IHasPeakDifficulty {
|
|
1799
1796
|
private _noteWeightSum;
|
|
1797
|
+
private _objectTimes;
|
|
1800
1798
|
/**
|
|
1801
1799
|
* The sum of note weights, calculated during summation.
|
|
1802
1800
|
*
|
|
1803
1801
|
* Required for any calculations that normalizes the difficulty value.
|
|
1804
1802
|
*/
|
|
1805
1803
|
protected get noteWeightSum(): number;
|
|
1804
|
+
/**
|
|
1805
|
+
* The start times of {@link DifficultyHitObject}s, populated by {@link HarmonicSkill.process}.
|
|
1806
|
+
*
|
|
1807
|
+
* Indices correspond to {@link objectDifficulties}.
|
|
1808
|
+
*/
|
|
1809
|
+
protected get objectTimes(): readonly number[];
|
|
1806
1810
|
/**
|
|
1807
1811
|
* Scaling factor applied as `x / (i + 1)`, where `x` is the skill's {@link harmonicScale} and `i`
|
|
1808
1812
|
* is the index of the {@link DifficultyHitObject} being processed.
|
|
@@ -1833,6 +1837,7 @@ declare abstract class HarmonicSkill extends Skill implements IHasPeakDifficulty
|
|
|
1833
1837
|
* @param difficulties The difficulties of {@link DifficultyHitObject}s to transform.
|
|
1834
1838
|
*/
|
|
1835
1839
|
protected applyDifficultyTransformation(difficulties: number[]): void;
|
|
1840
|
+
process(current: DifficultyHitObject): void;
|
|
1836
1841
|
protected processInternal(current: DifficultyHitObject): number;
|
|
1837
1842
|
/**
|
|
1838
1843
|
* Calculates the difficulty value of a {@link DifficultyHitObject}. This value is calculated with or without respect to previous objects.
|