@rian8337/osu-base 4.0.0-beta.100 → 4.0.0-beta.103

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/dist/index.js CHANGED
@@ -3206,10 +3206,41 @@ class Spinner extends HitObject {
3206
3206
  get endTime() {
3207
3207
  return this._endTime;
3208
3208
  }
3209
+ /**
3210
+ * Number of spins required to finish this {@link Spinner} without miss.
3211
+ */
3212
+ get spinsRequired() {
3213
+ return this._spinsRequired;
3214
+ }
3209
3215
  constructor(values) {
3210
3216
  super(Object.assign(Object.assign({}, values), { position: Playfield.baseSize.divide(2) }));
3217
+ this._spinsRequired = 1;
3211
3218
  this._endTime = values.endTime;
3212
3219
  }
3220
+ applyDefaults(controlPoints, difficulty, mode) {
3221
+ super.applyDefaults(controlPoints, difficulty, mode);
3222
+ const secondsDuration = this.duration / 1000;
3223
+ // The average RPS required over the length of the spinner to clear the spinner.
3224
+ let minRps;
3225
+ switch (mode) {
3226
+ case exports.Modes.Droid: {
3227
+ // Mirror osu!droid's single-precision arithmetic. In double precision, the result
3228
+ // can land on the other side of a whole number, which shifts the rotation at which
3229
+ // bonus spins begin.
3230
+ const f = Math.fround;
3231
+ const droidSecondsDuration = f(f(Math.max(this.duration, 0)) / 1000);
3232
+ minRps = f(2 + f(f(2 * f(difficulty.od)) / 10));
3233
+ this._spinsRequired =
3234
+ droidSecondsDuration < 0.05 ? f(0.1) : f(minRps * droidSecondsDuration);
3235
+ break;
3236
+ }
3237
+ case exports.Modes.Osu:
3238
+ minRps = BeatmapDifficulty.difficultyRange(difficulty.od, 90, 150, 225) / 60;
3239
+ // Allow a 0.1ms floating point precision error in the calculation of the duration.
3240
+ this._spinsRequired = Math.trunc(minRps * secondsDuration + 0.0001);
3241
+ break;
3242
+ }
3243
+ }
3213
3244
  applySamples(controlPoints) {
3214
3245
  super.applySamples(controlPoints);
3215
3246
  const samplePoints = controlPoints.sample.between(this.startTime + HitObject.controlPointLeniency, this.endTime + HitObject.controlPointLeniency);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rian8337/osu-base",
3
- "version": "4.0.0-beta.100",
3
+ "version": "4.0.0-beta.103",
4
4
  "description": "Base module for all osu! related modules.",
5
5
  "keywords": [
6
6
  "osu",
@@ -35,5 +35,5 @@
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
- "gitHead": "b99083d44f14ca2af1d38ad294b361aad6ebc647"
38
+ "gitHead": "3f35122c29be5cf8a6d9ef612bfec5c93cfc2956"
39
39
  }
@@ -1606,11 +1606,17 @@ declare class Spinner extends HitObject {
1606
1606
  private static readonly baseSpinnerBonusSample;
1607
1607
  private _endTime;
1608
1608
  get endTime(): number;
1609
+ protected _spinsRequired: number;
1610
+ /**
1611
+ * Number of spins required to finish this {@link Spinner} without miss.
1612
+ */
1613
+ get spinsRequired(): number;
1609
1614
  constructor(values: {
1610
1615
  startTime: number;
1611
1616
  type: number;
1612
1617
  endTime: number;
1613
1618
  });
1619
+ applyDefaults(controlPoints: BeatmapControlPoints, difficulty: BeatmapDifficulty, mode: Modes): void;
1614
1620
  applySamples(controlPoints: BeatmapControlPoints): void;
1615
1621
  get stackedPosition(): Vector2;
1616
1622
  get stackedEndPosition(): Vector2;