@rian8337/osu-rebalance-difficulty-calculator 1.2.5 → 1.2.8
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/README.md +105 -1
- package/dist/skills/DroidRhythm.js +7 -4
- package/dist/skills/DroidTap.js +2 -2
- package/package.json +4 -4
- package/typings/index.d.ts +4 -4
package/README.md
CHANGED
|
@@ -28,6 +28,10 @@ yarn add @rian8337/osu-base @rian8337/osu-rebalance-difficulty-calculator
|
|
|
28
28
|
|
|
29
29
|
## General usage
|
|
30
30
|
|
|
31
|
+
# Usage
|
|
32
|
+
|
|
33
|
+
## Difficulty calculator
|
|
34
|
+
|
|
31
35
|
```js
|
|
32
36
|
import { MapInfo } from "@rian8337/osu-base";
|
|
33
37
|
import {
|
|
@@ -67,7 +71,7 @@ console.log(rating.droidStars);
|
|
|
67
71
|
console.log(rating.pcStars);
|
|
68
72
|
```
|
|
69
73
|
|
|
70
|
-
|
|
74
|
+
### Specifying difficulty calculation parameters
|
|
71
75
|
|
|
72
76
|
Parameters can be applied to alter the result of the calculation:
|
|
73
77
|
|
|
@@ -104,3 +108,103 @@ console.log(rating.droidStars);
|
|
|
104
108
|
// osu!standard difficulty
|
|
105
109
|
console.log(rating.pcStars);
|
|
106
110
|
```
|
|
111
|
+
|
|
112
|
+
## Performance calculator
|
|
113
|
+
|
|
114
|
+
```js
|
|
115
|
+
import { MapInfo } from "@rian8337/osu-base";
|
|
116
|
+
import {
|
|
117
|
+
DroidPerformanceCalculator,
|
|
118
|
+
MapStars,
|
|
119
|
+
OsuPerformanceCalculator,
|
|
120
|
+
} from "@rian8337/osu-rebalance-difficulty-calculator";
|
|
121
|
+
|
|
122
|
+
const beatmapInfo = await MapInfo.getInformation({ beatmapID: 901854 });
|
|
123
|
+
|
|
124
|
+
if (!beatmapInfo.title) {
|
|
125
|
+
return console.log("Beatmap not found");
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const rating = new MapStars().calculate({
|
|
129
|
+
map: beatmapInfo.map,
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
// osu!droid performance
|
|
133
|
+
const droidPerformance = new DroidPerformanceCalculator().calculate({
|
|
134
|
+
stars: rating.droidStars,
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
console.log(droidPerformance);
|
|
138
|
+
|
|
139
|
+
// osu!standard performance
|
|
140
|
+
const osuPerformance = new OsuPerformanceCalculator().calculate({
|
|
141
|
+
stars: rating.pcStars,
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
console.log(osuPerformance);
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Specifying performance calculation parameters
|
|
148
|
+
|
|
149
|
+
Parameters can be passed to alter the result of the calculation:
|
|
150
|
+
|
|
151
|
+
- Combo: The maximum combo achieved. Defaults to the beatmap's maximum combo.
|
|
152
|
+
- Accuracy: The accuracy achieved. Defaults to 100%.
|
|
153
|
+
- Misses: The amount of misses achieved.
|
|
154
|
+
- Tap penalty: Penalty given from three-finger detection. Only applied for osu!droid gamemode. Defaults to 1.
|
|
155
|
+
- Custom statistics: Used to apply a custom speed multiplier and force AR. Defaults to none.
|
|
156
|
+
|
|
157
|
+
```js
|
|
158
|
+
import { Accuracy, MapInfo, MapStats } from "@rian8337/osu-base";
|
|
159
|
+
import {
|
|
160
|
+
OsuPerformanceCalculator,
|
|
161
|
+
OsuStarRating,
|
|
162
|
+
} from "@rian8337/osu-rebalance-difficulty-calculator";
|
|
163
|
+
|
|
164
|
+
const beatmapInfo = await MapInfo.getInformation({ beatmapID: 901854 });
|
|
165
|
+
|
|
166
|
+
if (!beatmapInfo.title) {
|
|
167
|
+
return console.log("Beatmap not found");
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const rating = new OsuStarRating().calculate({
|
|
171
|
+
map: beatmapInfo.map,
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
const accuracy = new Accuracy({
|
|
175
|
+
// Specify your misses here
|
|
176
|
+
nmiss: 1,
|
|
177
|
+
|
|
178
|
+
// The module provides a convenient way to specify accuracy based on the data that you have
|
|
179
|
+
// Remove the codes below as you see fit
|
|
180
|
+
|
|
181
|
+
// If you have hit data (amount of 300s, 100s, and 50s)
|
|
182
|
+
n300: 1000,
|
|
183
|
+
n100: 0,
|
|
184
|
+
n50: 0,
|
|
185
|
+
|
|
186
|
+
// If you have accuracy percentage
|
|
187
|
+
// While this method is more convenient to use, the amount of 300s, 100s, and 50s will be estimated
|
|
188
|
+
// This will lead to values being off when calculating for specific accuracies
|
|
189
|
+
percent: 100,
|
|
190
|
+
nobjects: beatmapInfo.objects,
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
const stats = new MapStats({
|
|
194
|
+
ar: 9.5,
|
|
195
|
+
isForceAR: true,
|
|
196
|
+
speedMultiplier: 1.25,
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
const performance = new OsuPerformanceCalculator().calculate({
|
|
200
|
+
stars: rating,
|
|
201
|
+
combo: 1250,
|
|
202
|
+
accPercent: accuracy,
|
|
203
|
+
// The tap penalty can be properly obtained by checking a replay for three finger usage
|
|
204
|
+
// However, a custom value can also be provided
|
|
205
|
+
tapPenalty: 1.5,
|
|
206
|
+
stats: stats,
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
console.log(performance);
|
|
210
|
+
```
|
|
@@ -13,12 +13,15 @@ class DroidRhythm extends DroidSkill_1.DroidSkill {
|
|
|
13
13
|
this.skillMultiplier = 1;
|
|
14
14
|
this.reducedSectionCount = 5;
|
|
15
15
|
this.reducedSectionBaseline = 0.75;
|
|
16
|
-
this.strainDecayBase = 0.
|
|
16
|
+
this.strainDecayBase = 0.3;
|
|
17
17
|
this.starsPerDouble = 1.75;
|
|
18
|
-
this.rhythmMultiplier = 0.75;
|
|
19
18
|
this.historyTimeMax = 5000; // 5 seconds of calculateRhythmBonus max.
|
|
20
19
|
this.currentRhythm = 1;
|
|
21
20
|
this.hitWindow = new osu_base_1.OsuHitWindow(overallDifficulty);
|
|
21
|
+
const odScaling = Math.pow(this.hitWindow.overallDifficulty, 2) / 400;
|
|
22
|
+
this.rhythmMultiplier =
|
|
23
|
+
0.75 +
|
|
24
|
+
(this.hitWindow.overallDifficulty >= 0 ? odScaling : -odScaling);
|
|
22
25
|
}
|
|
23
26
|
/**
|
|
24
27
|
* Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current object.
|
|
@@ -55,8 +58,8 @@ class DroidRhythm extends DroidSkill_1.DroidSkill {
|
|
|
55
58
|
(Math.min(prevDelta, currentDelta) /
|
|
56
59
|
Math.max(prevDelta, currentDelta))), 2));
|
|
57
60
|
const windowPenalty = Math.min(1, Math.max(0, Math.abs(prevDelta - currentDelta) -
|
|
58
|
-
this.hitWindow.hitWindowFor300() * 0.
|
|
59
|
-
(this.hitWindow.hitWindowFor300() * 0.
|
|
61
|
+
this.hitWindow.hitWindowFor300() * 0.4) /
|
|
62
|
+
(this.hitWindow.hitWindowFor300() * 0.4));
|
|
60
63
|
let effectiveRatio = windowPenalty * currentRatio;
|
|
61
64
|
if (firstDeltaSwitch) {
|
|
62
65
|
if (prevDelta <= 1.25 * currentDelta &&
|
package/dist/skills/DroidTap.js
CHANGED
|
@@ -37,8 +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
|
-
// 0.58 is derived from making sure 260 BPM 1/4 OD5 streams aren't nerfed harshly, whilst 0.
|
|
41
|
-
strainTime /= osu_base_1.MathUtils.clamp(strainTime / greatWindowFull / 0.58, 0.
|
|
40
|
+
// 0.58 is derived from making sure 260 BPM 1/4 OD5 streams aren't nerfed harshly, whilst 0.91 limits the effect of the cap.
|
|
41
|
+
strainTime /= osu_base_1.MathUtils.clamp(strainTime / greatWindowFull / 0.58, 0.91, 1);
|
|
42
42
|
let speedBonus = 1;
|
|
43
43
|
if (strainTime < this.minSpeedBonus) {
|
|
44
44
|
speedBonus +=
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rian8337/osu-rebalance-difficulty-calculator",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.8",
|
|
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",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"main": "dist/index.js",
|
|
13
13
|
"types": "typings/index.d.ts",
|
|
14
|
+
"typedocMain": "src/index.ts",
|
|
14
15
|
"files": [
|
|
15
16
|
"dist/**",
|
|
16
17
|
"typings/**"
|
|
@@ -21,7 +22,6 @@
|
|
|
21
22
|
},
|
|
22
23
|
"scripts": {
|
|
23
24
|
"build": "tsc",
|
|
24
|
-
"generate-docs": "typedoc src/index.ts",
|
|
25
25
|
"lint": "eslint --ext ts",
|
|
26
26
|
"prepare": "npm run build",
|
|
27
27
|
"test": "jest -i"
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"url": "https://github.com/Rian8337/osu-droid-module/issues"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@rian8337/osu-base": "^1.2.
|
|
33
|
+
"@rian8337/osu-base": "^1.2.8"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "3e633e510be04aca9c46b9361524251442049621"
|
|
39
39
|
}
|
package/typings/index.d.ts
CHANGED
|
@@ -877,9 +877,9 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
877
877
|
*/
|
|
878
878
|
mode?: modes;
|
|
879
879
|
/**
|
|
880
|
-
* The
|
|
880
|
+
* The tap penalty to apply for penalized scores. Only applies to droid gamemode.
|
|
881
881
|
*/
|
|
882
|
-
|
|
882
|
+
tapPenalty?: number;
|
|
883
883
|
/**
|
|
884
884
|
* Custom map statistics to apply custom speed multiplier and force AR values as well as old statistics.
|
|
885
885
|
*/
|
|
@@ -919,9 +919,9 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
919
919
|
*/
|
|
920
920
|
mode?: modes;
|
|
921
921
|
/**
|
|
922
|
-
* The
|
|
922
|
+
* The tap penalty to apply for penalized scores.
|
|
923
923
|
*/
|
|
924
|
-
|
|
924
|
+
tapPenalty?: number;
|
|
925
925
|
/**
|
|
926
926
|
* Custom map statistics to apply custom speed multiplier and force AR values as well as old statistics.
|
|
927
927
|
*/
|