@rian8337/osu-base 1.3.0 → 1.4.2

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.
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SliderHead = void 0;
4
+ const Circle_1 = require("../Circle");
5
+ /**
6
+ * Represents the head of a slider.
7
+ */
8
+ class SliderHead extends Circle_1.Circle {
9
+ }
10
+ exports.SliderHead = SliderHead;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SliderRepeat = void 0;
4
+ const HitObject_1 = require("../HitObject");
5
+ /**
6
+ * Represents a repeat point in a slider.
7
+ */
8
+ class SliderRepeat extends HitObject_1.HitObject {
9
+ constructor(values) {
10
+ super({
11
+ startTime: values.startTime,
12
+ position: values.position,
13
+ });
14
+ this.repeatIndex = values.repeatIndex;
15
+ this.spanDuration = values.spanDuration;
16
+ }
17
+ toString() {
18
+ return `Position: [${this.position.x}, ${this.position.y}], repeat index: ${this.repeatIndex}, span duration: ${this.spanDuration}`;
19
+ }
20
+ }
21
+ exports.SliderRepeat = SliderRepeat;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SliderTail = void 0;
4
+ const Circle_1 = require("../Circle");
5
+ /**
6
+ * Represents the tail of a slider.
7
+ */
8
+ class SliderTail extends Circle_1.Circle {
9
+ }
10
+ exports.SliderTail = SliderTail;
@@ -177,7 +177,7 @@ class MapInfo {
177
177
  const map = new MapInfo();
178
178
  const result = await apiRequestBuilder.sendRequest();
179
179
  if (result.statusCode !== 200) {
180
- throw new Error("API error");
180
+ throw new Error("osu! API error");
181
181
  }
182
182
  const mapinfo = JSON.parse(result.data.toString("utf-8"))[0];
183
183
  if (!mapinfo) {
@@ -173,9 +173,7 @@ class MapStats {
173
173
  static modifyAR(baseAR, speedMultiplier, statisticsMultiplier) {
174
174
  let ar = baseAR;
175
175
  ar *= statisticsMultiplier;
176
- let arMS = ar < 5.0
177
- ? this.AR0_MS - this.AR_MS_STEP1 * ar
178
- : this.AR5_MS - this.AR_MS_STEP2 * (ar - 5);
176
+ let arMS = this.arToMS(ar);
179
177
  arMS = Math.min(this.AR0_MS, Math.max(this.AR10_MS, arMS));
180
178
  arMS /= speedMultiplier;
181
179
  ar =
@@ -184,6 +182,17 @@ class MapStats {
184
182
  : 5 + (this.AR5_MS - arMS) / this.AR_MS_STEP2;
185
183
  return ar;
186
184
  }
185
+ /**
186
+ * Converts an AR value to its milliseconds value.
187
+ *
188
+ * @param ar The AR to convert.
189
+ * @returns The milliseconds value represented by the AR.
190
+ */
191
+ static arToMS(ar) {
192
+ return ar < 5.0
193
+ ? this.AR0_MS - this.AR_MS_STEP1 * ar
194
+ : this.AR5_MS - this.AR_MS_STEP2 * (ar - 5);
195
+ }
187
196
  /**
188
197
  * Utility function to apply speed and flat multipliers to stats where speed changes apply for OD.
189
198
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rian8337/osu-base",
3
- "version": "1.3.0",
3
+ "version": "1.4.2",
4
4
  "description": "Base module for all osu! related modules.",
5
5
  "keywords": [
6
6
  "osu",
@@ -41,5 +41,5 @@
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  },
44
- "gitHead": "0efc41e2d7f077aaf388424318ee9bd356ff611f"
44
+ "gitHead": "5dee4c74e815dfee236e912ce40a6a7d363d62be"
45
45
  }
@@ -170,7 +170,7 @@ declare module "@rian8337/osu-base" {
170
170
  *
171
171
  * @param mods The modifications to calculate for. Defaults to No Mod.
172
172
  */
173
- maxOsuScore(mods: Mod[] = []): number;
173
+ maxOsuScore(mods?: Mod[]): number;
174
174
  /**
175
175
  * Calculates the maximum score with a given difficulty and score multiplier.
176
176
  *
@@ -705,6 +705,13 @@ declare module "@rian8337/osu-base" {
705
705
  speedMultiplier: number,
706
706
  statisticsMultiplier: number
707
707
  ): number;
708
+ /**
709
+ * Converts an AR value to its milliseconds value.
710
+ *
711
+ * @param ar The AR to convert.
712
+ * @returns The milliseconds value represented by the AR.
713
+ */
714
+ static arToMS(ar: number): number;
708
715
  /**
709
716
  * Utility function to apply speed and flat multipliers to stats where speed changes apply for OD.
710
717
  *