@rian8337/osu-difficulty-calculator 1.1.1 → 1.2.0
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.
|
@@ -153,7 +153,7 @@ class DroidPerformanceCalculator extends PerformanceCalculator_1.PerformanceCalc
|
|
|
153
153
|
(0.95 + (od > 0 ? odScaling : -odScaling)) *
|
|
154
154
|
Math.pow((this.computedAccuracy.value(objectCount) +
|
|
155
155
|
relevantAccuracy.value(this.stars.attributes.speedNoteCount)) /
|
|
156
|
-
2, (
|
|
156
|
+
2, (14 - Math.max(od, 2.5)) / 2);
|
|
157
157
|
// Scale the speed value with # of 50s to punish doubletapping.
|
|
158
158
|
this.tap *= Math.pow(0.98, Math.max(0, this.computedAccuracy.n50 - objectCount / 500));
|
|
159
159
|
}
|
package/dist/DroidStarRating.js
CHANGED
|
@@ -59,14 +59,7 @@ class DroidStarRating extends StarRating_1.StarRating {
|
|
|
59
59
|
const aimSkill = new DroidAim_1.DroidAim(this.mods, true);
|
|
60
60
|
const aimSkillWithoutSliders = new DroidAim_1.DroidAim(this.mods, false);
|
|
61
61
|
this.calculateSkills(aimSkill, aimSkillWithoutSliders);
|
|
62
|
-
this.
|
|
63
|
-
this.strainPeaks.aimWithoutSliders = aimSkillWithoutSliders.strainPeaks;
|
|
64
|
-
this.aim = this.starValue(aimSkill.difficultyValue());
|
|
65
|
-
if (this.aim) {
|
|
66
|
-
this.attributes.sliderFactor =
|
|
67
|
-
this.starValue(aimSkillWithoutSliders.difficultyValue()) /
|
|
68
|
-
this.aim;
|
|
69
|
-
}
|
|
62
|
+
this.postCalculateAim(aimSkill, aimSkillWithoutSliders);
|
|
70
63
|
}
|
|
71
64
|
/**
|
|
72
65
|
* Calculates the speed star rating of the beatmap and stores it in this instance.
|
|
@@ -74,13 +67,7 @@ class DroidStarRating extends StarRating_1.StarRating {
|
|
|
74
67
|
calculateTap() {
|
|
75
68
|
const tapSkill = new DroidTap_1.DroidTap(this.mods, this.stats.od);
|
|
76
69
|
this.calculateSkills(tapSkill);
|
|
77
|
-
this.
|
|
78
|
-
this.tap = this.starValue(tapSkill.difficultyValue());
|
|
79
|
-
const objectStrains = this.objects.map((v) => v.tapStrain);
|
|
80
|
-
const maxStrain = Math.max(...objectStrains);
|
|
81
|
-
if (maxStrain) {
|
|
82
|
-
this.attributes.speedNoteCount = objectStrains.reduce((total, next) => total + 1 / (1 + Math.exp(-((next / maxStrain) * 12 - 6))), 0);
|
|
83
|
-
}
|
|
70
|
+
this.postCalculateTap(tapSkill);
|
|
84
71
|
}
|
|
85
72
|
/**
|
|
86
73
|
* Calculates the rhythm star rating of the beatmap and stores it in this instance.
|
|
@@ -88,7 +75,7 @@ class DroidStarRating extends StarRating_1.StarRating {
|
|
|
88
75
|
calculateRhythm() {
|
|
89
76
|
const rhythmSkill = new DroidRhythm_1.DroidRhythm(this.mods, this.stats.od);
|
|
90
77
|
this.calculateSkills(rhythmSkill);
|
|
91
|
-
this.
|
|
78
|
+
this.postCalculateRhythm(rhythmSkill);
|
|
92
79
|
}
|
|
93
80
|
/**
|
|
94
81
|
* Calculates the flashlight star rating of the beatmap and stores it in this instance.
|
|
@@ -96,8 +83,7 @@ class DroidStarRating extends StarRating_1.StarRating {
|
|
|
96
83
|
calculateFlashlight() {
|
|
97
84
|
const flashlightSkill = new DroidFlashlight_1.DroidFlashlight(this.mods);
|
|
98
85
|
this.calculateSkills(flashlightSkill);
|
|
99
|
-
this.
|
|
100
|
-
this.flashlight = this.starValue(flashlightSkill.difficultyValue());
|
|
86
|
+
this.postCalculateFlashlight(flashlightSkill);
|
|
101
87
|
}
|
|
102
88
|
calculateTotal() {
|
|
103
89
|
const aimPerformanceValue = this.basePerformanceValue(this.aim);
|
|
@@ -125,28 +111,15 @@ class DroidStarRating extends StarRating_1.StarRating {
|
|
|
125
111
|
const rhythmSkill = skills[2];
|
|
126
112
|
const tapSkill = skills[3];
|
|
127
113
|
const flashlightSkill = skills[4];
|
|
128
|
-
this.
|
|
129
|
-
this.strainPeaks.aimWithoutSliders = aimSkillWithoutSliders.strainPeaks;
|
|
130
|
-
this.aim = this.starValue(aimSkill.difficultyValue());
|
|
131
|
-
if (this.aim) {
|
|
132
|
-
this.attributes.sliderFactor =
|
|
133
|
-
this.starValue(aimSkillWithoutSliders.difficultyValue()) /
|
|
134
|
-
this.aim;
|
|
135
|
-
}
|
|
114
|
+
this.postCalculateAim(aimSkill, aimSkillWithoutSliders);
|
|
136
115
|
if (!isRelax) {
|
|
137
|
-
this.
|
|
138
|
-
this.tap = this.starValue(tapSkill.difficultyValue());
|
|
139
|
-
}
|
|
140
|
-
const objectStrains = this.objects.map((v) => v.tapStrain);
|
|
141
|
-
const maxStrain = Math.max(...objectStrains);
|
|
142
|
-
if (maxStrain) {
|
|
143
|
-
this.attributes.speedNoteCount = objectStrains.reduce((total, next) => total + 1 / (1 + Math.exp(-((next / maxStrain) * 12 - 6))), 0);
|
|
116
|
+
this.postCalculateTap(tapSkill);
|
|
144
117
|
}
|
|
118
|
+
this.calculateSpeedNoteCount();
|
|
145
119
|
if (!isRelax) {
|
|
146
|
-
this.
|
|
120
|
+
this.postCalculateRhythm(rhythmSkill);
|
|
147
121
|
}
|
|
148
|
-
this.
|
|
149
|
-
this.flashlight = this.starValue(flashlightSkill.difficultyValue());
|
|
122
|
+
this.postCalculateFlashlight(flashlightSkill);
|
|
150
123
|
this.calculateTotal();
|
|
151
124
|
}
|
|
152
125
|
/**
|
|
@@ -177,5 +150,58 @@ class DroidStarRating extends StarRating_1.StarRating {
|
|
|
177
150
|
new DroidFlashlight_1.DroidFlashlight(this.mods),
|
|
178
151
|
];
|
|
179
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Called after aim skill calculation.
|
|
155
|
+
*
|
|
156
|
+
* @param aimSkill The aim skill that considers sliders.
|
|
157
|
+
* @param aimSkillWithoutSliders The aim skill that doesn't consider sliders.
|
|
158
|
+
*/
|
|
159
|
+
postCalculateAim(aimSkill, aimSkillWithoutSliders) {
|
|
160
|
+
this.strainPeaks.aimWithSliders = aimSkill.strainPeaks;
|
|
161
|
+
this.strainPeaks.aimWithoutSliders = aimSkillWithoutSliders.strainPeaks;
|
|
162
|
+
this.aim = this.starValue(aimSkill.difficultyValue());
|
|
163
|
+
if (this.aim) {
|
|
164
|
+
this.attributes.sliderFactor =
|
|
165
|
+
this.starValue(aimSkillWithoutSliders.difficultyValue()) /
|
|
166
|
+
this.aim;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Called after tap skill calculation.
|
|
171
|
+
*
|
|
172
|
+
* @param tapSkill The tap skill.
|
|
173
|
+
*/
|
|
174
|
+
postCalculateTap(tapSkill) {
|
|
175
|
+
this.strainPeaks.speed = tapSkill.strainPeaks;
|
|
176
|
+
this.tap = this.starValue(tapSkill.difficultyValue());
|
|
177
|
+
this.calculateSpeedNoteCount();
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Calculates the speed note count attribute.
|
|
181
|
+
*/
|
|
182
|
+
calculateSpeedNoteCount() {
|
|
183
|
+
const objectStrains = this.objects.map((v) => v.tapStrain);
|
|
184
|
+
const maxStrain = Math.max(...objectStrains);
|
|
185
|
+
if (maxStrain) {
|
|
186
|
+
this.attributes.speedNoteCount = objectStrains.reduce((total, next) => total + 1 / (1 + Math.exp(-((next / maxStrain) * 12 - 6))), 0);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Called after rhythm skill calculation.
|
|
191
|
+
*
|
|
192
|
+
* @param rhythmSkill The rhythm skill.
|
|
193
|
+
*/
|
|
194
|
+
postCalculateRhythm(rhythmSkill) {
|
|
195
|
+
this.rhythm = this.starValue(rhythmSkill.difficultyValue());
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Called after flashlight skill calculation.
|
|
199
|
+
*
|
|
200
|
+
* @param flashlightSkill The flashlight skill.
|
|
201
|
+
*/
|
|
202
|
+
postCalculateFlashlight(flashlightSkill) {
|
|
203
|
+
this.strainPeaks.flashlight = flashlightSkill.strainPeaks;
|
|
204
|
+
this.flashlight = this.starValue(flashlightSkill.difficultyValue());
|
|
205
|
+
}
|
|
180
206
|
}
|
|
181
207
|
exports.DroidStarRating = DroidStarRating;
|
|
@@ -122,7 +122,7 @@ class PerformanceCalculator {
|
|
|
122
122
|
comboBasedMissCount = Math.min(fullComboThreshold / Math.max(1, combo), this.stars.objects.length);
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
return Math.max(this.computedAccuracy.nmiss,
|
|
125
|
+
return Math.max(this.computedAccuracy.nmiss, comboBasedMissCount);
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
exports.PerformanceCalculator = PerformanceCalculator;
|
|
@@ -10,7 +10,7 @@ class DroidFlashlight extends DroidSkill_1.DroidSkill {
|
|
|
10
10
|
constructor() {
|
|
11
11
|
super(...arguments);
|
|
12
12
|
this.historyLength = 10;
|
|
13
|
-
this.skillMultiplier = 0.
|
|
13
|
+
this.skillMultiplier = 0.07;
|
|
14
14
|
this.strainDecayBase = 0.15;
|
|
15
15
|
this.reducedSectionCount = 10;
|
|
16
16
|
this.reducedSectionBaseline = 0.75;
|
|
@@ -24,22 +24,23 @@ class DroidFlashlight extends DroidSkill_1.DroidSkill {
|
|
|
24
24
|
let smallDistNerf = 1;
|
|
25
25
|
let cumulativeStrainTime = 0;
|
|
26
26
|
let result = 0;
|
|
27
|
+
let last = current;
|
|
27
28
|
for (let i = 0; i < this.previous.length; ++i) {
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
30
|
-
|
|
29
|
+
const currentObject = this.previous[i];
|
|
30
|
+
if (!(currentObject.object instanceof osu_base_1.Spinner)) {
|
|
31
|
+
const jumpDistance = current.object.stackedPosition.subtract(currentObject.object.endPosition).length;
|
|
32
|
+
cumulativeStrainTime += last.strainTime;
|
|
33
|
+
// We want to nerf objects that can be easily seen within the Flashlight circle radius.
|
|
34
|
+
if (i === 0) {
|
|
35
|
+
smallDistNerf = Math.min(1, jumpDistance / 75);
|
|
36
|
+
}
|
|
37
|
+
// We also want to nerf stacks so that only the first object of the stack is accounted for.
|
|
38
|
+
const stackNerf = Math.min(1, currentObject.lazyJumpDistance / scalingFactor / 25);
|
|
39
|
+
result +=
|
|
40
|
+
(stackNerf * scalingFactor * jumpDistance) /
|
|
41
|
+
cumulativeStrainTime;
|
|
31
42
|
}
|
|
32
|
-
|
|
33
|
-
cumulativeStrainTime += previous.strainTime;
|
|
34
|
-
// We want to nerf objects that can be easily seen within the Flashlight circle radius.
|
|
35
|
-
if (i === 0) {
|
|
36
|
-
smallDistNerf = Math.min(1, jumpDistance / 75);
|
|
37
|
-
}
|
|
38
|
-
// We also want to nerf stacks so that only the first object of the stack is accounted for.
|
|
39
|
-
const stackNerf = Math.min(1, previous.lazyJumpDistance / scalingFactor / 25);
|
|
40
|
-
result +=
|
|
41
|
-
(Math.pow(0.8, i) * stackNerf * scalingFactor * jumpDistance) /
|
|
42
|
-
cumulativeStrainTime;
|
|
43
|
+
last = currentObject;
|
|
43
44
|
}
|
|
44
45
|
return Math.pow(smallDistNerf * result, 2);
|
|
45
46
|
}
|
package/dist/skills/DroidTap.js
CHANGED
|
@@ -37,10 +37,8 @@ class DroidTap extends DroidSkill_1.DroidSkill {
|
|
|
37
37
|
strainTime = osu_base_1.Interpolation.lerp(this.previous[0].strainTime, strainTime, strainTime / greatWindowFull);
|
|
38
38
|
}
|
|
39
39
|
// Cap deltatime to the OD 300 hitwindow.
|
|
40
|
-
//
|
|
41
|
-
strainTime /= osu_base_1.MathUtils.clamp(strainTime /
|
|
42
|
-
new osu_base_1.OsuHitWindow(this.hitWindow.overallDifficulty - 21.5).hitWindowFor300() /
|
|
43
|
-
0.35, 0.9, 1);
|
|
40
|
+
// 0.58 is derived from making sure 260 BPM 1/4 OD5 streams aren't nerfed harshly, whilst 0.92 limits the effect of the cap.
|
|
41
|
+
strainTime /= osu_base_1.MathUtils.clamp(strainTime / greatWindowFull / 0.58, 0.92, 1);
|
|
44
42
|
let speedBonus = 1;
|
|
45
43
|
if (strainTime < this.minSpeedBonus) {
|
|
46
44
|
speedBonus +=
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rian8337/osu-difficulty-calculator",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
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",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "745e369ae1c5895e7a58188cb522eaecac618966"
|
|
39
39
|
}
|
package/typings/index.d.ts
CHANGED
|
@@ -382,6 +382,38 @@ declare module "@rian8337/osu-difficulty-calculator" {
|
|
|
382
382
|
* Creates skills to be calculated.
|
|
383
383
|
*/
|
|
384
384
|
protected override createSkills(): DroidSkill[];
|
|
385
|
+
/**
|
|
386
|
+
* Called after aim skill calculation.
|
|
387
|
+
*
|
|
388
|
+
* @param aimSkill The aim skill that considers sliders.
|
|
389
|
+
* @param aimSkillWithoutSliders The aim skill that doesn't consider sliders.
|
|
390
|
+
*/
|
|
391
|
+
private postCalculateAim(
|
|
392
|
+
aimSkill: DroidAim,
|
|
393
|
+
aimSkillWithoutSliders: DroidAim
|
|
394
|
+
): void;
|
|
395
|
+
/**
|
|
396
|
+
* Called after tap skill calculation.
|
|
397
|
+
*
|
|
398
|
+
* @param tapSkill The tap skill.
|
|
399
|
+
*/
|
|
400
|
+
private postCalculateTap(tapSkill: DroidTap): void;
|
|
401
|
+
/**
|
|
402
|
+
* Calculates the speed note count attribute.
|
|
403
|
+
*/
|
|
404
|
+
private calculateSpeedNoteCount(): void;
|
|
405
|
+
/**
|
|
406
|
+
* Called after rhythm skill calculation.
|
|
407
|
+
*
|
|
408
|
+
* @param rhythmSkill The rhythm skill.
|
|
409
|
+
*/
|
|
410
|
+
private postCalculateRhythm(rhythmSkill: DroidRhythm): void;
|
|
411
|
+
/**
|
|
412
|
+
* Called after flashlight skill calculation.
|
|
413
|
+
*
|
|
414
|
+
* @param flashlightSkill The flashlight skill.
|
|
415
|
+
*/
|
|
416
|
+
private postCalculateFlashlight(flashlightSkill: DroidFlashlight): void;
|
|
385
417
|
/**
|
|
386
418
|
* Calculates the base rating value of a difficulty.
|
|
387
419
|
*/
|