@rian8337/osu-rebalance-difficulty-calculator 2.0.0-alpha.9 → 2.0.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.
package/README.md CHANGED
@@ -26,49 +26,39 @@ yarn add @rian8337/osu-base @rian8337/osu-rebalance-difficulty-calculator
26
26
 
27
27
  # Usage
28
28
 
29
- ## General usage
30
-
31
- # Usage
32
-
33
29
  ## Difficulty calculator
34
30
 
35
31
  ```js
36
32
  import { MapInfo } from "@rian8337/osu-base";
37
33
  import {
38
- DroidStarRating,
34
+ DroidDifficultyCalculator,
39
35
  MapStars,
40
- OsuStarRating,
36
+ OsuDifficultyCalculator,
41
37
  } from "@rian8337/osu-rebalance-difficulty-calculator";
42
38
 
43
- const beatmapInfo = await MapInfo.getInformation({ beatmapID: 901854 });
39
+ const beatmapInfo = await MapInfo.getInformation(901854);
44
40
 
45
41
  if (!beatmapInfo.title) {
46
42
  return console.log("Beatmap not found");
47
43
  }
48
44
 
49
45
  // Calculate osu!droid difficulty
50
- const droidRating = new DroidStarRating().calculate({
51
- map: beatmapInfo.map,
52
- });
46
+ const droidRating = new DroidDifficultyCalculator(beatmapInfo.map).calculate();
53
47
 
54
48
  console.log(droidRating);
55
49
 
56
50
  // Calculate osu!standard difficulty
57
- const osuRating = new OsuStarRating().calculate({
58
- map: beatmapInfo.map,
59
- });
51
+ const osuRating = new OsuDifficultyCalculator(beatmapInfo.map).calculate();
60
52
 
61
53
  console.log(osuRating);
62
54
 
63
55
  // Calculate both osu!droid and osu!standard difficulty
64
- const rating = new MapStars().calculate({
65
- map: beatmapInfo.map,
66
- });
56
+ const rating = new MapStars(beatmapInfo.map);
67
57
 
68
58
  // osu!droid difficulty
69
- console.log(rating.droidStars);
59
+ console.log(rating.droid);
70
60
  // osu!standard difficulty
71
- console.log(rating.pcStars);
61
+ console.log(rating.osu);
72
62
  ```
73
63
 
74
64
  ### Specifying difficulty calculation parameters
@@ -82,7 +72,7 @@ Parameters can be applied to alter the result of the calculation:
82
72
  import { MapInfo, MapStats, ModUtil } from "@rian8337/osu-base";
83
73
  import { MapStars } from "@rian8337/osu-rebalance-difficulty-calculator";
84
74
 
85
- const beatmapInfo = await MapInfo.getInformation({ beatmapID: 901854 });
75
+ const beatmapInfo = await MapInfo.getInformation(901854);
86
76
 
87
77
  if (!beatmapInfo.title) {
88
78
  return console.log("Beatmap not found");
@@ -96,17 +86,16 @@ const stats = new MapStats({
96
86
  speedMultiplier: 1.5,
97
87
  });
98
88
 
99
- // Also available for `DroidStarRating` and `OsuStarRating`
100
- const rating = new MapStars().calculate({
101
- map: beatmapInfo.map,
89
+ // Also available in `DroidDifficultyCalculator` and `OsuDifficultyCalculator` as a parameter of `calculate`
90
+ const rating = new MapStars(beatmapInfo.map, {
102
91
  mods: mods,
103
92
  stats: stats,
104
93
  });
105
94
 
106
95
  // osu!droid difficulty
107
- console.log(rating.droidStars);
96
+ console.log(rating.droid);
108
97
  // osu!standard difficulty
109
- console.log(rating.pcStars);
98
+ console.log(rating.osu);
110
99
  ```
111
100
 
112
101
  ## Performance calculator
@@ -119,27 +108,23 @@ import {
119
108
  OsuPerformanceCalculator,
120
109
  } from "@rian8337/osu-rebalance-difficulty-calculator";
121
110
 
122
- const beatmapInfo = await MapInfo.getInformation({ beatmapID: 901854 });
111
+ const beatmapInfo = await MapInfo.getInformation(901854);
123
112
 
124
113
  if (!beatmapInfo.title) {
125
114
  return console.log("Beatmap not found");
126
115
  }
127
116
 
128
- const rating = new MapStars().calculate({
129
- map: beatmapInfo.map,
130
- });
117
+ const rating = new MapStars(beatmapInfo.map);
131
118
 
132
119
  // osu!droid performance
133
- const droidPerformance = new DroidPerformanceCalculator().calculate({
134
- stars: rating.droidStars,
135
- });
120
+ const droidPerformance = new DroidPerformanceCalculator(
121
+ rating.droid
122
+ ).calculate();
136
123
 
137
124
  console.log(droidPerformance);
138
125
 
139
126
  // osu!standard performance
140
- const osuPerformance = new OsuPerformanceCalculator().calculate({
141
- stars: rating.pcStars,
142
- });
127
+ const osuPerformance = new OsuPerformanceCalculator(rating.osu).calculate();
143
128
 
144
129
  console.log(osuPerformance);
145
130
  ```
@@ -158,18 +143,16 @@ Parameters can be passed to alter the result of the calculation:
158
143
  import { Accuracy, MapInfo, MapStats } from "@rian8337/osu-base";
159
144
  import {
160
145
  OsuPerformanceCalculator,
161
- OsuStarRating,
146
+ OsuDifficultyCalculator,
162
147
  } from "@rian8337/osu-rebalance-difficulty-calculator";
163
148
 
164
- const beatmapInfo = await MapInfo.getInformation({ beatmapID: 901854 });
149
+ const beatmapInfo = await MapInfo.getInformation(901854);
165
150
 
166
151
  if (!beatmapInfo.title) {
167
152
  return console.log("Beatmap not found");
168
153
  }
169
154
 
170
- const rating = new OsuStarRating().calculate({
171
- map: beatmapInfo.map,
172
- });
155
+ const rating = new OsuDifficultyCalculator(beatmapInfo.map).calculate();
173
156
 
174
157
  const accuracy = new Accuracy({
175
158
  // Specify your misses here
@@ -196,11 +179,11 @@ const stats = new MapStats({
196
179
  speedMultiplier: 1.25,
197
180
  });
198
181
 
199
- const performance = new OsuPerformanceCalculator().calculate({
200
- stars: rating,
182
+ const performance = new OsuPerformanceCalculator(rating).calculate({
201
183
  combo: 1250,
202
184
  accPercent: accuracy,
203
- // The tap penalty can be properly obtained by checking a replay for three finger usage
185
+ // The tap penalty will only be used by `DroidPerformanceCalculator` and
186
+ // can be properly obtained by checking a replay for three finger usage
204
187
  // However, a custom value can also be provided
205
188
  tapPenalty: 1.5,
206
189
  stats: stats,