@rian8337/osu-rebalance-difficulty-calculator 1.2.7 → 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 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
- ## Specifying parameters
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
+ ```
@@ -18,7 +18,7 @@ class DroidRhythm extends DroidSkill_1.DroidSkill {
18
18
  this.historyTimeMax = 5000; // 5 seconds of calculateRhythmBonus max.
19
19
  this.currentRhythm = 1;
20
20
  this.hitWindow = new osu_base_1.OsuHitWindow(overallDifficulty);
21
- const odScaling = Math.pow(this.hitWindow.overallDifficulty, 2) / 250;
21
+ const odScaling = Math.pow(this.hitWindow.overallDifficulty, 2) / 400;
22
22
  this.rhythmMultiplier =
23
23
  0.75 +
24
24
  (this.hitWindow.overallDifficulty >= 0 ? odScaling : -odScaling);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rian8337/osu-rebalance-difficulty-calculator",
3
- "version": "1.2.7",
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.1"
33
+ "@rian8337/osu-base": "^1.2.8"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
- "gitHead": "18927f60c831515a666c7f7400beaa7573f28b64"
38
+ "gitHead": "3e633e510be04aca9c46b9361524251442049621"
39
39
  }
@@ -877,9 +877,9 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
877
877
  */
878
878
  mode?: modes;
879
879
  /**
880
- * The speed penalty to apply for penalized scores. Only applies to droid gamemode.
880
+ * The tap penalty to apply for penalized scores. Only applies to droid gamemode.
881
881
  */
882
- speedPenalty?: number;
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 speed penalty to apply for penalized scores.
922
+ * The tap penalty to apply for penalized scores.
923
923
  */
924
- speedPenalty?: number;
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
  */