@rian8337/osu-base 4.0.0-beta.87 → 4.0.0-beta.89
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 +1413 -1181
- package/package.json +2 -2
- package/typings/index.d.ts +2535 -2368
package/dist/index.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Mode enum to switch things between osu!droid and osu!standard.
|
|
5
|
+
*/
|
|
6
|
+
exports.Modes = void 0;
|
|
7
|
+
(function (Modes) {
|
|
8
|
+
Modes["droid"] = "droid";
|
|
9
|
+
Modes["osu"] = "osu";
|
|
10
|
+
})(exports.Modes || (exports.Modes = {}));
|
|
11
|
+
|
|
3
12
|
/**
|
|
4
13
|
* Some math utility functions.
|
|
5
14
|
*/
|
|
@@ -216,230 +225,29 @@ class MathUtils {
|
|
|
216
225
|
}
|
|
217
226
|
|
|
218
227
|
/**
|
|
219
|
-
*
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Calculates accuracy based on given parameters.
|
|
224
|
-
*
|
|
225
|
-
* If `percent` and `nobjects` are specified, `n300`, `n100`, and `n50` will
|
|
226
|
-
* be automatically calculated to be the closest to the given
|
|
227
|
-
* acc percent.
|
|
228
|
-
*
|
|
229
|
-
* @param values Function parameters.
|
|
230
|
-
*/
|
|
231
|
-
constructor(values) {
|
|
232
|
-
var _a, _b, _c, _d;
|
|
233
|
-
this.nmiss = (_a = values.nmiss) !== null && _a !== void 0 ? _a : 0;
|
|
234
|
-
this.n300 = (_b = values.n300) !== null && _b !== void 0 ? _b : -1;
|
|
235
|
-
this.n100 = (_c = values.n100) !== null && _c !== void 0 ? _c : 0;
|
|
236
|
-
this.n50 = (_d = values.n50) !== null && _d !== void 0 ? _d : 0;
|
|
237
|
-
let nobjects;
|
|
238
|
-
if (values.nobjects) {
|
|
239
|
-
let n300 = this.n300;
|
|
240
|
-
nobjects = values.nobjects;
|
|
241
|
-
let hitcount;
|
|
242
|
-
if (n300 < 0) {
|
|
243
|
-
n300 = Math.max(0, nobjects - this.n100 - this.n50 - this.nmiss);
|
|
244
|
-
}
|
|
245
|
-
hitcount = n300 + this.n100 + this.n50 + this.nmiss;
|
|
246
|
-
if (hitcount > nobjects) {
|
|
247
|
-
n300 -= Math.min(n300, hitcount - nobjects);
|
|
248
|
-
}
|
|
249
|
-
hitcount = n300 + this.n100 + this.n50 + this.nmiss;
|
|
250
|
-
if (hitcount > nobjects) {
|
|
251
|
-
this.n100 -= Math.min(this.n100, hitcount - nobjects);
|
|
252
|
-
}
|
|
253
|
-
hitcount = n300 + this.n100 + this.n50 + this.nmiss;
|
|
254
|
-
if (hitcount > nobjects) {
|
|
255
|
-
this.n50 -= Math.min(this.n50, hitcount - nobjects);
|
|
256
|
-
}
|
|
257
|
-
hitcount = n300 + this.n100 + this.n50 + this.nmiss;
|
|
258
|
-
if (hitcount > nobjects) {
|
|
259
|
-
this.nmiss -= Math.min(this.nmiss, hitcount - nobjects);
|
|
260
|
-
}
|
|
261
|
-
this.n300 = nobjects - this.n100 - this.n50 - this.nmiss;
|
|
262
|
-
}
|
|
263
|
-
if (values.percent) {
|
|
264
|
-
if (!values.nobjects) {
|
|
265
|
-
throw new TypeError("nobjects is required when specifying percent");
|
|
266
|
-
}
|
|
267
|
-
nobjects = values.nobjects;
|
|
268
|
-
const max300 = nobjects - this.nmiss;
|
|
269
|
-
const maxacc = new Accuracy({
|
|
270
|
-
n300: max300,
|
|
271
|
-
n100: 0,
|
|
272
|
-
n50: 0,
|
|
273
|
-
nmiss: this.nmiss,
|
|
274
|
-
}).value() * 100;
|
|
275
|
-
let acc_percent = values.percent;
|
|
276
|
-
acc_percent = Math.max(0, Math.min(maxacc, acc_percent));
|
|
277
|
-
// just some black magic maths from wolfram alpha
|
|
278
|
-
this.n100 = Math.round(-3 * ((acc_percent * 0.01 - 1) * nobjects + this.nmiss) * 0.5);
|
|
279
|
-
if (this.n100 > max300) {
|
|
280
|
-
// acc lower than all 100s, use 50s
|
|
281
|
-
this.n100 = 0;
|
|
282
|
-
this.n50 = Math.round(-6 *
|
|
283
|
-
((acc_percent * 0.01 - 1) * nobjects + this.nmiss) *
|
|
284
|
-
0.5);
|
|
285
|
-
this.n50 = Math.min(max300, this.n50);
|
|
286
|
-
}
|
|
287
|
-
this.n300 = nobjects - this.n100 - this.n50 - this.nmiss;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* Calculates the accuracy value (0.0 - 1.0).
|
|
292
|
-
*
|
|
293
|
-
* @param nobjects The amount of objects in the beatmap. If `n300` was not specified in the constructor, this is required.
|
|
294
|
-
*/
|
|
295
|
-
value(nobjects) {
|
|
296
|
-
let n300 = this.n300;
|
|
297
|
-
if (n300 < 0) {
|
|
298
|
-
if (!nobjects) {
|
|
299
|
-
throw new TypeError("Either n300 or nobjects must be specified");
|
|
300
|
-
}
|
|
301
|
-
n300 = nobjects - this.n100 - this.n50 - this.nmiss;
|
|
302
|
-
}
|
|
303
|
-
else {
|
|
304
|
-
nobjects !== null && nobjects !== void 0 ? nobjects : (nobjects = n300 + this.n100 + this.n50 + this.nmiss);
|
|
305
|
-
}
|
|
306
|
-
const res = (n300 * 6 + this.n100 * 2 + this.n50) / (nobjects * 6);
|
|
307
|
-
return MathUtils.clamp(res, 0, 1);
|
|
308
|
-
}
|
|
309
|
-
/**
|
|
310
|
-
* Determines whether this accuracy instance is equal to another instance.
|
|
311
|
-
*
|
|
312
|
-
* @param other The other accuracy instance.
|
|
313
|
-
* @returns Whether both instances are equal.
|
|
314
|
-
*/
|
|
315
|
-
equals(other) {
|
|
316
|
-
return (this.n300 === other.n300 &&
|
|
317
|
-
this.n100 === other.n100 &&
|
|
318
|
-
this.n50 === other.n50 &&
|
|
319
|
-
this.nmiss === other.nmiss);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* General enum to specify an "anchor" or "origin" point from the standard 9 points on a rectangle.
|
|
325
|
-
*/
|
|
326
|
-
exports.Anchor = void 0;
|
|
327
|
-
(function (Anchor) {
|
|
328
|
-
Anchor["topLeft"] = "TopLeft";
|
|
329
|
-
Anchor["center"] = "Centre";
|
|
330
|
-
Anchor["centerLeft"] = "CentreLeft";
|
|
331
|
-
Anchor["topRight"] = "TopRight";
|
|
332
|
-
Anchor["bottomCenter"] = "BottomCentre";
|
|
333
|
-
Anchor["topCenter"] = "TopCentre";
|
|
334
|
-
/**
|
|
335
|
-
* The user is manually updating the outcome, so we shouldn't.
|
|
336
|
-
*/
|
|
337
|
-
Anchor["custom"] = "Custom";
|
|
338
|
-
Anchor["centerRight"] = "CentreRight";
|
|
339
|
-
Anchor["bottomLeft"] = "BottomLeft";
|
|
340
|
-
Anchor["bottomRight"] = "BottomRight";
|
|
341
|
-
})(exports.Anchor || (exports.Anchor = {}));
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
* Defines available axes.
|
|
228
|
+
* The result of a hit.
|
|
229
|
+
*
|
|
230
|
+
* Underlying numbers mirror values in an osu!droid replay.
|
|
345
231
|
*/
|
|
346
|
-
exports.
|
|
347
|
-
(function (
|
|
232
|
+
exports.HitResult = void 0;
|
|
233
|
+
(function (HitResult) {
|
|
348
234
|
/**
|
|
349
|
-
*
|
|
235
|
+
* Miss (0).
|
|
350
236
|
*/
|
|
351
|
-
|
|
237
|
+
HitResult[HitResult["miss"] = 1] = "miss";
|
|
352
238
|
/**
|
|
353
|
-
*
|
|
239
|
+
* Meh (50).
|
|
354
240
|
*/
|
|
355
|
-
|
|
241
|
+
HitResult[HitResult["meh"] = 2] = "meh";
|
|
356
242
|
/**
|
|
357
|
-
*
|
|
243
|
+
* Good (100).
|
|
358
244
|
*/
|
|
359
|
-
|
|
245
|
+
HitResult[HitResult["good"] = 3] = "good";
|
|
360
246
|
/**
|
|
361
|
-
*
|
|
247
|
+
* Great (300).
|
|
362
248
|
*/
|
|
363
|
-
|
|
364
|
-
})(exports.
|
|
365
|
-
|
|
366
|
-
/**
|
|
367
|
-
* The loop type of storyboard animations.
|
|
368
|
-
*/
|
|
369
|
-
exports.AnimationLoopType = void 0;
|
|
370
|
-
(function (AnimationLoopType) {
|
|
371
|
-
AnimationLoopType["loopForever"] = "LoopForever";
|
|
372
|
-
AnimationLoopType["loopOnce"] = "LoopOnce";
|
|
373
|
-
})(exports.AnimationLoopType || (exports.AnimationLoopType = {}));
|
|
374
|
-
|
|
375
|
-
/**
|
|
376
|
-
* Represents available sample banks.
|
|
377
|
-
*/
|
|
378
|
-
exports.SampleBank = void 0;
|
|
379
|
-
(function (SampleBank) {
|
|
380
|
-
SampleBank[SampleBank["none"] = 0] = "none";
|
|
381
|
-
SampleBank[SampleBank["normal"] = 1] = "normal";
|
|
382
|
-
SampleBank[SampleBank["soft"] = 2] = "soft";
|
|
383
|
-
SampleBank[SampleBank["drum"] = 3] = "drum";
|
|
384
|
-
})(exports.SampleBank || (exports.SampleBank = {}));
|
|
385
|
-
|
|
386
|
-
/**
|
|
387
|
-
* Represents a gameplay hit sample.
|
|
388
|
-
*/
|
|
389
|
-
class HitSampleInfo {
|
|
390
|
-
constructor(volume = 0) {
|
|
391
|
-
this.volume = volume;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
/**
|
|
396
|
-
* Represents a pre-determined gameplay hit sample that can be loaded from banks.
|
|
397
|
-
*/
|
|
398
|
-
class BankHitSampleInfo extends HitSampleInfo {
|
|
399
|
-
get lookupNames() {
|
|
400
|
-
const names = [];
|
|
401
|
-
let prefix;
|
|
402
|
-
switch (this.bank) {
|
|
403
|
-
case exports.SampleBank.none:
|
|
404
|
-
prefix = "";
|
|
405
|
-
break;
|
|
406
|
-
case exports.SampleBank.normal:
|
|
407
|
-
prefix = "normal";
|
|
408
|
-
break;
|
|
409
|
-
case exports.SampleBank.soft:
|
|
410
|
-
prefix = "soft";
|
|
411
|
-
break;
|
|
412
|
-
case exports.SampleBank.drum:
|
|
413
|
-
prefix = "drum";
|
|
414
|
-
break;
|
|
415
|
-
}
|
|
416
|
-
if (this.customSampleBank >= 2) {
|
|
417
|
-
names.push(`${prefix}-${this.name}${this.customSampleBank.toString()}`);
|
|
418
|
-
}
|
|
419
|
-
names.push(`${prefix}-${this.name}`, this.name);
|
|
420
|
-
return names;
|
|
421
|
-
}
|
|
422
|
-
constructor(name, bank = exports.SampleBank.none, customSampleBank = 0, volume = 0, isLayered = false) {
|
|
423
|
-
super(volume);
|
|
424
|
-
this.name = name;
|
|
425
|
-
this.bank = bank;
|
|
426
|
-
this.customSampleBank = customSampleBank;
|
|
427
|
-
this.isLayered = isLayered;
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
BankHitSampleInfo.HIT_WHISTLE = "hitwhistle";
|
|
431
|
-
BankHitSampleInfo.HIT_FINISH = "hitfinish";
|
|
432
|
-
BankHitSampleInfo.HIT_NORMAL = "hitnormal";
|
|
433
|
-
BankHitSampleInfo.HIT_CLAP = "hitclap";
|
|
434
|
-
|
|
435
|
-
/**
|
|
436
|
-
* Mode enum to switch things between osu!droid and osu!standard.
|
|
437
|
-
*/
|
|
438
|
-
exports.Modes = void 0;
|
|
439
|
-
(function (Modes) {
|
|
440
|
-
Modes["droid"] = "droid";
|
|
441
|
-
Modes["osu"] = "osu";
|
|
442
|
-
})(exports.Modes || (exports.Modes = {}));
|
|
249
|
+
HitResult[HitResult["great"] = 4] = "great";
|
|
250
|
+
})(exports.HitResult || (exports.HitResult = {}));
|
|
443
251
|
|
|
444
252
|
/**
|
|
445
253
|
* Represents a hit window.
|
|
@@ -451,6 +259,25 @@ class HitWindow {
|
|
|
451
259
|
constructor(overallDifficulty = 5) {
|
|
452
260
|
this.overallDifficulty = overallDifficulty;
|
|
453
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* Retrieves the hit window for a {@link HitResult}. This is the number of +/- milliseconds
|
|
264
|
+
* allowed for the requested result (so the actual hittable range is double this).
|
|
265
|
+
*
|
|
266
|
+
* @param result The {@link HitResult} to retrieve the hit window for.
|
|
267
|
+
* @returns The hit window for the requested {@link HitResult}.
|
|
268
|
+
*/
|
|
269
|
+
hitWindowFor(result) {
|
|
270
|
+
switch (result) {
|
|
271
|
+
case exports.HitResult.great:
|
|
272
|
+
return this.greatWindow;
|
|
273
|
+
case exports.HitResult.good:
|
|
274
|
+
return this.okWindow;
|
|
275
|
+
case exports.HitResult.meh:
|
|
276
|
+
return this.mehWindow;
|
|
277
|
+
case exports.HitResult.miss:
|
|
278
|
+
return HitWindow.missWindow;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
454
281
|
}
|
|
455
282
|
/**
|
|
456
283
|
* A fixed miss hit window regardless of difficulty settings.
|
|
@@ -503,6 +330,21 @@ class DroidHitWindow extends HitWindow {
|
|
|
503
330
|
* Represents the hit window of osu!standard.
|
|
504
331
|
*/
|
|
505
332
|
class OsuHitWindow extends HitWindow {
|
|
333
|
+
get greatWindow() {
|
|
334
|
+
return Math.floor(80 - 6 * this.overallDifficulty) - 0.5;
|
|
335
|
+
}
|
|
336
|
+
get okWindow() {
|
|
337
|
+
return Math.floor(140 - 8 * this.overallDifficulty) - 0.5;
|
|
338
|
+
}
|
|
339
|
+
get mehWindow() {
|
|
340
|
+
return Math.floor(200 - 10 * this.overallDifficulty) - 0.5;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Represents the hit window of osu!droid _with_ the Precise mod.
|
|
346
|
+
*/
|
|
347
|
+
class PreciseDroidHitWindow extends HitWindow {
|
|
506
348
|
/**
|
|
507
349
|
* Calculates the overall difficulty value of a great (300) hit window.
|
|
508
350
|
*
|
|
@@ -510,7 +352,7 @@ class OsuHitWindow extends HitWindow {
|
|
|
510
352
|
* @returns The overall difficulty value.
|
|
511
353
|
*/
|
|
512
354
|
static greatWindowToOD(value) {
|
|
513
|
-
return (
|
|
355
|
+
return 5 - (value - 55) / 6;
|
|
514
356
|
}
|
|
515
357
|
/**
|
|
516
358
|
* Calculates the overall difficulty value of a good (100) hit window.
|
|
@@ -519,67 +361,25 @@ class OsuHitWindow extends HitWindow {
|
|
|
519
361
|
* @returns The overall difficulty value.
|
|
520
362
|
*/
|
|
521
363
|
static okWindowToOD(value) {
|
|
522
|
-
return (
|
|
364
|
+
return 5 - (value - 120) / 8;
|
|
523
365
|
}
|
|
524
366
|
/**
|
|
525
|
-
* Calculates the overall difficulty value of a meh hit window.
|
|
367
|
+
* Calculates the overall difficulty value of a meh (50) hit window.
|
|
526
368
|
*
|
|
527
369
|
* @param value The value of the hit window, in milliseconds.
|
|
528
370
|
* @returns The overall difficulty value.
|
|
529
371
|
*/
|
|
530
372
|
static mehWindowToOD(value) {
|
|
531
|
-
return (
|
|
373
|
+
return 5 - (value - 180) / 10;
|
|
532
374
|
}
|
|
533
375
|
get greatWindow() {
|
|
534
|
-
return
|
|
376
|
+
return 55 + 6 * (5 - this.overallDifficulty);
|
|
535
377
|
}
|
|
536
378
|
get okWindow() {
|
|
537
|
-
return
|
|
379
|
+
return 120 + 8 * (5 - this.overallDifficulty);
|
|
538
380
|
}
|
|
539
381
|
get mehWindow() {
|
|
540
|
-
return
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
/**
|
|
545
|
-
* Represents the hit window of osu!droid _with_ the Precise mod.
|
|
546
|
-
*/
|
|
547
|
-
class PreciseDroidHitWindow extends HitWindow {
|
|
548
|
-
/**
|
|
549
|
-
* Calculates the overall difficulty value of a great (300) hit window.
|
|
550
|
-
*
|
|
551
|
-
* @param value The value of the hit window, in milliseconds.
|
|
552
|
-
* @returns The overall difficulty value.
|
|
553
|
-
*/
|
|
554
|
-
static greatWindowToOD(value) {
|
|
555
|
-
return 5 - (value - 55) / 6;
|
|
556
|
-
}
|
|
557
|
-
/**
|
|
558
|
-
* Calculates the overall difficulty value of a good (100) hit window.
|
|
559
|
-
*
|
|
560
|
-
* @param value The value of the hit window, in milliseconds.
|
|
561
|
-
* @returns The overall difficulty value.
|
|
562
|
-
*/
|
|
563
|
-
static okWindowToOD(value) {
|
|
564
|
-
return 5 - (value - 120) / 8;
|
|
565
|
-
}
|
|
566
|
-
/**
|
|
567
|
-
* Calculates the overall difficulty value of a meh (50) hit window.
|
|
568
|
-
*
|
|
569
|
-
* @param value The value of the hit window, in milliseconds.
|
|
570
|
-
* @returns The overall difficulty value.
|
|
571
|
-
*/
|
|
572
|
-
static mehWindowToOD(value) {
|
|
573
|
-
return 5 - (value - 180) / 10;
|
|
574
|
-
}
|
|
575
|
-
get greatWindow() {
|
|
576
|
-
return 55 + 6 * (5 - this.overallDifficulty);
|
|
577
|
-
}
|
|
578
|
-
get okWindow() {
|
|
579
|
-
return 120 + 8 * (5 - this.overallDifficulty);
|
|
580
|
-
}
|
|
581
|
-
get mehWindow() {
|
|
582
|
-
return 180 + 10 * (5 - this.overallDifficulty);
|
|
382
|
+
return 180 + 10 * (5 - this.overallDifficulty);
|
|
583
383
|
}
|
|
584
384
|
}
|
|
585
385
|
|
|
@@ -596,6 +396,17 @@ exports.ObjectTypes = void 0;
|
|
|
596
396
|
ObjectTypes[ObjectTypes["comboOffset"] = 112] = "comboOffset";
|
|
597
397
|
})(exports.ObjectTypes || (exports.ObjectTypes = {}));
|
|
598
398
|
|
|
399
|
+
/**
|
|
400
|
+
* Represents available sample banks.
|
|
401
|
+
*/
|
|
402
|
+
exports.SampleBank = void 0;
|
|
403
|
+
(function (SampleBank) {
|
|
404
|
+
SampleBank[SampleBank["none"] = 0] = "none";
|
|
405
|
+
SampleBank[SampleBank["normal"] = 1] = "normal";
|
|
406
|
+
SampleBank[SampleBank["soft"] = 2] = "soft";
|
|
407
|
+
SampleBank[SampleBank["drum"] = 3] = "drum";
|
|
408
|
+
})(exports.SampleBank || (exports.SampleBank = {}));
|
|
409
|
+
|
|
599
410
|
/**
|
|
600
411
|
* Represents a two-dimensional vector.
|
|
601
412
|
*/
|
|
@@ -1012,6 +823,55 @@ CircleSizeCalculator.brokenGamefieldRoundingAllowance = 1.00041;
|
|
|
1012
823
|
CircleSizeCalculator.oldAssumedDroidHeight = 681;
|
|
1013
824
|
CircleSizeCalculator.oldDroidScaleMultiplier = (0.5 * (11 - 5.2450170716245195)) / 5;
|
|
1014
825
|
|
|
826
|
+
/**
|
|
827
|
+
* Represents a gameplay hit sample.
|
|
828
|
+
*/
|
|
829
|
+
class HitSampleInfo {
|
|
830
|
+
constructor(volume = 0) {
|
|
831
|
+
this.volume = volume;
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
/**
|
|
836
|
+
* Represents a pre-determined gameplay hit sample that can be loaded from banks.
|
|
837
|
+
*/
|
|
838
|
+
class BankHitSampleInfo extends HitSampleInfo {
|
|
839
|
+
get lookupNames() {
|
|
840
|
+
const names = [];
|
|
841
|
+
let prefix;
|
|
842
|
+
switch (this.bank) {
|
|
843
|
+
case exports.SampleBank.none:
|
|
844
|
+
prefix = "";
|
|
845
|
+
break;
|
|
846
|
+
case exports.SampleBank.normal:
|
|
847
|
+
prefix = "normal";
|
|
848
|
+
break;
|
|
849
|
+
case exports.SampleBank.soft:
|
|
850
|
+
prefix = "soft";
|
|
851
|
+
break;
|
|
852
|
+
case exports.SampleBank.drum:
|
|
853
|
+
prefix = "drum";
|
|
854
|
+
break;
|
|
855
|
+
}
|
|
856
|
+
if (this.customSampleBank >= 2) {
|
|
857
|
+
names.push(`${prefix}-${this.name}${this.customSampleBank.toString()}`);
|
|
858
|
+
}
|
|
859
|
+
names.push(`${prefix}-${this.name}`, this.name);
|
|
860
|
+
return names;
|
|
861
|
+
}
|
|
862
|
+
constructor(name, bank = exports.SampleBank.none, customSampleBank = 0, volume = 0, isLayered = false) {
|
|
863
|
+
super(volume);
|
|
864
|
+
this.name = name;
|
|
865
|
+
this.bank = bank;
|
|
866
|
+
this.customSampleBank = customSampleBank;
|
|
867
|
+
this.isLayered = isLayered;
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
BankHitSampleInfo.HIT_WHISTLE = "hitwhistle";
|
|
871
|
+
BankHitSampleInfo.HIT_FINISH = "hitfinish";
|
|
872
|
+
BankHitSampleInfo.HIT_NORMAL = "hitnormal";
|
|
873
|
+
BankHitSampleInfo.HIT_CLAP = "hitclap";
|
|
874
|
+
|
|
1015
875
|
/**
|
|
1016
876
|
* Represents a hitobject in a beatmap.
|
|
1017
877
|
*/
|
|
@@ -1391,7 +1251,7 @@ class ModSetting {
|
|
|
1391
1251
|
get isDefault() {
|
|
1392
1252
|
return this._value === this.defaultValue;
|
|
1393
1253
|
}
|
|
1394
|
-
constructor(name, description, defaultValue) {
|
|
1254
|
+
constructor(name, key, description, defaultValue) {
|
|
1395
1255
|
/**
|
|
1396
1256
|
* The formatter to display the value of this `ModSetting`.
|
|
1397
1257
|
*/
|
|
@@ -1399,10 +1259,35 @@ class ModSetting {
|
|
|
1399
1259
|
this.displayFormatter = (v) => `${v}`;
|
|
1400
1260
|
this.valueChangedListeners = new Set();
|
|
1401
1261
|
this.name = name;
|
|
1262
|
+
this.key = key;
|
|
1402
1263
|
this.description = description;
|
|
1403
1264
|
this._defaultValue = defaultValue;
|
|
1404
1265
|
this._value = defaultValue;
|
|
1405
1266
|
}
|
|
1267
|
+
/**
|
|
1268
|
+
* Loads the value of this `ModSetting` from a serialized settings object.
|
|
1269
|
+
*
|
|
1270
|
+
* @param settings The settings object to load from.
|
|
1271
|
+
*/
|
|
1272
|
+
load(settings) {
|
|
1273
|
+
if (this.key === null) {
|
|
1274
|
+
return;
|
|
1275
|
+
}
|
|
1276
|
+
const stored = settings[this.key];
|
|
1277
|
+
if (stored !== undefined && stored !== null) {
|
|
1278
|
+
this.value = stored;
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* Saves the value of this `ModSetting` to a serialized settings object.
|
|
1283
|
+
*
|
|
1284
|
+
* @param settings The settings object to save to.
|
|
1285
|
+
*/
|
|
1286
|
+
save(settings) {
|
|
1287
|
+
if (this.key !== null) {
|
|
1288
|
+
settings[this.key] = this.value;
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1406
1291
|
/**
|
|
1407
1292
|
* Returns a string representation of this `ModSetting`'s value.
|
|
1408
1293
|
*
|
|
@@ -1496,15 +1381,13 @@ class Mod {
|
|
|
1496
1381
|
* Serializes this `Mod` to a `SerializedMod`.
|
|
1497
1382
|
*/
|
|
1498
1383
|
serialize() {
|
|
1499
|
-
|
|
1500
|
-
const
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
if (!serialized.settings) {
|
|
1505
|
-
delete serialized.settings;
|
|
1384
|
+
const settings = {};
|
|
1385
|
+
for (const setting of this.settings) {
|
|
1386
|
+
if (!setting.isDefault) {
|
|
1387
|
+
setting.save(settings);
|
|
1388
|
+
}
|
|
1506
1389
|
}
|
|
1507
|
-
return
|
|
1390
|
+
return Object.assign({ acronym: this.acronym }, (Object.keys(settings).length > 0 && { settings }));
|
|
1508
1391
|
}
|
|
1509
1392
|
/**
|
|
1510
1393
|
* Copies the settings of a `SerializedMod` to this `Mod`.
|
|
@@ -1513,9 +1396,14 @@ class Mod {
|
|
|
1513
1396
|
* @throws {TypeError} If the `SerializedMod` is not the same type as this `Mod`.
|
|
1514
1397
|
*/
|
|
1515
1398
|
copySettings(mod) {
|
|
1399
|
+
var _a;
|
|
1516
1400
|
if (mod.acronym !== this.acronym) {
|
|
1517
1401
|
throw new TypeError(`Cannot copy settings from ${mod.acronym} to ${this.acronym}`);
|
|
1518
1402
|
}
|
|
1403
|
+
const settings = (_a = mod.settings) !== null && _a !== void 0 ? _a : {};
|
|
1404
|
+
for (const setting of this.settings) {
|
|
1405
|
+
setting.load(settings);
|
|
1406
|
+
}
|
|
1519
1407
|
}
|
|
1520
1408
|
/**
|
|
1521
1409
|
* Whether this `Mod` can be applied to osu!droid.
|
|
@@ -1584,18 +1472,10 @@ class Mod {
|
|
|
1584
1472
|
return "facilitateAdjustment" in this;
|
|
1585
1473
|
}
|
|
1586
1474
|
/**
|
|
1587
|
-
* Whether this `Mod` requires the original `
|
|
1475
|
+
* Whether this `Mod` requires the original `BeatmapDifficulty` for conversion and processing.
|
|
1588
1476
|
*/
|
|
1589
|
-
|
|
1590
|
-
return "
|
|
1591
|
-
}
|
|
1592
|
-
/**
|
|
1593
|
-
* Serializes the settings of this `Mod` to an object that can be converted to a JSON.
|
|
1594
|
-
*
|
|
1595
|
-
* @returns The serialized settings of this `Mod`, or `null` if there are no settings.
|
|
1596
|
-
*/
|
|
1597
|
-
serializeSettings() {
|
|
1598
|
-
return null;
|
|
1477
|
+
requiresBeatmapDifficulty() {
|
|
1478
|
+
return "applyFromBeatmapDifficulty" in this;
|
|
1599
1479
|
}
|
|
1600
1480
|
/**
|
|
1601
1481
|
* Compares this `Mod` to another `Mod` for equality.
|
|
@@ -1675,6 +1555,9 @@ class EmptyHitWindow extends HitWindow {
|
|
|
1675
1555
|
get mehWindow() {
|
|
1676
1556
|
return 0;
|
|
1677
1557
|
}
|
|
1558
|
+
hitWindowFor() {
|
|
1559
|
+
return 0;
|
|
1560
|
+
}
|
|
1678
1561
|
}
|
|
1679
1562
|
|
|
1680
1563
|
/**
|
|
@@ -2266,6 +2149,7 @@ class ModTraceable extends Mod {
|
|
|
2266
2149
|
this.droidRanked = false;
|
|
2267
2150
|
this.isDroidRelevant = true;
|
|
2268
2151
|
this.droidScoreMultiplier = 1.06;
|
|
2152
|
+
this.migrationDroidScoreMultiplier = 1.06;
|
|
2269
2153
|
this.osuRanked = true;
|
|
2270
2154
|
this.isOsuRelevant = true;
|
|
2271
2155
|
this.osuScoreMultiplier = 1;
|
|
@@ -2281,6 +2165,15 @@ class BooleanModSetting extends ModSetting {
|
|
|
2281
2165
|
super(...arguments);
|
|
2282
2166
|
this.displayFormatter = (v) => v ? "Enabled" : "Disabled";
|
|
2283
2167
|
}
|
|
2168
|
+
load(settings) {
|
|
2169
|
+
if (this.key === null) {
|
|
2170
|
+
return;
|
|
2171
|
+
}
|
|
2172
|
+
const stored = settings[this.key];
|
|
2173
|
+
if (typeof stored === "boolean") {
|
|
2174
|
+
this.value = stored;
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2284
2177
|
}
|
|
2285
2178
|
|
|
2286
2179
|
/**
|
|
@@ -2305,7 +2198,7 @@ class ModHidden extends Mod {
|
|
|
2305
2198
|
*
|
|
2306
2199
|
* The main object body will not fade when enabled.
|
|
2307
2200
|
*/
|
|
2308
|
-
this.onlyFadeApproachCircles = new BooleanModSetting("Only fade approach circles", "The main object body will not fade when enabled.", false);
|
|
2201
|
+
this.onlyFadeApproachCircles = new BooleanModSetting("Only fade approach circles", "onlyFadeApproachCircles", "The main object body will not fade when enabled.", false);
|
|
2309
2202
|
this.incompatibleMods
|
|
2310
2203
|
.add(ModTraceable)
|
|
2311
2204
|
.add(ModApproachDifferent)
|
|
@@ -2314,15 +2207,12 @@ class ModHidden extends Mod {
|
|
|
2314
2207
|
get droidScoreMultiplier() {
|
|
2315
2208
|
return this.usesDefaultSettings ? 1.06 : 1;
|
|
2316
2209
|
}
|
|
2210
|
+
get migrationDroidScoreMultiplier() {
|
|
2211
|
+
return this.droidScoreMultiplier;
|
|
2212
|
+
}
|
|
2317
2213
|
get osuScoreMultiplier() {
|
|
2318
2214
|
return this.usesDefaultSettings ? 1.06 : 1;
|
|
2319
2215
|
}
|
|
2320
|
-
copySettings(mod) {
|
|
2321
|
-
var _a, _b;
|
|
2322
|
-
super.copySettings(mod);
|
|
2323
|
-
this.onlyFadeApproachCircles.value =
|
|
2324
|
-
(_b = (_a = mod.settings) === null || _a === void 0 ? void 0 : _a.onlyFadeApproachCircles) !== null && _b !== void 0 ? _b : this.onlyFadeApproachCircles.value;
|
|
2325
|
-
}
|
|
2326
2216
|
applyToBeatmap(beatmap) {
|
|
2327
2217
|
const applyFadeInAdjustment = (hitObject) => {
|
|
2328
2218
|
hitObject.timeFadeIn =
|
|
@@ -2333,11 +2223,6 @@ class ModHidden extends Mod {
|
|
|
2333
2223
|
};
|
|
2334
2224
|
beatmap.hitObjects.objects.forEach(applyFadeInAdjustment);
|
|
2335
2225
|
}
|
|
2336
|
-
serializeSettings() {
|
|
2337
|
-
return this.onlyFadeApproachCircles.value
|
|
2338
|
-
? { onlyFadeApproachCircles: this.onlyFadeApproachCircles.value }
|
|
2339
|
-
: null;
|
|
2340
|
-
}
|
|
2341
2226
|
toString() {
|
|
2342
2227
|
if (!this.onlyFadeApproachCircles.value) {
|
|
2343
2228
|
return super.toString();
|
|
@@ -2359,6 +2244,7 @@ class ModFreezeFrame extends Mod {
|
|
|
2359
2244
|
this.droidRanked = false;
|
|
2360
2245
|
this.isDroidRelevant = true;
|
|
2361
2246
|
this.droidScoreMultiplier = 1;
|
|
2247
|
+
this.migrationDroidScoreMultiplier = 1;
|
|
2362
2248
|
this.osuRanked = false;
|
|
2363
2249
|
this.isOsuRelevant = true;
|
|
2364
2250
|
this.osuScoreMultiplier = 1;
|
|
@@ -2425,8 +2311,8 @@ class RangeConstrainedModSetting extends ModSetting {
|
|
|
2425
2311
|
set value(value) {
|
|
2426
2312
|
super.value = this.processValue(value);
|
|
2427
2313
|
}
|
|
2428
|
-
constructor(name, description, defaultValue, min, max, step) {
|
|
2429
|
-
super(name, description, defaultValue);
|
|
2314
|
+
constructor(name, key, description, defaultValue, min, max, step) {
|
|
2315
|
+
super(name, key, description, defaultValue);
|
|
2430
2316
|
this._min = min;
|
|
2431
2317
|
this._max = max;
|
|
2432
2318
|
this._step = step;
|
|
@@ -2437,8 +2323,8 @@ class RangeConstrainedModSetting extends ModSetting {
|
|
|
2437
2323
|
* Represents a `Mod` specific setting that is constrained to a number of values.
|
|
2438
2324
|
*/
|
|
2439
2325
|
class NumberModSetting extends RangeConstrainedModSetting {
|
|
2440
|
-
constructor(name, description, defaultValue, min, max, step) {
|
|
2441
|
-
super(name, description, defaultValue, min, max, step);
|
|
2326
|
+
constructor(name, key, description, defaultValue, min, max, step) {
|
|
2327
|
+
super(name, key, description, defaultValue, min, max, step);
|
|
2442
2328
|
this.displayFormatter = (v) => v.toString();
|
|
2443
2329
|
if (min > max) {
|
|
2444
2330
|
throw new RangeError(`The minimum value (${min.toString()}) must be less than or equal to the maximum value (${max.toString()}).`);
|
|
@@ -2450,8 +2336,20 @@ class NumberModSetting extends RangeConstrainedModSetting {
|
|
|
2450
2336
|
throw new RangeError(`The default value (${defaultValue.toString()}) must be between the minimum (${min.toString()}) and maximum (${max.toString()}) values.`);
|
|
2451
2337
|
}
|
|
2452
2338
|
}
|
|
2339
|
+
load(settings) {
|
|
2340
|
+
if (this.key === null) {
|
|
2341
|
+
return;
|
|
2342
|
+
}
|
|
2343
|
+
const stored = settings[this.key];
|
|
2344
|
+
if (typeof stored === "number") {
|
|
2345
|
+
this.value = stored;
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2453
2348
|
processValue(value) {
|
|
2454
|
-
|
|
2349
|
+
const stepped = this.step > 0
|
|
2350
|
+
? Math.round(value / this.step) * this.step
|
|
2351
|
+
: value;
|
|
2352
|
+
return MathUtils.clamp(stepped, this.min, this.max);
|
|
2455
2353
|
}
|
|
2456
2354
|
}
|
|
2457
2355
|
|
|
@@ -2476,8 +2374,8 @@ class DecimalModSetting extends NumberModSetting {
|
|
|
2476
2374
|
this.value = this.processValue(this.value);
|
|
2477
2375
|
}
|
|
2478
2376
|
}
|
|
2479
|
-
constructor(name, description, defaultValue, min = -Number.MAX_VALUE, max = Number.MAX_VALUE, step = 0, precision = null) {
|
|
2480
|
-
super(name, description, defaultValue, min, max, step);
|
|
2377
|
+
constructor(name, key, description, defaultValue, min = -Number.MAX_VALUE, max = Number.MAX_VALUE, step = 0, precision = null) {
|
|
2378
|
+
super(name, key, description, defaultValue, min, max, step);
|
|
2481
2379
|
this.displayFormatter = (v) => {
|
|
2482
2380
|
if (this.precision !== null) {
|
|
2483
2381
|
return v.toFixed(this.precision);
|
|
@@ -2535,6 +2433,7 @@ class ModApproachDifferent extends Mod {
|
|
|
2535
2433
|
this.acronym = "AD";
|
|
2536
2434
|
this.droidRanked = false;
|
|
2537
2435
|
this.droidScoreMultiplier = 1;
|
|
2436
|
+
this.migrationDroidScoreMultiplier = 1;
|
|
2538
2437
|
this.isDroidRelevant = true;
|
|
2539
2438
|
this.osuRanked = false;
|
|
2540
2439
|
this.isOsuRelevant = true;
|
|
@@ -2542,29 +2441,13 @@ class ModApproachDifferent extends Mod {
|
|
|
2542
2441
|
/**
|
|
2543
2442
|
* The initial size of the approach circle, relative to hit circles.
|
|
2544
2443
|
*/
|
|
2545
|
-
this.scale = new DecimalModSetting("Initial size", "The initial size of the approach circle, relative to hit circles.", 3, 1.5, 10, 0.1, 1);
|
|
2444
|
+
this.scale = new DecimalModSetting("Initial size", "scale", "The initial size of the approach circle, relative to hit circles.", 3, 1.5, 10, 0.1, 1);
|
|
2546
2445
|
/**
|
|
2547
2446
|
* The animation style of the approach circles.
|
|
2548
2447
|
*/
|
|
2549
|
-
this.style = new ModSetting("Style", "The animation style of the approach circles.", exports.AnimationStyle.gravity);
|
|
2448
|
+
this.style = new ModSetting("Style", "style", "The animation style of the approach circles.", exports.AnimationStyle.gravity);
|
|
2550
2449
|
this.incompatibleMods.add(ModHidden).add(ModFreezeFrame);
|
|
2551
2450
|
}
|
|
2552
|
-
copySettings(mod) {
|
|
2553
|
-
super.copySettings(mod);
|
|
2554
|
-
const { settings } = mod;
|
|
2555
|
-
if (typeof (settings === null || settings === void 0 ? void 0 : settings.scale) === "number") {
|
|
2556
|
-
this.scale.value = settings.scale;
|
|
2557
|
-
}
|
|
2558
|
-
if (typeof (settings === null || settings === void 0 ? void 0 : settings.style) === "number") {
|
|
2559
|
-
this.style.value = settings.style;
|
|
2560
|
-
}
|
|
2561
|
-
}
|
|
2562
|
-
serializeSettings() {
|
|
2563
|
-
return {
|
|
2564
|
-
scale: this.scale.value,
|
|
2565
|
-
style: this.style.value,
|
|
2566
|
-
};
|
|
2567
|
-
}
|
|
2568
2451
|
}
|
|
2569
2452
|
exports.AnimationStyle = void 0;
|
|
2570
2453
|
(function (AnimationStyle) {
|
|
@@ -2591,6 +2474,7 @@ class ModRelax extends Mod {
|
|
|
2591
2474
|
this.droidRanked = false;
|
|
2592
2475
|
this.isDroidRelevant = true;
|
|
2593
2476
|
this.droidScoreMultiplier = 0.001;
|
|
2477
|
+
this.migrationDroidScoreMultiplier = 0.001;
|
|
2594
2478
|
this.osuRanked = false;
|
|
2595
2479
|
this.isOsuRelevant = true;
|
|
2596
2480
|
this.osuScoreMultiplier = 0;
|
|
@@ -2610,6 +2494,7 @@ class ModAutopilot extends Mod {
|
|
|
2610
2494
|
this.droidRanked = false;
|
|
2611
2495
|
this.isDroidRelevant = true;
|
|
2612
2496
|
this.droidScoreMultiplier = 0.001;
|
|
2497
|
+
this.migrationDroidScoreMultiplier = 0.001;
|
|
2613
2498
|
this.osuRanked = false;
|
|
2614
2499
|
this.isOsuRelevant = true;
|
|
2615
2500
|
this.osuScoreMultiplier = 0;
|
|
@@ -2629,6 +2514,7 @@ class ModAuto extends Mod {
|
|
|
2629
2514
|
this.droidRanked = false;
|
|
2630
2515
|
this.isDroidRelevant = true;
|
|
2631
2516
|
this.droidScoreMultiplier = 1;
|
|
2517
|
+
this.migrationDroidScoreMultiplier = 1;
|
|
2632
2518
|
this.osuRanked = false;
|
|
2633
2519
|
this.isOsuRelevant = true;
|
|
2634
2520
|
this.osuScoreMultiplier = 1;
|
|
@@ -2644,6 +2530,12 @@ class ModFlashlight extends Mod {
|
|
|
2644
2530
|
get droidRanked() {
|
|
2645
2531
|
return this.usesDefaultSettings;
|
|
2646
2532
|
}
|
|
2533
|
+
get droidScoreMultiplier() {
|
|
2534
|
+
return this.usesDefaultSettings ? 1.12 : 1;
|
|
2535
|
+
}
|
|
2536
|
+
get migrationDroidScoreMultiplier() {
|
|
2537
|
+
return this.droidScoreMultiplier;
|
|
2538
|
+
}
|
|
2647
2539
|
get osuRanked() {
|
|
2648
2540
|
return this.usesDefaultSettings;
|
|
2649
2541
|
}
|
|
@@ -2655,29 +2547,37 @@ class ModFlashlight extends Mod {
|
|
|
2655
2547
|
this.acronym = "FL";
|
|
2656
2548
|
this.name = "Flashlight";
|
|
2657
2549
|
this.isDroidRelevant = true;
|
|
2658
|
-
this.droidScoreMultiplier = 1.12;
|
|
2659
2550
|
this.isOsuRelevant = true;
|
|
2660
2551
|
this.bitwise = 1 << 10;
|
|
2661
2552
|
/**
|
|
2662
2553
|
* The amount of seconds until the Flashlight follow area reaches the cursor.
|
|
2663
2554
|
*/
|
|
2664
|
-
this.followDelay = new DecimalModSetting("Flashlight follow delay", "The amount of seconds until the Flashlight follow area reaches the cursor.", ModFlashlight.defaultFollowDelay, ModFlashlight.defaultFollowDelay, ModFlashlight.defaultFollowDelay * 10, ModFlashlight.defaultFollowDelay, 2);
|
|
2555
|
+
this.followDelay = new DecimalModSetting("Flashlight follow delay", "areaFollowDelay", "The amount of seconds until the Flashlight follow area reaches the cursor.", ModFlashlight.defaultFollowDelay, ModFlashlight.defaultFollowDelay, ModFlashlight.defaultFollowDelay * 10, ModFlashlight.defaultFollowDelay, 2);
|
|
2556
|
+
/**
|
|
2557
|
+
* The multiplier applied to the default Flashlight size.
|
|
2558
|
+
*/
|
|
2559
|
+
this.sizeMultiplier = new DecimalModSetting("Flashlight size", "sizeMultiplier", "The multiplier applied to the default Flashlight size.", 1, 0.5, 2, 0.1, 1);
|
|
2560
|
+
/**
|
|
2561
|
+
* Whether to decrease the Flashlight size as combo increases.
|
|
2562
|
+
*/
|
|
2563
|
+
this.comboBasedSize = new BooleanModSetting("Change size based on combo", "comboBasedSize", "Whether to decrease the Flashlight size as combo increases.", true);
|
|
2665
2564
|
this.incompatibleMods.add(ModBlinds);
|
|
2666
2565
|
}
|
|
2667
|
-
copySettings(mod) {
|
|
2668
|
-
var _a, _b;
|
|
2669
|
-
super.copySettings(mod);
|
|
2670
|
-
this.followDelay.value =
|
|
2671
|
-
(_b = (_a = mod.settings) === null || _a === void 0 ? void 0 : _a.areaFollowDelay) !== null && _b !== void 0 ? _b : this.followDelay.value;
|
|
2672
|
-
}
|
|
2673
|
-
serializeSettings() {
|
|
2674
|
-
return { areaFollowDelay: this.followDelay.value };
|
|
2675
|
-
}
|
|
2676
2566
|
toString() {
|
|
2677
|
-
if (this.
|
|
2567
|
+
if (this.usesDefaultSettings) {
|
|
2678
2568
|
return super.toString();
|
|
2679
2569
|
}
|
|
2680
|
-
|
|
2570
|
+
const parts = [];
|
|
2571
|
+
if (!this.followDelay.isDefault) {
|
|
2572
|
+
parts.push(`${this.followDelay.toDisplayString()}s follow delay`);
|
|
2573
|
+
}
|
|
2574
|
+
if (!this.sizeMultiplier.isDefault) {
|
|
2575
|
+
parts.push(`${this.sizeMultiplier.toDisplayString()}x size`);
|
|
2576
|
+
}
|
|
2577
|
+
if (!this.comboBasedSize.isDefault) {
|
|
2578
|
+
parts.push(`${this.comboBasedSize.value ? "decrease" : "no"} size change with combo`);
|
|
2579
|
+
}
|
|
2580
|
+
return `${super.toString()} (${parts.join(", ")})`;
|
|
2681
2581
|
}
|
|
2682
2582
|
}
|
|
2683
2583
|
/**
|
|
@@ -2712,6 +2612,17 @@ class ModRateAdjustHelper {
|
|
|
2712
2612
|
? 1 + (this.trackRateMultiplier - 1) * 0.24
|
|
2713
2613
|
: Math.pow(0.3, (1 - this.trackRateMultiplier) * 4);
|
|
2714
2614
|
}
|
|
2615
|
+
/**
|
|
2616
|
+
* The score multiplier used when reverse-engineering raw scores from stored total score with
|
|
2617
|
+
* multiplier during database migration for osu!droid. Defaults to {@link droidScoreMultiplier}.
|
|
2618
|
+
*
|
|
2619
|
+
* **If {@link droidScoreMultiplier} is changed in the future, this must be changed in the affected `Mod`
|
|
2620
|
+
* subclass to return the old formula, so scores that need to be migrated on-fly are divided by the correct
|
|
2621
|
+
* historical multiplier**.
|
|
2622
|
+
*/
|
|
2623
|
+
get migrationDroidScoreMultiplier() {
|
|
2624
|
+
return this.droidScoreMultiplier;
|
|
2625
|
+
}
|
|
2715
2626
|
constructor(trackRateMultiplier) {
|
|
2716
2627
|
this.trackRateMultiplier = trackRateMultiplier;
|
|
2717
2628
|
}
|
|
@@ -2728,6 +2639,12 @@ class ModRateAdjust extends Mod {
|
|
|
2728
2639
|
return new ModRateAdjustHelper(this.trackRateMultiplier.value)
|
|
2729
2640
|
.droidScoreMultiplier;
|
|
2730
2641
|
}
|
|
2642
|
+
/**
|
|
2643
|
+
* The generic osu!droid migration score multiplier of this `Mod`.
|
|
2644
|
+
*/
|
|
2645
|
+
get migrationDroidScoreMultiplier() {
|
|
2646
|
+
return this.droidScoreMultiplier;
|
|
2647
|
+
}
|
|
2731
2648
|
/**
|
|
2732
2649
|
* Generic getter to determine if this `ModRateAdjust` is relevant.
|
|
2733
2650
|
*/
|
|
@@ -2736,7 +2653,11 @@ class ModRateAdjust extends Mod {
|
|
|
2736
2653
|
}
|
|
2737
2654
|
constructor(trackRateMultiplier = 1) {
|
|
2738
2655
|
super();
|
|
2739
|
-
|
|
2656
|
+
/**
|
|
2657
|
+
* The multiplier for the track's playback rate after applying this `Mod`.
|
|
2658
|
+
*/
|
|
2659
|
+
this.trackRateMultiplier = new DecimalModSetting("Track rate multiplier", "rateMultiplier", "The multiplier for the track's playback rate after applying this mod.", 1, 0.5, 2, 0.05, 2);
|
|
2660
|
+
this.trackRateMultiplier.value = trackRateMultiplier;
|
|
2740
2661
|
}
|
|
2741
2662
|
applyToRate(_, rate) {
|
|
2742
2663
|
return rate * this.trackRateMultiplier.value;
|
|
@@ -2756,18 +2677,15 @@ class ModCustomSpeed extends ModRateAdjust {
|
|
|
2756
2677
|
this.droidRanked = true;
|
|
2757
2678
|
this.osuRanked = false;
|
|
2758
2679
|
}
|
|
2759
|
-
copySettings(mod) {
|
|
2760
|
-
var _a, _b;
|
|
2761
|
-
super.copySettings(mod);
|
|
2762
|
-
this.trackRateMultiplier.value =
|
|
2763
|
-
(_b = (_a = mod.settings) === null || _a === void 0 ? void 0 : _a.rateMultiplier) !== null && _b !== void 0 ? _b : this.trackRateMultiplier.value;
|
|
2764
|
-
}
|
|
2765
2680
|
get isDroidRelevant() {
|
|
2766
2681
|
return this.isRelevant;
|
|
2767
2682
|
}
|
|
2768
2683
|
get droidScoreMultiplier() {
|
|
2769
2684
|
return super.droidScoreMultiplier;
|
|
2770
2685
|
}
|
|
2686
|
+
get migrationDroidScoreMultiplier() {
|
|
2687
|
+
return super.migrationDroidScoreMultiplier;
|
|
2688
|
+
}
|
|
2771
2689
|
get isOsuRelevant() {
|
|
2772
2690
|
return this.isRelevant;
|
|
2773
2691
|
}
|
|
@@ -2780,9 +2698,6 @@ class ModCustomSpeed extends ModRateAdjust {
|
|
|
2780
2698
|
? 1 + value / 5
|
|
2781
2699
|
: 0.6 + value;
|
|
2782
2700
|
}
|
|
2783
|
-
serializeSettings() {
|
|
2784
|
-
return { rateMultiplier: this.trackRateMultiplier.value };
|
|
2785
|
-
}
|
|
2786
2701
|
toString() {
|
|
2787
2702
|
return `${super.toString()} (${this.trackRateMultiplier.toDisplayString()}x)`;
|
|
2788
2703
|
}
|
|
@@ -2800,16 +2715,6 @@ class ModObjectScaleTween extends Mod {
|
|
|
2800
2715
|
this.endScale = 1;
|
|
2801
2716
|
this.incompatibleMods.add(ModObjectScaleTween).add(ModTraceable);
|
|
2802
2717
|
}
|
|
2803
|
-
copySettings(mod) {
|
|
2804
|
-
var _a;
|
|
2805
|
-
super.copySettings(mod);
|
|
2806
|
-
const { settings } = mod;
|
|
2807
|
-
this.startScale.value =
|
|
2808
|
-
(_a = settings === null || settings === void 0 ? void 0 : settings.startScale) !== null && _a !== void 0 ? _a : this.startScale.value;
|
|
2809
|
-
}
|
|
2810
|
-
serializeSettings() {
|
|
2811
|
-
return { startScale: this.startScale.value };
|
|
2812
|
-
}
|
|
2813
2718
|
}
|
|
2814
2719
|
|
|
2815
2720
|
/**
|
|
@@ -2823,10 +2728,11 @@ class ModDeflate extends ModObjectScaleTween {
|
|
|
2823
2728
|
this.droidRanked = false;
|
|
2824
2729
|
this.isDroidRelevant = true;
|
|
2825
2730
|
this.droidScoreMultiplier = 1;
|
|
2731
|
+
this.migrationDroidScoreMultiplier = 1;
|
|
2826
2732
|
this.osuRanked = false;
|
|
2827
2733
|
this.isOsuRelevant = true;
|
|
2828
2734
|
this.osuScoreMultiplier = 1;
|
|
2829
|
-
this.startScale = new DecimalModSetting("Start scale", "The initial size multiplier applied to all hit objects.", 2, 1, 25, 0.1, 1);
|
|
2735
|
+
this.startScale = new DecimalModSetting("Start scale", "startScale", "The initial size multiplier applied to all hit objects.", 2, 1, 25, 0.1, 1);
|
|
2830
2736
|
}
|
|
2831
2737
|
}
|
|
2832
2738
|
|
|
@@ -4028,6 +3934,47 @@ class WorkingObject {
|
|
|
4028
3934
|
}
|
|
4029
3935
|
}
|
|
4030
3936
|
|
|
3937
|
+
/**
|
|
3938
|
+
* Defines available axes.
|
|
3939
|
+
*/
|
|
3940
|
+
exports.Axes = void 0;
|
|
3941
|
+
(function (Axes) {
|
|
3942
|
+
/**
|
|
3943
|
+
* No axis.
|
|
3944
|
+
*/
|
|
3945
|
+
Axes[Axes["none"] = 0] = "none";
|
|
3946
|
+
/**
|
|
3947
|
+
* The X axis.
|
|
3948
|
+
*/
|
|
3949
|
+
Axes[Axes["x"] = 1] = "x";
|
|
3950
|
+
/**
|
|
3951
|
+
* The Y axis.
|
|
3952
|
+
*/
|
|
3953
|
+
Axes[Axes["y"] = 2] = "y";
|
|
3954
|
+
/**
|
|
3955
|
+
* The X and Y axes.
|
|
3956
|
+
*/
|
|
3957
|
+
Axes[Axes["both"] = 3] = "both";
|
|
3958
|
+
})(exports.Axes || (exports.Axes = {}));
|
|
3959
|
+
|
|
3960
|
+
// Serializes Axes as a 0-indexed ordinal to match the Kotlin EnumModSetting format:
|
|
3961
|
+
// Axes.x (1) -> 0, Axes.y (2) -> 1, Axes.both (3) -> 2.
|
|
3962
|
+
class AxesModSetting extends ModSetting {
|
|
3963
|
+
load(settings) {
|
|
3964
|
+
if (this.key === null) {
|
|
3965
|
+
return;
|
|
3966
|
+
}
|
|
3967
|
+
const stored = settings[this.key];
|
|
3968
|
+
if (typeof stored === "number") {
|
|
3969
|
+
this.value = (stored + 1);
|
|
3970
|
+
}
|
|
3971
|
+
}
|
|
3972
|
+
save(settings) {
|
|
3973
|
+
if (this.key !== null) {
|
|
3974
|
+
settings[this.key] = this.value - 1;
|
|
3975
|
+
}
|
|
3976
|
+
}
|
|
3977
|
+
}
|
|
4031
3978
|
/**
|
|
4032
3979
|
* Represents the Mirror mod.
|
|
4033
3980
|
*/
|
|
@@ -4039,30 +3986,16 @@ class ModMirror extends Mod {
|
|
|
4039
3986
|
this.droidRanked = false;
|
|
4040
3987
|
this.isDroidRelevant = true;
|
|
4041
3988
|
this.droidScoreMultiplier = 1;
|
|
3989
|
+
this.migrationDroidScoreMultiplier = 1;
|
|
4042
3990
|
this.osuRanked = false;
|
|
4043
3991
|
this.isOsuRelevant = true;
|
|
4044
3992
|
this.osuScoreMultiplier = 1;
|
|
4045
3993
|
/**
|
|
4046
3994
|
* The axes to reflect the `HitObject`s along.
|
|
4047
3995
|
*/
|
|
4048
|
-
this.flippedAxes = new
|
|
3996
|
+
this.flippedAxes = new AxesModSetting("Flipped axes", "flippedAxes", "The axes to reflect the hit objects along.", exports.Axes.x);
|
|
4049
3997
|
this.incompatibleMods.add(ModHardRock);
|
|
4050
3998
|
}
|
|
4051
|
-
copySettings(mod) {
|
|
4052
|
-
var _a;
|
|
4053
|
-
super.copySettings(mod);
|
|
4054
|
-
switch ((_a = mod.settings) === null || _a === void 0 ? void 0 : _a.flippedAxes) {
|
|
4055
|
-
case 0:
|
|
4056
|
-
this.flippedAxes.value = exports.Axes.x;
|
|
4057
|
-
break;
|
|
4058
|
-
case 1:
|
|
4059
|
-
this.flippedAxes.value = exports.Axes.y;
|
|
4060
|
-
break;
|
|
4061
|
-
case 2:
|
|
4062
|
-
this.flippedAxes.value = exports.Axes.both;
|
|
4063
|
-
break;
|
|
4064
|
-
}
|
|
4065
|
-
}
|
|
4066
3999
|
applyToHitObject(_, hitObject) {
|
|
4067
4000
|
switch (this.flippedAxes.value) {
|
|
4068
4001
|
case exports.Axes.x:
|
|
@@ -4077,9 +4010,6 @@ class ModMirror extends Mod {
|
|
|
4077
4010
|
break;
|
|
4078
4011
|
}
|
|
4079
4012
|
}
|
|
4080
|
-
serializeSettings() {
|
|
4081
|
-
return { flippedAxes: this.flippedAxes.value - 1 };
|
|
4082
|
-
}
|
|
4083
4013
|
toString() {
|
|
4084
4014
|
const settings = [];
|
|
4085
4015
|
if (this.flippedAxes.value === exports.Axes.x ||
|
|
@@ -4112,6 +4042,7 @@ class ModReplayV6 extends Mod {
|
|
|
4112
4042
|
this.droidRanked = false;
|
|
4113
4043
|
this.isDroidRelevant = true;
|
|
4114
4044
|
this.droidScoreMultiplier = 1;
|
|
4045
|
+
this.migrationDroidScoreMultiplier = 1;
|
|
4115
4046
|
this.facilitateAdjustment = true;
|
|
4116
4047
|
}
|
|
4117
4048
|
applyToBeatmap(beatmap) {
|
|
@@ -4158,6 +4089,7 @@ class ModHardRock extends Mod {
|
|
|
4158
4089
|
this.droidRanked = true;
|
|
4159
4090
|
this.isDroidRelevant = true;
|
|
4160
4091
|
this.droidScoreMultiplier = 1.06;
|
|
4092
|
+
this.migrationDroidScoreMultiplier = 1.06;
|
|
4161
4093
|
this.osuRanked = true;
|
|
4162
4094
|
this.isOsuRelevant = true;
|
|
4163
4095
|
this.osuScoreMultiplier = 1.06;
|
|
@@ -4207,6 +4139,7 @@ class ModEasy extends Mod {
|
|
|
4207
4139
|
this.droidRanked = true;
|
|
4208
4140
|
this.isDroidRelevant = true;
|
|
4209
4141
|
this.droidScoreMultiplier = 0.5;
|
|
4142
|
+
this.migrationDroidScoreMultiplier = 0.5;
|
|
4210
4143
|
this.osuRanked = true;
|
|
4211
4144
|
this.isOsuRelevant = true;
|
|
4212
4145
|
this.osuScoreMultiplier = 0.5;
|
|
@@ -4249,6 +4182,7 @@ class ModReallyEasy extends Mod {
|
|
|
4249
4182
|
this.droidRanked = false;
|
|
4250
4183
|
this.isDroidRelevant = true;
|
|
4251
4184
|
this.droidScoreMultiplier = 0.4;
|
|
4185
|
+
this.migrationDroidScoreMultiplier = 0.4;
|
|
4252
4186
|
}
|
|
4253
4187
|
applyToDifficultyWithMods(mode, difficulty, mods) {
|
|
4254
4188
|
var _a;
|
|
@@ -4307,6 +4241,7 @@ class ModSmallCircle extends Mod {
|
|
|
4307
4241
|
this.droidRanked = false;
|
|
4308
4242
|
this.isDroidRelevant = true;
|
|
4309
4243
|
this.droidScoreMultiplier = 1;
|
|
4244
|
+
this.migrationDroidScoreMultiplier = 1;
|
|
4310
4245
|
}
|
|
4311
4246
|
migrateDroidMod(difficulty) {
|
|
4312
4247
|
return new ModDifficultyAdjust({ cs: difficulty.cs + 4 });
|
|
@@ -4351,8 +4286,8 @@ class NullableDecimalModSetting extends RangeConstrainedModSetting {
|
|
|
4351
4286
|
this.value = this.processValue(this.value);
|
|
4352
4287
|
}
|
|
4353
4288
|
}
|
|
4354
|
-
constructor(name, description, defaultValue, min = -Number.MAX_VALUE, max = Number.MAX_VALUE, step = 0, precision = null) {
|
|
4355
|
-
super(name, description, defaultValue, min, max, step);
|
|
4289
|
+
constructor(name, key, description, defaultValue, min = -Number.MAX_VALUE, max = Number.MAX_VALUE, step = 0, precision = null) {
|
|
4290
|
+
super(name, key, description, defaultValue, min, max, step);
|
|
4356
4291
|
this.displayFormatter = (v) => {
|
|
4357
4292
|
if (v === null) {
|
|
4358
4293
|
return "None";
|
|
@@ -4378,12 +4313,84 @@ class NullableDecimalModSetting extends RangeConstrainedModSetting {
|
|
|
4378
4313
|
if (value === null) {
|
|
4379
4314
|
return null;
|
|
4380
4315
|
}
|
|
4381
|
-
const
|
|
4316
|
+
const stepped = this.step > 0
|
|
4317
|
+
? Math.round(value / this.step) * this.step
|
|
4318
|
+
: value;
|
|
4319
|
+
const processedValue = MathUtils.clamp(stepped, this.min, this.max);
|
|
4382
4320
|
if (this.precision !== null) {
|
|
4383
4321
|
return parseFloat(processedValue.toFixed(this.precision));
|
|
4384
4322
|
}
|
|
4385
4323
|
return processedValue;
|
|
4386
4324
|
}
|
|
4325
|
+
load(settings) {
|
|
4326
|
+
if (this.key === null) {
|
|
4327
|
+
return;
|
|
4328
|
+
}
|
|
4329
|
+
const stored = settings[this.key];
|
|
4330
|
+
if (stored === null || stored === undefined) {
|
|
4331
|
+
this.value = null;
|
|
4332
|
+
}
|
|
4333
|
+
else if (typeof stored === "number") {
|
|
4334
|
+
this.value = stored;
|
|
4335
|
+
}
|
|
4336
|
+
}
|
|
4337
|
+
save(settings) {
|
|
4338
|
+
if (this.key !== null) {
|
|
4339
|
+
settings[this.key] = this.value;
|
|
4340
|
+
}
|
|
4341
|
+
}
|
|
4342
|
+
}
|
|
4343
|
+
|
|
4344
|
+
/**
|
|
4345
|
+
* A `NullableDecimalModSetting` variant for `ModDifficultyAdjust` that embeds the beatmap's original
|
|
4346
|
+
* difficulty value alongside the user's adjusted value in the serialized format:
|
|
4347
|
+
*
|
|
4348
|
+
* `{ "adjusted": 7.0, "original": 4.0 }`
|
|
4349
|
+
*
|
|
4350
|
+
* When `originalValue` is non-null, the score multiplier can be computed from the serialized format
|
|
4351
|
+
* alone, without a beatmap lookup. When `null`, `applyFromBeatmapDifficulty` must be called first.
|
|
4352
|
+
*
|
|
4353
|
+
* Legacy scalar values (e.g. `"cs": 7.0`) are accepted in `load` for backward compatibility.
|
|
4354
|
+
*/
|
|
4355
|
+
class DifficultyAdjustModSetting extends NullableDecimalModSetting {
|
|
4356
|
+
constructor(name, key, description, min = -Number.MAX_VALUE, max = Number.MAX_VALUE, step = 0, precision = null) {
|
|
4357
|
+
super(name, key, description, null, min, max, step, precision);
|
|
4358
|
+
/**
|
|
4359
|
+
* The beatmap's original value for this setting, populated by `applyFromBeatmapDifficulty`.
|
|
4360
|
+
*
|
|
4361
|
+
* Non-null means the score multiplier is self-contained; `null` means a beatmap lookup is needed.
|
|
4362
|
+
*/
|
|
4363
|
+
this.originalValue = null;
|
|
4364
|
+
}
|
|
4365
|
+
load(settings) {
|
|
4366
|
+
if (this.key === null) {
|
|
4367
|
+
return;
|
|
4368
|
+
}
|
|
4369
|
+
const data = settings[this.key];
|
|
4370
|
+
if (typeof data === "object" && data !== null) {
|
|
4371
|
+
const { adjusted, original } = data;
|
|
4372
|
+
this.value = typeof adjusted === "number" ? adjusted : null;
|
|
4373
|
+
const originalNum = typeof original === "number" ? original : null;
|
|
4374
|
+
this.originalValue = originalNum;
|
|
4375
|
+
if (originalNum !== null) {
|
|
4376
|
+
this.defaultValue = originalNum;
|
|
4377
|
+
}
|
|
4378
|
+
}
|
|
4379
|
+
else if (typeof data === "number") {
|
|
4380
|
+
// Legacy scalar format.
|
|
4381
|
+
this.value = data;
|
|
4382
|
+
this.originalValue = null;
|
|
4383
|
+
}
|
|
4384
|
+
}
|
|
4385
|
+
save(settings) {
|
|
4386
|
+
if (this.key === null || this.value === null) {
|
|
4387
|
+
return;
|
|
4388
|
+
}
|
|
4389
|
+
settings[this.key] = {
|
|
4390
|
+
adjusted: this.value,
|
|
4391
|
+
original: this.originalValue,
|
|
4392
|
+
};
|
|
4393
|
+
}
|
|
4387
4394
|
}
|
|
4388
4395
|
|
|
4389
4396
|
/**
|
|
@@ -4408,32 +4415,24 @@ class ModDifficultyAdjust extends Mod {
|
|
|
4408
4415
|
/**
|
|
4409
4416
|
* The circle size to enforce.
|
|
4410
4417
|
*/
|
|
4411
|
-
this.cs = new
|
|
4418
|
+
this.cs = new DifficultyAdjustModSetting("Circle size", "cs", "The circle size to enforce.", 0, 15, 0.1, 1);
|
|
4412
4419
|
/**
|
|
4413
4420
|
* The approach rate to enforce.
|
|
4414
4421
|
*/
|
|
4415
|
-
this.ar = new
|
|
4422
|
+
this.ar = new DifficultyAdjustModSetting("Approach rate", "ar", "The approach rate to enforce.", 0, 11, 0.1, 1);
|
|
4416
4423
|
/**
|
|
4417
4424
|
* The overall difficulty to enforce.
|
|
4418
4425
|
*/
|
|
4419
|
-
this.od = new
|
|
4426
|
+
this.od = new DifficultyAdjustModSetting("Overall difficulty", "od", "The overall difficulty to enforce.", 0, 11, 0.1, 1);
|
|
4420
4427
|
/**
|
|
4421
4428
|
* The health drain rate to enforce.
|
|
4422
4429
|
*/
|
|
4423
|
-
this.hp = new
|
|
4430
|
+
this.hp = new DifficultyAdjustModSetting("Health drain", "hp", "The health drain to enforce.", 0, 11, 0.1, 1);
|
|
4424
4431
|
this.cs.value = this.cs.defaultValue = (_a = values === null || values === void 0 ? void 0 : values.cs) !== null && _a !== void 0 ? _a : null;
|
|
4425
4432
|
this.ar.value = this.ar.defaultValue = (_b = values === null || values === void 0 ? void 0 : values.ar) !== null && _b !== void 0 ? _b : null;
|
|
4426
4433
|
this.od.value = this.od.defaultValue = (_c = values === null || values === void 0 ? void 0 : values.od) !== null && _c !== void 0 ? _c : null;
|
|
4427
4434
|
this.hp.value = this.hp.defaultValue = (_d = values === null || values === void 0 ? void 0 : values.hp) !== null && _d !== void 0 ? _d : null;
|
|
4428
4435
|
}
|
|
4429
|
-
copySettings(mod) {
|
|
4430
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4431
|
-
super.copySettings(mod);
|
|
4432
|
-
this.cs.value = ((_b = (_a = mod.settings) === null || _a === void 0 ? void 0 : _a.cs) !== null && _b !== void 0 ? _b : null);
|
|
4433
|
-
this.ar.value = ((_d = (_c = mod.settings) === null || _c === void 0 ? void 0 : _c.ar) !== null && _d !== void 0 ? _d : null);
|
|
4434
|
-
this.od.value = ((_f = (_e = mod.settings) === null || _e === void 0 ? void 0 : _e.od) !== null && _f !== void 0 ? _f : null);
|
|
4435
|
-
this.hp.value = ((_h = (_g = mod.settings) === null || _g === void 0 ? void 0 : _g.hp) !== null && _h !== void 0 ? _h : null);
|
|
4436
|
-
}
|
|
4437
4436
|
get isDroidRelevant() {
|
|
4438
4437
|
return this.isRelevant;
|
|
4439
4438
|
}
|
|
@@ -4456,11 +4455,14 @@ class ModDifficultyAdjust extends Mod {
|
|
|
4456
4455
|
}
|
|
4457
4456
|
return multiplier;
|
|
4458
4457
|
}
|
|
4459
|
-
|
|
4460
|
-
this.
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
this.
|
|
4458
|
+
get migrationDroidScoreMultiplier() {
|
|
4459
|
+
return this.droidScoreMultiplier;
|
|
4460
|
+
}
|
|
4461
|
+
applyFromBeatmapDifficulty(difficulty) {
|
|
4462
|
+
this.cs.originalValue = difficulty.cs;
|
|
4463
|
+
this.ar.originalValue = difficulty.ar;
|
|
4464
|
+
this.od.originalValue = difficulty.od;
|
|
4465
|
+
this.hp.originalValue = difficulty.hp;
|
|
4464
4466
|
}
|
|
4465
4467
|
applyToDifficultyWithMods(_, difficulty, mods) {
|
|
4466
4468
|
var _a, _b, _c, _d;
|
|
@@ -4504,25 +4506,6 @@ class ModDifficultyAdjust extends Mod {
|
|
|
4504
4506
|
}
|
|
4505
4507
|
return super.isCompatibleWith(other);
|
|
4506
4508
|
}
|
|
4507
|
-
serializeSettings() {
|
|
4508
|
-
if (!this.isRelevant) {
|
|
4509
|
-
return null;
|
|
4510
|
-
}
|
|
4511
|
-
const settings = {};
|
|
4512
|
-
if (this.cs.value !== null) {
|
|
4513
|
-
settings.cs = this.cs.value;
|
|
4514
|
-
}
|
|
4515
|
-
if (this.ar.value !== null) {
|
|
4516
|
-
settings.ar = this.ar.value;
|
|
4517
|
-
}
|
|
4518
|
-
if (this.od.value !== null) {
|
|
4519
|
-
settings.od = this.od.value;
|
|
4520
|
-
}
|
|
4521
|
-
if (this.hp.value !== null) {
|
|
4522
|
-
settings.hp = this.hp.value;
|
|
4523
|
-
}
|
|
4524
|
-
return settings;
|
|
4525
|
-
}
|
|
4526
4509
|
applyFadeAdjustment(hitObject, mods) {
|
|
4527
4510
|
// IMPORTANT: These do not use `ModUtil.calculateRateWithMods` to avoid circular dependency.
|
|
4528
4511
|
const initialTrackRate = this.calculateTrackRate(mods.values());
|
|
@@ -4583,6 +4566,9 @@ class ModNightCore extends ModRateAdjust {
|
|
|
4583
4566
|
get droidScoreMultiplier() {
|
|
4584
4567
|
return super.droidScoreMultiplier;
|
|
4585
4568
|
}
|
|
4569
|
+
get migrationDroidScoreMultiplier() {
|
|
4570
|
+
return super.migrationDroidScoreMultiplier;
|
|
4571
|
+
}
|
|
4586
4572
|
get isOsuRelevant() {
|
|
4587
4573
|
return this.isRelevant;
|
|
4588
4574
|
}
|
|
@@ -4608,6 +4594,9 @@ class ModHalfTime extends ModRateAdjust {
|
|
|
4608
4594
|
get droidScoreMultiplier() {
|
|
4609
4595
|
return super.droidScoreMultiplier;
|
|
4610
4596
|
}
|
|
4597
|
+
get migrationDroidScoreMultiplier() {
|
|
4598
|
+
return super.migrationDroidScoreMultiplier;
|
|
4599
|
+
}
|
|
4611
4600
|
get isOsuRelevant() {
|
|
4612
4601
|
return this.isRelevant;
|
|
4613
4602
|
}
|
|
@@ -4633,6 +4622,9 @@ class ModDoubleTime extends ModRateAdjust {
|
|
|
4633
4622
|
get droidScoreMultiplier() {
|
|
4634
4623
|
return super.droidScoreMultiplier;
|
|
4635
4624
|
}
|
|
4625
|
+
get migrationDroidScoreMultiplier() {
|
|
4626
|
+
return super.migrationDroidScoreMultiplier;
|
|
4627
|
+
}
|
|
4636
4628
|
get isOsuRelevant() {
|
|
4637
4629
|
return this.isRelevant;
|
|
4638
4630
|
}
|
|
@@ -4649,10 +4641,11 @@ class ModGrow extends ModObjectScaleTween {
|
|
|
4649
4641
|
this.droidRanked = false;
|
|
4650
4642
|
this.isDroidRelevant = true;
|
|
4651
4643
|
this.droidScoreMultiplier = 1;
|
|
4644
|
+
this.migrationDroidScoreMultiplier = 1;
|
|
4652
4645
|
this.osuRanked = false;
|
|
4653
4646
|
this.isOsuRelevant = true;
|
|
4654
4647
|
this.osuScoreMultiplier = 1;
|
|
4655
|
-
this.startScale = new DecimalModSetting("Start scale", "The initial size multiplier applied to all hit objects.", 0.5, 0, 0.99, 0.01, 2);
|
|
4648
|
+
this.startScale = new DecimalModSetting("Start scale", "startScale", "The initial size multiplier applied to all hit objects.", 0.5, 0, 0.99, 0.01, 2);
|
|
4656
4649
|
}
|
|
4657
4650
|
}
|
|
4658
4651
|
|
|
@@ -4670,7 +4663,7 @@ class ModMagnetised extends Mod {
|
|
|
4670
4663
|
/**
|
|
4671
4664
|
* How strong the pull is.
|
|
4672
4665
|
*/
|
|
4673
|
-
this.attractionStrength = new DecimalModSetting("Attraction Strength", "How strong the pull is.", 0.5, 0.05, 1, 0.05, 2);
|
|
4666
|
+
this.attractionStrength = new DecimalModSetting("Attraction Strength", "attractionStrength", "How strong the pull is.", 0.5, 0.05, 1, 0.05, 2);
|
|
4674
4667
|
}
|
|
4675
4668
|
}
|
|
4676
4669
|
|
|
@@ -4678,8 +4671,8 @@ class ModMagnetised extends Mod {
|
|
|
4678
4671
|
* Represents a `Mod` specific setting that is constrained to a range of integer values.
|
|
4679
4672
|
*/
|
|
4680
4673
|
class IntegerModSetting extends NumberModSetting {
|
|
4681
|
-
constructor(name, description, defaultValue, min = -2147483648, max = 2147483647) {
|
|
4682
|
-
super(name, description, defaultValue, min, max, 1);
|
|
4674
|
+
constructor(name, key, description, defaultValue, min = -2147483648, max = 2147483647) {
|
|
4675
|
+
super(name, key, description, defaultValue, min, max, 1);
|
|
4683
4676
|
}
|
|
4684
4677
|
}
|
|
4685
4678
|
|
|
@@ -4694,25 +4687,26 @@ class ModMuted extends Mod {
|
|
|
4694
4687
|
this.droidRanked = false;
|
|
4695
4688
|
this.isDroidRelevant = true;
|
|
4696
4689
|
this.droidScoreMultiplier = 1;
|
|
4690
|
+
this.migrationDroidScoreMultiplier = 1;
|
|
4697
4691
|
this.osuRanked = true;
|
|
4698
4692
|
this.isOsuRelevant = true;
|
|
4699
4693
|
this.osuScoreMultiplier = 1;
|
|
4700
4694
|
/**
|
|
4701
4695
|
* Increase volume as combo builds.
|
|
4702
4696
|
*/
|
|
4703
|
-
this.inverseMuting = new BooleanModSetting("Start muted", "Increase volume as combo builds.", false);
|
|
4697
|
+
this.inverseMuting = new BooleanModSetting("Start muted", "inverseMuting", "Increase volume as combo builds.", false);
|
|
4704
4698
|
/**
|
|
4705
4699
|
* Add a metronome beat to help the player keep track of the rhythm.
|
|
4706
4700
|
*/
|
|
4707
|
-
this.enableMetronome = new BooleanModSetting("Enable metronome", "Add a metronome beat to help you keep track of the rhythm.", true);
|
|
4701
|
+
this.enableMetronome = new BooleanModSetting("Enable metronome", "enableMetronome", "Add a metronome beat to help you keep track of the rhythm.", true);
|
|
4708
4702
|
/**
|
|
4709
4703
|
* The combo count at which point the track reaches its final volume.
|
|
4710
4704
|
*/
|
|
4711
|
-
this.muteComboCount = new IntegerModSetting("Final volume at combo", "The combo count at which point the track reaches its final volume.", 100, 0, 500);
|
|
4705
|
+
this.muteComboCount = new IntegerModSetting("Final volume at combo", "muteComboCount", "The combo count at which point the track reaches its final volume.", 100, 0, 500);
|
|
4712
4706
|
/**
|
|
4713
4707
|
* Hit sounds are also muted alongside the track.
|
|
4714
4708
|
*/
|
|
4715
|
-
this.affectsHitSounds = new BooleanModSetting("Mute hit sounds", "Hit sounds are also muted alongside the track.", true);
|
|
4709
|
+
this.affectsHitSounds = new BooleanModSetting("Mute hit sounds", "affectsHitSounds", "Hit sounds are also muted alongside the track.", true);
|
|
4716
4710
|
this.inverseMuting.bindValueChanged((value) => {
|
|
4717
4711
|
this.muteComboCount.min = value.newValue ? 1 : 0;
|
|
4718
4712
|
}, true);
|
|
@@ -4727,27 +4721,6 @@ class ModMuted extends Mod {
|
|
|
4727
4721
|
const volume = MathUtils.clamp(combo / Math.max(1, this.muteComboCount.value), 0, 1);
|
|
4728
4722
|
return this.inverseMuting.value ? volume : 1 - volume;
|
|
4729
4723
|
}
|
|
4730
|
-
copySettings(mod) {
|
|
4731
|
-
var _a, _b, _c, _d;
|
|
4732
|
-
super.copySettings(mod);
|
|
4733
|
-
const { settings } = mod;
|
|
4734
|
-
this.inverseMuting.value =
|
|
4735
|
-
(_a = settings === null || settings === void 0 ? void 0 : settings.inverseMuting) !== null && _a !== void 0 ? _a : this.inverseMuting.value;
|
|
4736
|
-
this.enableMetronome.value =
|
|
4737
|
-
(_b = settings === null || settings === void 0 ? void 0 : settings.enableMetronome) !== null && _b !== void 0 ? _b : this.enableMetronome.value;
|
|
4738
|
-
this.muteComboCount.value =
|
|
4739
|
-
(_c = settings === null || settings === void 0 ? void 0 : settings.muteComboCount) !== null && _c !== void 0 ? _c : this.muteComboCount.value;
|
|
4740
|
-
this.affectsHitSounds.value =
|
|
4741
|
-
(_d = settings === null || settings === void 0 ? void 0 : settings.affectsHitSounds) !== null && _d !== void 0 ? _d : this.affectsHitSounds.value;
|
|
4742
|
-
}
|
|
4743
|
-
serializeSettings() {
|
|
4744
|
-
return {
|
|
4745
|
-
inverseMuting: this.inverseMuting.value,
|
|
4746
|
-
enableMetronome: this.enableMetronome.value,
|
|
4747
|
-
muteComboCount: this.muteComboCount.value,
|
|
4748
|
-
affectsHitSounds: this.affectsHitSounds.value,
|
|
4749
|
-
};
|
|
4750
|
-
}
|
|
4751
4724
|
}
|
|
4752
4725
|
|
|
4753
4726
|
/**
|
|
@@ -4761,6 +4734,7 @@ class ModSuddenDeath extends Mod {
|
|
|
4761
4734
|
this.droidRanked = true;
|
|
4762
4735
|
this.isDroidRelevant = true;
|
|
4763
4736
|
this.droidScoreMultiplier = 1;
|
|
4737
|
+
this.migrationDroidScoreMultiplier = 1;
|
|
4764
4738
|
this.osuRanked = true;
|
|
4765
4739
|
this.isOsuRelevant = true;
|
|
4766
4740
|
this.osuScoreMultiplier = 1;
|
|
@@ -4780,6 +4754,7 @@ class ModPerfect extends Mod {
|
|
|
4780
4754
|
this.droidRanked = true;
|
|
4781
4755
|
this.isDroidRelevant = true;
|
|
4782
4756
|
this.droidScoreMultiplier = 1;
|
|
4757
|
+
this.migrationDroidScoreMultiplier = 1;
|
|
4783
4758
|
this.osuRanked = true;
|
|
4784
4759
|
this.isOsuRelevant = true;
|
|
4785
4760
|
this.osuScoreMultiplier = 1;
|
|
@@ -4799,6 +4774,7 @@ class ModNoFail extends Mod {
|
|
|
4799
4774
|
this.droidRanked = true;
|
|
4800
4775
|
this.isDroidRelevant = true;
|
|
4801
4776
|
this.droidScoreMultiplier = 0.5;
|
|
4777
|
+
this.migrationDroidScoreMultiplier = 0.5;
|
|
4802
4778
|
this.osuRanked = true;
|
|
4803
4779
|
this.isOsuRelevant = true;
|
|
4804
4780
|
this.osuScoreMultiplier = 0.5;
|
|
@@ -4818,6 +4794,7 @@ class ModPrecise extends Mod {
|
|
|
4818
4794
|
this.droidRanked = true;
|
|
4819
4795
|
this.isDroidRelevant = true;
|
|
4820
4796
|
this.droidScoreMultiplier = 1.06;
|
|
4797
|
+
this.migrationDroidScoreMultiplier = 1.06;
|
|
4821
4798
|
}
|
|
4822
4799
|
applyToHitObject(mode, hitObject) {
|
|
4823
4800
|
var _a, _b;
|
|
@@ -4865,6 +4842,36 @@ class Utils {
|
|
|
4865
4842
|
}
|
|
4866
4843
|
return array;
|
|
4867
4844
|
}
|
|
4845
|
+
/**
|
|
4846
|
+
* Performs a binary search on an array with a custom predicate function.
|
|
4847
|
+
*
|
|
4848
|
+
* The predicate function should return:
|
|
4849
|
+
* - a negative number if the element is less than the target,
|
|
4850
|
+
* - a positive number if the element is greater than the target, and
|
|
4851
|
+
* - 0 if the element is equal to the target.
|
|
4852
|
+
*
|
|
4853
|
+
* @param array The array to search through. Must be sorted according to the predicate function.
|
|
4854
|
+
* @param predicate The predicate function to determine the order of elements.
|
|
4855
|
+
* @returns The result of the binary search.
|
|
4856
|
+
*/
|
|
4857
|
+
static binarySearch(array, predicate) {
|
|
4858
|
+
let left = 0;
|
|
4859
|
+
let right = array.length - 1;
|
|
4860
|
+
while (left <= right) {
|
|
4861
|
+
const mid = left + ((right - left) >> 1);
|
|
4862
|
+
const result = predicate(array[mid]);
|
|
4863
|
+
if (result === 0) {
|
|
4864
|
+
return { index: mid, found: true };
|
|
4865
|
+
}
|
|
4866
|
+
else if (result < 0) {
|
|
4867
|
+
left = mid + 1;
|
|
4868
|
+
}
|
|
4869
|
+
else {
|
|
4870
|
+
right = mid - 1;
|
|
4871
|
+
}
|
|
4872
|
+
}
|
|
4873
|
+
return { index: left, found: false };
|
|
4874
|
+
}
|
|
4868
4875
|
/**
|
|
4869
4876
|
* Pauses the execution of a function for
|
|
4870
4877
|
* the specified duration.
|
|
@@ -4956,8 +4963,8 @@ Random.MAX_VALUE = 2147483647;
|
|
|
4956
4963
|
* The value can be `null`, which is treated as a special case.
|
|
4957
4964
|
*/
|
|
4958
4965
|
class NullableIntegerModSetting extends RangeConstrainedModSetting {
|
|
4959
|
-
constructor(name, description, defaultValue, min = -2147483648, max = 2147483647) {
|
|
4960
|
-
super(name, description, defaultValue, min, max, 1);
|
|
4966
|
+
constructor(name, key, description, defaultValue, min = -2147483648, max = 2147483647) {
|
|
4967
|
+
super(name, key, description, defaultValue, min, max, 1);
|
|
4961
4968
|
this.displayFormatter = (v) => { var _a; return (_a = v === null || v === void 0 ? void 0 : v.toString()) !== null && _a !== void 0 ? _a : "None"; };
|
|
4962
4969
|
if (min > max) {
|
|
4963
4970
|
throw new RangeError(`The minimum value (${min.toString()}) must be less than or equal to the maximum value (${max.toString()}).`);
|
|
@@ -4967,6 +4974,23 @@ class NullableIntegerModSetting extends RangeConstrainedModSetting {
|
|
|
4967
4974
|
throw new RangeError(`The default value (${defaultValue.toString()}) must be between the minimum (${min.toString()}) and maximum (${max.toString()}) values.`);
|
|
4968
4975
|
}
|
|
4969
4976
|
}
|
|
4977
|
+
load(settings) {
|
|
4978
|
+
if (this.key === null) {
|
|
4979
|
+
return;
|
|
4980
|
+
}
|
|
4981
|
+
const stored = settings[this.key];
|
|
4982
|
+
if (stored === null || stored === undefined) {
|
|
4983
|
+
this.value = null;
|
|
4984
|
+
}
|
|
4985
|
+
else if (typeof stored === "number") {
|
|
4986
|
+
this.value = stored;
|
|
4987
|
+
}
|
|
4988
|
+
}
|
|
4989
|
+
save(settings) {
|
|
4990
|
+
if (this.key !== null) {
|
|
4991
|
+
settings[this.key] = this.value;
|
|
4992
|
+
}
|
|
4993
|
+
}
|
|
4970
4994
|
processValue(value) {
|
|
4971
4995
|
if (value === null) {
|
|
4972
4996
|
return null;
|
|
@@ -4986,29 +5010,20 @@ class ModRandom extends Mod {
|
|
|
4986
5010
|
this.droidRanked = false;
|
|
4987
5011
|
this.isDroidRelevant = true;
|
|
4988
5012
|
this.droidScoreMultiplier = 1;
|
|
5013
|
+
this.migrationDroidScoreMultiplier = 1;
|
|
4989
5014
|
this.osuRanked = false;
|
|
4990
5015
|
this.isOsuRelevant = true;
|
|
4991
5016
|
this.osuScoreMultiplier = 1;
|
|
4992
5017
|
/**
|
|
4993
5018
|
* The seed to use.
|
|
4994
5019
|
*/
|
|
4995
|
-
this.seed = new NullableIntegerModSetting("Seed", "Use a custom seed instead of a random one.", null, 0);
|
|
5020
|
+
this.seed = new NullableIntegerModSetting("Seed", "seed", "Use a custom seed instead of a random one.", null, 0, 2147483647);
|
|
4996
5021
|
/**
|
|
4997
5022
|
* Defines how sharp the angles of `HitObject`s should be.
|
|
4998
5023
|
*/
|
|
4999
|
-
this.angleSharpness = new DecimalModSetting("Angle sharpness", "Defines how sharp the angles of hit objects should be.", 7, 1, 10, 0.1, 1);
|
|
5024
|
+
this.angleSharpness = new DecimalModSetting("Angle sharpness", "angleSharpness", "Defines how sharp the angles of hit objects should be.", 7, 1, 10, 0.1, 1);
|
|
5000
5025
|
this.random = null;
|
|
5001
5026
|
}
|
|
5002
|
-
copySettings(mod) {
|
|
5003
|
-
super.copySettings(mod);
|
|
5004
|
-
const { settings } = mod;
|
|
5005
|
-
if (typeof (settings === null || settings === void 0 ? void 0 : settings.seed) === "number") {
|
|
5006
|
-
this.seed.value = settings.seed;
|
|
5007
|
-
}
|
|
5008
|
-
if (typeof (settings === null || settings === void 0 ? void 0 : settings.angleSharpness) === "number") {
|
|
5009
|
-
this.angleSharpness.value = settings.angleSharpness;
|
|
5010
|
-
}
|
|
5011
|
-
}
|
|
5012
5027
|
applyToBeatmap(beatmap) {
|
|
5013
5028
|
var _a;
|
|
5014
5029
|
var _b;
|
|
@@ -5060,14 +5075,6 @@ class ModRandom extends Mod {
|
|
|
5060
5075
|
beatmap.hitObjects.objects[i] = repositionedHitObjects[i];
|
|
5061
5076
|
}
|
|
5062
5077
|
}
|
|
5063
|
-
serializeSettings() {
|
|
5064
|
-
const settings = {};
|
|
5065
|
-
if (this.seed.value !== null) {
|
|
5066
|
-
settings.seed = this.seed.value;
|
|
5067
|
-
}
|
|
5068
|
-
settings.angleSharpness = this.angleSharpness.value;
|
|
5069
|
-
return settings;
|
|
5070
|
-
}
|
|
5071
5078
|
getRandomOffset(stdDev) {
|
|
5072
5079
|
// Range: [0.5, 2]
|
|
5073
5080
|
// Higher angle sharpness -> lower multiplier
|
|
@@ -5143,6 +5150,7 @@ class ModScoreV2 extends Mod {
|
|
|
5143
5150
|
this.droidRanked = false;
|
|
5144
5151
|
this.isDroidRelevant = true;
|
|
5145
5152
|
this.droidScoreMultiplier = 1;
|
|
5153
|
+
this.migrationDroidScoreMultiplier = 1;
|
|
5146
5154
|
this.osuRanked = false;
|
|
5147
5155
|
this.isOsuRelevant = true;
|
|
5148
5156
|
this.osuScoreMultiplier = 1;
|
|
@@ -5176,6 +5184,7 @@ class ModSynesthesia extends Mod {
|
|
|
5176
5184
|
this.droidRanked = false;
|
|
5177
5185
|
this.isDroidRelevant = true;
|
|
5178
5186
|
this.droidScoreMultiplier = 0.8;
|
|
5187
|
+
this.migrationDroidScoreMultiplier = 0.8;
|
|
5179
5188
|
this.osuRanked = false;
|
|
5180
5189
|
this.isOsuRelevant = true;
|
|
5181
5190
|
this.osuScoreMultiplier = 0.8;
|
|
@@ -5383,21 +5392,18 @@ class ModTimeRamp extends Mod {
|
|
|
5383
5392
|
// Graph: https://www.desmos.com/calculator/1zp4vwl3o7
|
|
5384
5393
|
return Interpolation.lerp(this.calculateScoreMultiplierAt(this.initialRate.value), this.calculateScoreMultiplierAt(this.finalRate.value), ModTimeRamp.finalRateProgress);
|
|
5385
5394
|
}
|
|
5395
|
+
/**
|
|
5396
|
+
* The generic osu!droid migration score multiplier of this `Mod`.
|
|
5397
|
+
*/
|
|
5398
|
+
get migrationDroidScoreMultiplier() {
|
|
5399
|
+
return this.droidScoreMultiplier;
|
|
5400
|
+
}
|
|
5386
5401
|
constructor() {
|
|
5387
5402
|
super();
|
|
5388
5403
|
this.initialRateTime = 0;
|
|
5389
5404
|
this.finalRateTime = 0;
|
|
5390
5405
|
this.incompatibleMods.add(ModTimeRamp);
|
|
5391
5406
|
}
|
|
5392
|
-
copySettings(mod) {
|
|
5393
|
-
var _a, _b;
|
|
5394
|
-
super.copySettings(mod);
|
|
5395
|
-
const { settings } = mod;
|
|
5396
|
-
this.initialRate.value =
|
|
5397
|
-
(_a = settings === null || settings === void 0 ? void 0 : settings.initialRate) !== null && _a !== void 0 ? _a : this.initialRate.value;
|
|
5398
|
-
this.finalRate.value =
|
|
5399
|
-
(_b = settings === null || settings === void 0 ? void 0 : settings.finalRate) !== null && _b !== void 0 ? _b : this.finalRate.value;
|
|
5400
|
-
}
|
|
5401
5407
|
applyToBeatmap(beatmap) {
|
|
5402
5408
|
var _a, _b, _c, _d;
|
|
5403
5409
|
this.initialRateTime = (_b = (_a = beatmap.hitObjects.objects.at(0)) === null || _a === void 0 ? void 0 : _a.startTime) !== null && _b !== void 0 ? _b : 0;
|
|
@@ -5412,12 +5418,6 @@ class ModTimeRamp extends Mod {
|
|
|
5412
5418
|
calculateScoreMultiplierAt(rate) {
|
|
5413
5419
|
return rate > 1 ? 1 + (rate - 1) * 0.24 : Math.pow(0.3, (1 - rate) * 4);
|
|
5414
5420
|
}
|
|
5415
|
-
serializeSettings() {
|
|
5416
|
-
return {
|
|
5417
|
-
initialRate: this.initialRate.value,
|
|
5418
|
-
finalRate: this.finalRate.value,
|
|
5419
|
-
};
|
|
5420
|
-
}
|
|
5421
5421
|
toString() {
|
|
5422
5422
|
return `${super.toString()} (${this.initialRate.toDisplayString()}x - ${this.finalRate.toDisplayString()}x)`;
|
|
5423
5423
|
}
|
|
@@ -5434,6 +5434,9 @@ class ModWindDown extends ModTimeRamp {
|
|
|
5434
5434
|
get droidScoreMultiplier() {
|
|
5435
5435
|
return super.droidScoreMultiplier;
|
|
5436
5436
|
}
|
|
5437
|
+
get migrationDroidScoreMultiplier() {
|
|
5438
|
+
return super.migrationDroidScoreMultiplier;
|
|
5439
|
+
}
|
|
5437
5440
|
constructor() {
|
|
5438
5441
|
super();
|
|
5439
5442
|
this.name = "Wind Down";
|
|
@@ -5443,8 +5446,8 @@ class ModWindDown extends ModTimeRamp {
|
|
|
5443
5446
|
this.osuRanked = false;
|
|
5444
5447
|
this.isOsuRelevant = true;
|
|
5445
5448
|
this.osuScoreMultiplier = 1;
|
|
5446
|
-
this.initialRate = new DecimalModSetting("Initial rate", "The starting speed of the track.", 1, 0.51, 2, 0.01, 2);
|
|
5447
|
-
this.finalRate = new DecimalModSetting("Final rate", "The final speed to ramp to.", 0.75, 0.5, 1.99, 0.01, 2);
|
|
5449
|
+
this.initialRate = new DecimalModSetting("Initial rate", "initialRate", "The starting speed of the track.", 1, 0.51, 2, 0.01, 2);
|
|
5450
|
+
this.finalRate = new DecimalModSetting("Final rate", "finalRate", "The final speed to ramp to.", 0.75, 0.5, 1.99, 0.01, 2);
|
|
5448
5451
|
this.initialRate.bindValueChanged((value) => {
|
|
5449
5452
|
if (value.newValue <= this.finalRate.value) {
|
|
5450
5453
|
this.finalRate.value = value.newValue - this.finalRate.step;
|
|
@@ -5465,6 +5468,9 @@ class ModWindUp extends ModTimeRamp {
|
|
|
5465
5468
|
get droidScoreMultiplier() {
|
|
5466
5469
|
return super.droidScoreMultiplier;
|
|
5467
5470
|
}
|
|
5471
|
+
get migrationDroidScoreMultiplier() {
|
|
5472
|
+
return super.migrationDroidScoreMultiplier;
|
|
5473
|
+
}
|
|
5468
5474
|
constructor() {
|
|
5469
5475
|
super();
|
|
5470
5476
|
this.name = "Wind Up";
|
|
@@ -5474,8 +5480,8 @@ class ModWindUp extends ModTimeRamp {
|
|
|
5474
5480
|
this.osuRanked = false;
|
|
5475
5481
|
this.isOsuRelevant = true;
|
|
5476
5482
|
this.osuScoreMultiplier = 1;
|
|
5477
|
-
this.initialRate = new DecimalModSetting("Initial rate", "The starting speed of the track.", 1, 0.5, 1.99, 0.01, 2);
|
|
5478
|
-
this.finalRate = new DecimalModSetting("Final rate", "The final speed to ramp to.", 1.5, 0.51, 2, 0.01, 2);
|
|
5483
|
+
this.initialRate = new DecimalModSetting("Initial rate", "initialRate", "The starting speed of the track.", 1, 0.5, 1.99, 0.01, 2);
|
|
5484
|
+
this.finalRate = new DecimalModSetting("Final rate", "finalRate", "The final speed to ramp to.", 1.5, 0.51, 2, 0.01, 2);
|
|
5479
5485
|
this.initialRate.bindValueChanged((value) => {
|
|
5480
5486
|
if (value.newValue >= this.finalRate.value) {
|
|
5481
5487
|
this.finalRate.value = value.newValue + this.finalRate.step;
|
|
@@ -5517,40 +5523,62 @@ class ModUtil {
|
|
|
5517
5523
|
*
|
|
5518
5524
|
* @param mods The mods to calculate the score multiplier for.
|
|
5519
5525
|
* @param mode The game mode to calculate the score multiplier for.
|
|
5520
|
-
* @param
|
|
5526
|
+
* @param difficulty The `BeatmapDifficulty` to apply to the mods. Needed for some mods to have an effect on
|
|
5521
5527
|
* score multiplier (i.e., `ModDifficultyAdjust`).
|
|
5522
5528
|
* @returns The score multiplier.
|
|
5523
5529
|
*/
|
|
5524
|
-
static calculateScoreMultiplier(mods, mode,
|
|
5530
|
+
static calculateScoreMultiplier(mods, mode, difficulty) {
|
|
5531
|
+
return this.calculateScoreMultiplierInternal(mods, mode, (mod) => {
|
|
5532
|
+
switch (mode) {
|
|
5533
|
+
case exports.Modes.droid:
|
|
5534
|
+
return mod.isApplicableToDroid()
|
|
5535
|
+
? mod.droidScoreMultiplier
|
|
5536
|
+
: 1;
|
|
5537
|
+
case exports.Modes.osu:
|
|
5538
|
+
return mod.isApplicableToOsuStable()
|
|
5539
|
+
? mod.osuScoreMultiplier
|
|
5540
|
+
: 1;
|
|
5541
|
+
default:
|
|
5542
|
+
return 1;
|
|
5543
|
+
}
|
|
5544
|
+
}, (helper) => helper.droidScoreMultiplier, difficulty);
|
|
5545
|
+
}
|
|
5546
|
+
/**
|
|
5547
|
+
* Calculates the score multiplier for the selected `Mod`s using `Mod.migrationDroidScoreMultiplier` instead of
|
|
5548
|
+
* `Mod.droidScoreMultiplier`. Use this when reverse-engineering raw scores from stored effective scores during migration.
|
|
5549
|
+
*
|
|
5550
|
+
* @param mods The selected `Mod`s.
|
|
5551
|
+
* @return The migration score multiplier.
|
|
5552
|
+
*/
|
|
5553
|
+
static calculateMigrationScoreMultiplier(mods) {
|
|
5554
|
+
return this.calculateScoreMultiplierInternal(mods, exports.Modes.droid, (mod) => mod.isApplicableToDroid()
|
|
5555
|
+
? mod.migrationDroidScoreMultiplier
|
|
5556
|
+
: 1, (helper) => helper.migrationDroidScoreMultiplier);
|
|
5557
|
+
}
|
|
5558
|
+
static calculateScoreMultiplierInternal(mods, mode, modSelector, rateAdjustSelector, difficulty) {
|
|
5525
5559
|
// In osu!droid, rate-adjusting mods combine their track rate multipliers together, then bunched together.
|
|
5526
5560
|
let totalRateAdjustTrackRateMultiplier = 1;
|
|
5527
5561
|
let scoreMultiplier = 1;
|
|
5528
5562
|
for (const mod of mods) {
|
|
5529
|
-
if (mod.
|
|
5530
|
-
mod.
|
|
5563
|
+
if (mod.requiresBeatmapDifficulty() && difficulty) {
|
|
5564
|
+
mod.applyFromBeatmapDifficulty(difficulty);
|
|
5531
5565
|
}
|
|
5532
5566
|
if (mode === exports.Modes.droid && mod instanceof ModRateAdjust) {
|
|
5533
5567
|
totalRateAdjustTrackRateMultiplier *=
|
|
5534
5568
|
mod.trackRateMultiplier.value;
|
|
5535
5569
|
}
|
|
5536
5570
|
else {
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
break;
|
|
5543
|
-
case exports.Modes.osu:
|
|
5544
|
-
if (mod.isApplicableToOsuStable()) {
|
|
5545
|
-
scoreMultiplier *= mod.osuScoreMultiplier;
|
|
5546
|
-
}
|
|
5547
|
-
break;
|
|
5548
|
-
}
|
|
5571
|
+
const multiplierValue = modSelector(mod);
|
|
5572
|
+
scoreMultiplier =
|
|
5573
|
+
mode === exports.Modes.droid
|
|
5574
|
+
? Math.fround(scoreMultiplier * Math.fround(multiplierValue))
|
|
5575
|
+
: scoreMultiplier * multiplierValue;
|
|
5549
5576
|
}
|
|
5550
5577
|
}
|
|
5551
5578
|
if (mode === exports.Modes.droid) {
|
|
5552
5579
|
const rateAdjustHelper = new ModRateAdjustHelper(totalRateAdjustTrackRateMultiplier);
|
|
5553
|
-
scoreMultiplier
|
|
5580
|
+
scoreMultiplier = Math.fround(scoreMultiplier *
|
|
5581
|
+
Math.fround(rateAdjustSelector(rateAdjustHelper)));
|
|
5554
5582
|
}
|
|
5555
5583
|
return scoreMultiplier;
|
|
5556
5584
|
}
|
|
@@ -5713,8 +5741,8 @@ class ModUtil {
|
|
|
5713
5741
|
}
|
|
5714
5742
|
break;
|
|
5715
5743
|
case exports.Modes.osu: {
|
|
5716
|
-
const
|
|
5717
|
-
difficulty.od =
|
|
5744
|
+
const greatWindow = new OsuHitWindow(difficulty.od).greatWindow / rate;
|
|
5745
|
+
difficulty.od = (79.5 - greatWindow) / 6;
|
|
5718
5746
|
break;
|
|
5719
5747
|
}
|
|
5720
5748
|
}
|
|
@@ -7121,10 +7149,10 @@ class Beatmap {
|
|
|
7121
7149
|
*/
|
|
7122
7150
|
maxDroidScore(mods) {
|
|
7123
7151
|
const scoreMultiplier = mods
|
|
7124
|
-
? ModUtil.calculateScoreMultiplier(mods.values(), exports.Modes.droid, this)
|
|
7152
|
+
? ModUtil.calculateScoreMultiplier(mods.values(), exports.Modes.droid, this.difficulty)
|
|
7125
7153
|
: 1;
|
|
7126
7154
|
if (mods === null || mods === void 0 ? void 0 : mods.has(ModScoreV2)) {
|
|
7127
|
-
return 1e6 * scoreMultiplier;
|
|
7155
|
+
return Math.round(Math.fround(1e6 * scoreMultiplier));
|
|
7128
7156
|
}
|
|
7129
7157
|
const difficultyMultiplier = 1 +
|
|
7130
7158
|
this.difficulty.od / 10 +
|
|
@@ -7132,27 +7160,39 @@ class Beatmap {
|
|
|
7132
7160
|
(this.difficulty.cs - 3) / 4;
|
|
7133
7161
|
let combo = 0;
|
|
7134
7162
|
let score = 0;
|
|
7163
|
+
// Spinners need non-rate adjusted to calculate required spins.
|
|
7164
|
+
const nonRateAdjustedDifficulty = new BeatmapDifficulty(this.difficulty);
|
|
7165
|
+
if (mods) {
|
|
7166
|
+
ModUtil.applyModsToBeatmapDifficulty(nonRateAdjustedDifficulty, exports.Modes.droid, mods);
|
|
7167
|
+
}
|
|
7135
7168
|
for (const object of this.hitObjects.objects) {
|
|
7136
|
-
if (
|
|
7169
|
+
if (object instanceof Slider) {
|
|
7170
|
+
const { ticks } = object;
|
|
7171
|
+
// Apply slider head.
|
|
7172
|
+
score += 30;
|
|
7173
|
+
++combo;
|
|
7174
|
+
// Apply slider repeats.
|
|
7175
|
+
score += 30 * object.repeatCount;
|
|
7176
|
+
combo += object.repeatCount;
|
|
7177
|
+
// Apply slider ticks.
|
|
7178
|
+
score += 10 * ticks;
|
|
7179
|
+
combo += ticks;
|
|
7180
|
+
// Apply slider end.
|
|
7137
7181
|
score += Math.floor(300 + (300 * combo * difficultyMultiplier) / 25);
|
|
7138
7182
|
++combo;
|
|
7139
|
-
continue;
|
|
7140
7183
|
}
|
|
7141
|
-
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
score += 10 * ticks;
|
|
7150
|
-
combo += ticks;
|
|
7151
|
-
// Apply slider end.
|
|
7184
|
+
else if (object instanceof Spinner) {
|
|
7185
|
+
// For each required rotations, a spinner tick (100 score) is awarded, but does not contribute to combo.
|
|
7186
|
+
const minRps = 2 + (2 * nonRateAdjustedDifficulty.od) / 10;
|
|
7187
|
+
const requiredRotations = Math.trunc((minRps * object.duration) / 1000);
|
|
7188
|
+
for (let i = 0; i < requiredRotations; ++i) {
|
|
7189
|
+
score += 100;
|
|
7190
|
+
}
|
|
7191
|
+
}
|
|
7152
7192
|
score += Math.floor(300 + (300 * combo * difficultyMultiplier) / 25);
|
|
7153
7193
|
++combo;
|
|
7154
7194
|
}
|
|
7155
|
-
return Math.
|
|
7195
|
+
return Math.round(Math.fround(score * scoreMultiplier));
|
|
7156
7196
|
}
|
|
7157
7197
|
/**
|
|
7158
7198
|
* Calculates the osu!standard maximum score of the beatmap without taking spinner bonus into account.
|
|
@@ -7163,7 +7203,7 @@ class Beatmap {
|
|
|
7163
7203
|
const accumulatedDiffPoints = this.difficulty.cs + this.difficulty.hp + this.difficulty.od;
|
|
7164
7204
|
let difficultyMultiplier = 2;
|
|
7165
7205
|
const scoreMultiplier = mods
|
|
7166
|
-
? ModUtil.calculateScoreMultiplier(mods.values(), exports.Modes.osu, this)
|
|
7206
|
+
? ModUtil.calculateScoreMultiplier(mods.values(), exports.Modes.osu, this.difficulty)
|
|
7167
7207
|
: 1;
|
|
7168
7208
|
if (mods === null || mods === void 0 ? void 0 : mods.has(ModScoreV2)) {
|
|
7169
7209
|
return 1e6 * scoreMultiplier;
|
|
@@ -7187,25 +7227,34 @@ class Beatmap {
|
|
|
7187
7227
|
}
|
|
7188
7228
|
let combo = 0;
|
|
7189
7229
|
let score = 0;
|
|
7230
|
+
// Spinners need non-rate adjusted to calculate required spins.
|
|
7231
|
+
const nonRateAdjustedDifficulty = new BeatmapDifficulty(this.difficulty);
|
|
7232
|
+
if (mods) {
|
|
7233
|
+
ModUtil.applyModsToBeatmapDifficulty(nonRateAdjustedDifficulty, exports.Modes.osu, mods);
|
|
7234
|
+
}
|
|
7190
7235
|
for (const object of this.hitObjects.objects) {
|
|
7191
|
-
if (
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
|
|
7236
|
+
if (object instanceof Slider) {
|
|
7237
|
+
const { ticks } = object;
|
|
7238
|
+
// Apply slider head.
|
|
7239
|
+
score += 30;
|
|
7195
7240
|
++combo;
|
|
7196
|
-
|
|
7241
|
+
// Apply slider repeats.
|
|
7242
|
+
score += 30 * object.repeatCount;
|
|
7243
|
+
combo += object.repeatCount;
|
|
7244
|
+
// Apply slider ticks.
|
|
7245
|
+
score += 10 * ticks;
|
|
7246
|
+
combo += ticks;
|
|
7247
|
+
// Apply slider end.
|
|
7248
|
+
score += 30;
|
|
7249
|
+
}
|
|
7250
|
+
else if (object instanceof Spinner) {
|
|
7251
|
+
// For each required rotations, a spinner tick (100 score) is awarded, but does not contribute to combo.
|
|
7252
|
+
const minRps = BeatmapDifficulty.difficultyRange(nonRateAdjustedDifficulty.od, 90, 150, 225);
|
|
7253
|
+
const requiredRotations = Math.trunc((minRps * object.duration) / 1000);
|
|
7254
|
+
for (let i = 0; i < requiredRotations; ++i) {
|
|
7255
|
+
score += 100;
|
|
7256
|
+
}
|
|
7197
7257
|
}
|
|
7198
|
-
const { ticks } = object;
|
|
7199
|
-
// Apply slider head.
|
|
7200
|
-
score += 30;
|
|
7201
|
-
++combo;
|
|
7202
|
-
// Apply slider repeats.
|
|
7203
|
-
score += 30 * object.repeatCount;
|
|
7204
|
-
combo += object.repeatCount;
|
|
7205
|
-
// Apply slider ticks.
|
|
7206
|
-
score += 10 * ticks;
|
|
7207
|
-
combo += ticks;
|
|
7208
|
-
// Apply slider end.
|
|
7209
7258
|
score += Math.floor(300 +
|
|
7210
7259
|
(300 * combo * difficultyMultiplier * scoreMultiplier) / 25);
|
|
7211
7260
|
++combo;
|
|
@@ -7332,16 +7381,6 @@ class Beatmap {
|
|
|
7332
7381
|
}
|
|
7333
7382
|
}
|
|
7334
7383
|
|
|
7335
|
-
/**
|
|
7336
|
-
* Represents a beatmap's background.
|
|
7337
|
-
*/
|
|
7338
|
-
class BeatmapBackground {
|
|
7339
|
-
constructor(filename, offset) {
|
|
7340
|
-
this.filename = filename;
|
|
7341
|
-
this.offset = offset;
|
|
7342
|
-
}
|
|
7343
|
-
}
|
|
7344
|
-
|
|
7345
7384
|
/* eslint-disable @typescript-eslint/prefer-literal-enum-member */
|
|
7346
7385
|
/**
|
|
7347
7386
|
* Represents available hitsound types.
|
|
@@ -7958,6 +7997,16 @@ class BeatmapEditorDecoder extends SectionDecoder {
|
|
|
7958
7997
|
}
|
|
7959
7998
|
}
|
|
7960
7999
|
|
|
8000
|
+
/**
|
|
8001
|
+
* Represents a beatmap's background.
|
|
8002
|
+
*/
|
|
8003
|
+
class BeatmapBackground {
|
|
8004
|
+
constructor(filename, offset) {
|
|
8005
|
+
this.filename = filename;
|
|
8006
|
+
this.offset = offset;
|
|
8007
|
+
}
|
|
8008
|
+
}
|
|
8009
|
+
|
|
7961
8010
|
/**
|
|
7962
8011
|
* Represents a beatmap's video.
|
|
7963
8012
|
*/
|
|
@@ -8052,16 +8101,16 @@ class BeatmapDifficultyDecoder extends SectionDecoder {
|
|
|
8052
8101
|
const p = this.property(line);
|
|
8053
8102
|
switch (p[0]) {
|
|
8054
8103
|
case "CircleSize":
|
|
8055
|
-
this.target.difficulty.cs = this.tryParseFloat(this.setPosition(p[1]));
|
|
8104
|
+
this.target.difficulty.cs = MathUtils.clamp(this.tryParseFloat(this.setPosition(p[1])), 0, 10);
|
|
8056
8105
|
break;
|
|
8057
8106
|
case "OverallDifficulty":
|
|
8058
|
-
this.target.difficulty.od = this.tryParseFloat(this.setPosition(p[1]));
|
|
8107
|
+
this.target.difficulty.od = MathUtils.clamp(this.tryParseFloat(this.setPosition(p[1])), 0, 10);
|
|
8059
8108
|
break;
|
|
8060
8109
|
case "ApproachRate":
|
|
8061
|
-
this.target.difficulty.ar = this.tryParseFloat(this.setPosition(p[1]));
|
|
8110
|
+
this.target.difficulty.ar = MathUtils.clamp(this.tryParseFloat(this.setPosition(p[1])), 0, 10);
|
|
8062
8111
|
break;
|
|
8063
8112
|
case "HPDrainRate":
|
|
8064
|
-
this.target.difficulty.hp = this.tryParseFloat(this.setPosition(p[1]));
|
|
8113
|
+
this.target.difficulty.hp = MathUtils.clamp(this.tryParseFloat(this.setPosition(p[1])), 0, 10);
|
|
8065
8114
|
break;
|
|
8066
8115
|
case "SliderMultiplier":
|
|
8067
8116
|
this.target.difficulty.sliderMultiplier = MathUtils.clamp(this.tryParseFloat(this.setPosition(p[1])), 0.4, 3.6);
|
|
@@ -8892,6 +8941,15 @@ class StoryboardSample extends StoryboardElement {
|
|
|
8892
8941
|
}
|
|
8893
8942
|
}
|
|
8894
8943
|
|
|
8944
|
+
/**
|
|
8945
|
+
* The loop type of storyboard animations.
|
|
8946
|
+
*/
|
|
8947
|
+
exports.AnimationLoopType = void 0;
|
|
8948
|
+
(function (AnimationLoopType) {
|
|
8949
|
+
AnimationLoopType["loopForever"] = "LoopForever";
|
|
8950
|
+
AnimationLoopType["loopOnce"] = "LoopOnce";
|
|
8951
|
+
})(exports.AnimationLoopType || (exports.AnimationLoopType = {}));
|
|
8952
|
+
|
|
8895
8953
|
/**
|
|
8896
8954
|
* Types of storyboard events.
|
|
8897
8955
|
*/
|
|
@@ -10022,47 +10080,82 @@ class BeatmapEncoder extends Encoder {
|
|
|
10022
10080
|
}
|
|
10023
10081
|
|
|
10024
10082
|
/**
|
|
10025
|
-
*
|
|
10083
|
+
* Represents the hit window of osu!standard that does not apply flooring and half-millisecond adjustments.
|
|
10084
|
+
*
|
|
10085
|
+
* **This class is only used for osu!droid difficulty calculation and will be removed later**.
|
|
10026
10086
|
*/
|
|
10027
|
-
|
|
10028
|
-
|
|
10029
|
-
|
|
10030
|
-
|
|
10031
|
-
|
|
10032
|
-
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
|
|
10039
|
-
|
|
10040
|
-
|
|
10041
|
-
|
|
10042
|
-
|
|
10043
|
-
|
|
10087
|
+
class UnadjustedOsuHitWindow extends HitWindow {
|
|
10088
|
+
/**
|
|
10089
|
+
* Calculates the overall difficulty value of a great (300) hit window.
|
|
10090
|
+
*
|
|
10091
|
+
* @param value The value of the hit window, in milliseconds.
|
|
10092
|
+
* @returns The overall difficulty value.
|
|
10093
|
+
*/
|
|
10094
|
+
static greatWindowToOD(value) {
|
|
10095
|
+
return (80 - value) / 6;
|
|
10096
|
+
}
|
|
10097
|
+
/**
|
|
10098
|
+
* Calculates the overall difficulty value of a good (100) hit window.
|
|
10099
|
+
*
|
|
10100
|
+
* @param value The value of the hit window, in milliseconds.
|
|
10101
|
+
* @returns The overall difficulty value.
|
|
10102
|
+
*/
|
|
10103
|
+
static okWindowToOD(value) {
|
|
10104
|
+
return (140 - value) / 8;
|
|
10105
|
+
}
|
|
10106
|
+
/**
|
|
10107
|
+
* Calculates the overall difficulty value of a meh hit window.
|
|
10108
|
+
*
|
|
10109
|
+
* @param value The value of the hit window, in milliseconds.
|
|
10110
|
+
* @returns The overall difficulty value.
|
|
10111
|
+
*/
|
|
10112
|
+
static mehWindowToOD(value) {
|
|
10113
|
+
return (200 - value) / 10;
|
|
10114
|
+
}
|
|
10115
|
+
get greatWindow() {
|
|
10116
|
+
return 80 - 6 * this.overallDifficulty;
|
|
10117
|
+
}
|
|
10118
|
+
get okWindow() {
|
|
10119
|
+
return 140 - 8 * this.overallDifficulty;
|
|
10120
|
+
}
|
|
10121
|
+
get mehWindow() {
|
|
10122
|
+
return 200 - 10 * this.overallDifficulty;
|
|
10123
|
+
}
|
|
10124
|
+
}
|
|
10044
10125
|
|
|
10045
10126
|
/**
|
|
10046
|
-
*
|
|
10127
|
+
* General enum to specify an "anchor" or "origin" point from the standard 9 points on a rectangle.
|
|
10047
10128
|
*/
|
|
10048
|
-
exports.
|
|
10049
|
-
(function (
|
|
10050
|
-
|
|
10051
|
-
|
|
10052
|
-
|
|
10053
|
-
|
|
10054
|
-
|
|
10055
|
-
|
|
10056
|
-
|
|
10057
|
-
|
|
10058
|
-
|
|
10059
|
-
|
|
10060
|
-
|
|
10061
|
-
|
|
10062
|
-
|
|
10063
|
-
|
|
10064
|
-
|
|
10065
|
-
|
|
10129
|
+
exports.Anchor = void 0;
|
|
10130
|
+
(function (Anchor) {
|
|
10131
|
+
Anchor["topLeft"] = "TopLeft";
|
|
10132
|
+
Anchor["center"] = "Centre";
|
|
10133
|
+
Anchor["centerLeft"] = "CentreLeft";
|
|
10134
|
+
Anchor["topRight"] = "TopRight";
|
|
10135
|
+
Anchor["bottomCenter"] = "BottomCentre";
|
|
10136
|
+
Anchor["topCenter"] = "TopCentre";
|
|
10137
|
+
/**
|
|
10138
|
+
* The user is manually updating the outcome, so we shouldn't.
|
|
10139
|
+
*/
|
|
10140
|
+
Anchor["custom"] = "Custom";
|
|
10141
|
+
Anchor["centerRight"] = "CentreRight";
|
|
10142
|
+
Anchor["bottomLeft"] = "BottomLeft";
|
|
10143
|
+
Anchor["bottomRight"] = "BottomRight";
|
|
10144
|
+
})(exports.Anchor || (exports.Anchor = {}));
|
|
10145
|
+
|
|
10146
|
+
/**
|
|
10147
|
+
* Ranking status of a beatmap.
|
|
10148
|
+
*/
|
|
10149
|
+
exports.RankedStatus = void 0;
|
|
10150
|
+
(function (RankedStatus) {
|
|
10151
|
+
RankedStatus[RankedStatus["graveyard"] = -2] = "graveyard";
|
|
10152
|
+
RankedStatus[RankedStatus["wip"] = -1] = "wip";
|
|
10153
|
+
RankedStatus[RankedStatus["pending"] = 0] = "pending";
|
|
10154
|
+
RankedStatus[RankedStatus["ranked"] = 1] = "ranked";
|
|
10155
|
+
RankedStatus[RankedStatus["approved"] = 2] = "approved";
|
|
10156
|
+
RankedStatus[RankedStatus["qualified"] = 3] = "qualified";
|
|
10157
|
+
RankedStatus[RankedStatus["loved"] = 4] = "loved";
|
|
10158
|
+
})(exports.RankedStatus || (exports.RankedStatus = {}));
|
|
10066
10159
|
|
|
10067
10160
|
class Bin {
|
|
10068
10161
|
constructor() {
|
|
@@ -10431,417 +10524,116 @@ class Chandrupatla {
|
|
|
10431
10524
|
}
|
|
10432
10525
|
}
|
|
10433
10526
|
|
|
10434
|
-
/******************************************************************************
|
|
10435
|
-
Copyright (c) Microsoft Corporation.
|
|
10436
|
-
|
|
10437
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
10438
|
-
purpose with or without fee is hereby granted.
|
|
10439
|
-
|
|
10440
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10441
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10442
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10443
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
10444
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
10445
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
10446
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
10447
|
-
***************************************************************************** */
|
|
10448
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
10452
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10453
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10454
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
10455
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10456
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
10457
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10458
|
-
});
|
|
10459
|
-
}
|
|
10460
|
-
|
|
10461
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
10462
|
-
var e = new Error(message);
|
|
10463
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
10464
|
-
};
|
|
10465
|
-
|
|
10466
10527
|
/**
|
|
10467
|
-
*
|
|
10528
|
+
* A single-variable polynomial with real-valued coefficients and non-negative exponents.
|
|
10529
|
+
*
|
|
10530
|
+
* This class shares the same implementation as {@link https://numerics.mathdotnet.com/ Math.NET Numerics}.
|
|
10468
10531
|
*/
|
|
10469
|
-
|
|
10470
|
-
class APIRequestBuilder {
|
|
10471
|
-
constructor() {
|
|
10472
|
-
/**
|
|
10473
|
-
* Whether or not to include the API key in the request URL.
|
|
10474
|
-
*/
|
|
10475
|
-
this.requiresAPIkey = true;
|
|
10476
|
-
/**
|
|
10477
|
-
* The endpoint of this builder.
|
|
10478
|
-
*/
|
|
10479
|
-
this.endpoint = "";
|
|
10480
|
-
/**
|
|
10481
|
-
* The parameters of this builder.
|
|
10482
|
-
*/
|
|
10483
|
-
this.params = new Map();
|
|
10484
|
-
this.fetchAttempts = 0;
|
|
10485
|
-
}
|
|
10486
|
-
/**
|
|
10487
|
-
* The base URL of this builder.
|
|
10488
|
-
*/
|
|
10489
|
-
get baseURL() {
|
|
10490
|
-
return this.host + this.endpoint;
|
|
10491
|
-
}
|
|
10532
|
+
class Polynomial {
|
|
10492
10533
|
/**
|
|
10493
|
-
*
|
|
10534
|
+
* Evaluates a polynomial at point `z`.
|
|
10494
10535
|
*
|
|
10495
|
-
*
|
|
10496
|
-
|
|
10497
|
-
setEndpoint(endpoint) {
|
|
10498
|
-
this.endpoint = endpoint;
|
|
10499
|
-
return this;
|
|
10500
|
-
}
|
|
10501
|
-
/**
|
|
10502
|
-
* Sets if this builder includes the API key in the request URL.
|
|
10536
|
+
* Coefficients are ordered ascending by power with power `k` at index `k`.
|
|
10537
|
+
* For example, coefficients `[3, -1, 2]` represent `y = 2x^2 - x + 3`.
|
|
10503
10538
|
*
|
|
10504
|
-
* @param
|
|
10505
|
-
|
|
10506
|
-
|
|
10507
|
-
this.requiresAPIkey = requireAPIkey;
|
|
10508
|
-
return this;
|
|
10509
|
-
}
|
|
10510
|
-
/**
|
|
10511
|
-
* Builds the URL to request the API.
|
|
10539
|
+
* @param z The location where to evaluate the polynomial at.
|
|
10540
|
+
* @param coefficients The coefficients of the polynomial, coefficient for power `k` at index `k`.
|
|
10541
|
+
* @returns The polynomial at `z`.
|
|
10512
10542
|
*/
|
|
10513
|
-
|
|
10514
|
-
|
|
10515
|
-
|
|
10516
|
-
|
|
10517
|
-
|
|
10518
|
-
}
|
|
10519
|
-
url += this.APIkeyParam;
|
|
10543
|
+
static evaluate(z, coefficients) {
|
|
10544
|
+
// Zero polynomials need explicit handling, otherwise we
|
|
10545
|
+
// will attempt to peek coefficients at negative indices.
|
|
10546
|
+
if (coefficients.length === 0) {
|
|
10547
|
+
return 0;
|
|
10520
10548
|
}
|
|
10521
|
-
|
|
10522
|
-
|
|
10549
|
+
let sum = coefficients.at(-1);
|
|
10550
|
+
for (let i = coefficients.length - 2; i >= 0; --i) {
|
|
10551
|
+
sum *= z;
|
|
10552
|
+
sum += coefficients[i];
|
|
10523
10553
|
}
|
|
10524
|
-
return
|
|
10525
|
-
}
|
|
10526
|
-
/**
|
|
10527
|
-
* Sends a request to the API using built parameters.
|
|
10528
|
-
*
|
|
10529
|
-
* If the request fails, it will be redone 5 times.
|
|
10530
|
-
*/
|
|
10531
|
-
sendRequest() {
|
|
10532
|
-
return new Promise((resolve) => {
|
|
10533
|
-
const url = this.buildURL();
|
|
10534
|
-
fetch(url)
|
|
10535
|
-
.then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
10536
|
-
++this.fetchAttempts;
|
|
10537
|
-
if (res.status >= 500 && this.fetchAttempts < 5) {
|
|
10538
|
-
console.error(`Request to ${url} failed with the following error: ${yield res.text()}; ${this.fetchAttempts.toString()} attempts so far; retrying`);
|
|
10539
|
-
resolve(this.sendRequest());
|
|
10540
|
-
return;
|
|
10541
|
-
}
|
|
10542
|
-
this.fetchAttempts = 0;
|
|
10543
|
-
resolve({
|
|
10544
|
-
data: Buffer.from(yield res.arrayBuffer()),
|
|
10545
|
-
statusCode: res.status,
|
|
10546
|
-
});
|
|
10547
|
-
}))
|
|
10548
|
-
.catch((e) => {
|
|
10549
|
-
console.error(`Request to ${url} failed with the following error: ${e.message}; ${this.fetchAttempts.toString()} attempts so far; aborting`);
|
|
10550
|
-
this.fetchAttempts = 0;
|
|
10551
|
-
resolve({
|
|
10552
|
-
data: Buffer.from([]),
|
|
10553
|
-
statusCode: 400,
|
|
10554
|
-
});
|
|
10555
|
-
return;
|
|
10556
|
-
});
|
|
10557
|
-
});
|
|
10558
|
-
}
|
|
10559
|
-
/**
|
|
10560
|
-
* Adds a parameter to the builder.
|
|
10561
|
-
*
|
|
10562
|
-
* @param param The parameter to add.
|
|
10563
|
-
* @param value The value to add for the parameter.
|
|
10564
|
-
*/
|
|
10565
|
-
addParameter(param, value) {
|
|
10566
|
-
this.params.set(param, value.toString());
|
|
10567
|
-
return this;
|
|
10568
|
-
}
|
|
10569
|
-
/**
|
|
10570
|
-
* Removes a parameter from the builder.
|
|
10571
|
-
*
|
|
10572
|
-
* @param param The parameter to remove.
|
|
10573
|
-
*/
|
|
10574
|
-
removeParameter(param) {
|
|
10575
|
-
this.params.delete(param);
|
|
10576
|
-
return this;
|
|
10577
|
-
}
|
|
10578
|
-
}
|
|
10579
|
-
|
|
10580
|
-
/**
|
|
10581
|
-
* An API request builder for osu!droid.
|
|
10582
|
-
*/
|
|
10583
|
-
class DroidAPIRequestBuilder extends APIRequestBuilder {
|
|
10584
|
-
constructor() {
|
|
10585
|
-
super(...arguments);
|
|
10586
|
-
this.host = "https://osudroid.moe/api/";
|
|
10587
|
-
this.APIkey = DroidAPIRequestBuilder.apiKey;
|
|
10588
|
-
this.APIkeyParam = `apiKey=${this.APIkey}&`;
|
|
10554
|
+
return sum;
|
|
10589
10555
|
}
|
|
10590
10556
|
/**
|
|
10591
|
-
*
|
|
10557
|
+
* Solve for the exact real roots of any polynomial up to degree 4.
|
|
10592
10558
|
*
|
|
10593
|
-
* @param
|
|
10559
|
+
* @param coefficients The coefficients of the polynomial, in ascending order ([1, 3, 5] -> x^2 + 3x + 5).
|
|
10560
|
+
* @returns The real roots of the polynomial, and `null` if the root does not exist.
|
|
10594
10561
|
*/
|
|
10595
|
-
static
|
|
10596
|
-
|
|
10597
|
-
|
|
10598
|
-
|
|
10599
|
-
|
|
10600
|
-
|
|
10601
|
-
case
|
|
10602
|
-
|
|
10603
|
-
|
|
10604
|
-
|
|
10605
|
-
|
|
10606
|
-
|
|
10607
|
-
|
|
10608
|
-
|
|
10609
|
-
|
|
10562
|
+
static solve(coefficients) {
|
|
10563
|
+
let xVals = [];
|
|
10564
|
+
switch (coefficients.length) {
|
|
10565
|
+
case 5:
|
|
10566
|
+
xVals = this.solveP4(coefficients[0], coefficients[1], coefficients[2], coefficients[3], coefficients[4]).roots;
|
|
10567
|
+
break;
|
|
10568
|
+
case 4:
|
|
10569
|
+
xVals = this.solveP3(coefficients[0], coefficients[1], coefficients[2], coefficients[3]).roots;
|
|
10570
|
+
break;
|
|
10571
|
+
case 3:
|
|
10572
|
+
xVals = this.solveP2(coefficients[0], coefficients[1], coefficients[2]).roots;
|
|
10573
|
+
break;
|
|
10574
|
+
case 2:
|
|
10575
|
+
xVals = this.solveP2(0, coefficients[0], coefficients[1]).roots;
|
|
10576
|
+
break;
|
|
10610
10577
|
}
|
|
10578
|
+
return xVals;
|
|
10611
10579
|
}
|
|
10612
|
-
|
|
10613
|
-
|
|
10614
|
-
|
|
10615
|
-
|
|
10616
|
-
|
|
10617
|
-
|
|
10618
|
-
|
|
10619
|
-
|
|
10620
|
-
|
|
10621
|
-
|
|
10622
|
-
|
|
10623
|
-
|
|
10624
|
-
|
|
10625
|
-
|
|
10626
|
-
static convert(str, difficulty) {
|
|
10627
|
-
const map = new ModMap();
|
|
10628
|
-
if (!str) {
|
|
10629
|
-
return map;
|
|
10580
|
+
// https://github.com/sasamil/Quartic/blob/master/quartic.cpp
|
|
10581
|
+
static solveP4(a, b, c, d, e) {
|
|
10582
|
+
const result = {
|
|
10583
|
+
count: 0,
|
|
10584
|
+
roots: new Array(4),
|
|
10585
|
+
};
|
|
10586
|
+
if (a === 0) {
|
|
10587
|
+
const xValsCubic = this.solveP3(b, c, d, e);
|
|
10588
|
+
result.count = xValsCubic.count;
|
|
10589
|
+
result.roots[0] = xValsCubic.roots[0];
|
|
10590
|
+
result.roots[1] = xValsCubic.roots[1];
|
|
10591
|
+
result.roots[2] = xValsCubic.roots[2];
|
|
10592
|
+
result.roots[3] = null;
|
|
10593
|
+
return result;
|
|
10630
10594
|
}
|
|
10631
|
-
|
|
10632
|
-
|
|
10633
|
-
|
|
10634
|
-
|
|
10635
|
-
|
|
10595
|
+
b /= a;
|
|
10596
|
+
c /= a;
|
|
10597
|
+
d /= a;
|
|
10598
|
+
e /= a;
|
|
10599
|
+
const a3 = -c;
|
|
10600
|
+
const b3 = b * d - 4 * e;
|
|
10601
|
+
const c3 = -b * b * e - d * d + 4 * c * e;
|
|
10602
|
+
const x3 = this.solveP3(1, a3, b3, c3);
|
|
10603
|
+
let q1;
|
|
10604
|
+
let q2;
|
|
10605
|
+
let p1;
|
|
10606
|
+
let p2;
|
|
10607
|
+
let sqD;
|
|
10608
|
+
let y = x3.roots[0];
|
|
10609
|
+
// Get the y value with the highest absolute value.
|
|
10610
|
+
if (x3.count !== 1) {
|
|
10611
|
+
if (Math.abs(x3.roots[1]) > Math.abs(y)) {
|
|
10612
|
+
y = x3.roots[1];
|
|
10636
10613
|
}
|
|
10637
|
-
|
|
10638
|
-
|
|
10639
|
-
|
|
10614
|
+
if (Math.abs(x3.roots[2]) > Math.abs(y)) {
|
|
10615
|
+
y = x3.roots[2];
|
|
10616
|
+
}
|
|
10617
|
+
}
|
|
10618
|
+
let upperD = y * y - 4 * e;
|
|
10619
|
+
if (Precision.almostEquals(upperD, 0)) {
|
|
10620
|
+
q1 = q2 = y * 0.5;
|
|
10621
|
+
upperD = b * b - 4 * (c - y);
|
|
10622
|
+
if (Precision.almostEquals(upperD, 0)) {
|
|
10623
|
+
p1 = p2 = b * 0.5;
|
|
10640
10624
|
}
|
|
10641
10625
|
else {
|
|
10642
|
-
|
|
10626
|
+
sqD = Math.sqrt(upperD);
|
|
10627
|
+
p1 = (b + sqD) * 0.5;
|
|
10628
|
+
p2 = (b - sqD) * 0.5;
|
|
10643
10629
|
}
|
|
10644
10630
|
}
|
|
10645
|
-
|
|
10646
|
-
|
|
10647
|
-
|
|
10648
|
-
|
|
10649
|
-
|
|
10650
|
-
|
|
10651
|
-
* Parses the extra strings of a mod string.
|
|
10652
|
-
*
|
|
10653
|
-
* @param map The current `Mod`s.
|
|
10654
|
-
* @param extraStrings The extra strings to parse.
|
|
10655
|
-
*/
|
|
10656
|
-
static parseExtraModString(map, extraStrings) {
|
|
10657
|
-
let customCS;
|
|
10658
|
-
let customAR;
|
|
10659
|
-
let customOD;
|
|
10660
|
-
let customHP;
|
|
10661
|
-
for (const s of extraStrings) {
|
|
10662
|
-
switch (true) {
|
|
10663
|
-
// Forced stats
|
|
10664
|
-
case s.startsWith("CS"):
|
|
10665
|
-
customCS = parseFloat(s.slice(2));
|
|
10666
|
-
break;
|
|
10667
|
-
case s.startsWith("AR"):
|
|
10668
|
-
customAR = parseFloat(s.slice(2));
|
|
10669
|
-
break;
|
|
10670
|
-
case s.startsWith("OD"):
|
|
10671
|
-
customOD = parseFloat(s.slice(2));
|
|
10672
|
-
break;
|
|
10673
|
-
case s.startsWith("HP"):
|
|
10674
|
-
customHP = parseFloat(s.slice(2));
|
|
10675
|
-
break;
|
|
10676
|
-
// FL follow delay
|
|
10677
|
-
case s.startsWith("FLD"): {
|
|
10678
|
-
let flashlight = map.get(ModFlashlight);
|
|
10679
|
-
if (!flashlight) {
|
|
10680
|
-
flashlight = new ModFlashlight();
|
|
10681
|
-
map.set(flashlight);
|
|
10682
|
-
}
|
|
10683
|
-
flashlight.followDelay.value = parseFloat(s.slice(3));
|
|
10684
|
-
break;
|
|
10685
|
-
}
|
|
10686
|
-
// Speed multiplier
|
|
10687
|
-
case s.startsWith("x"): {
|
|
10688
|
-
let customSpeed = map.get(ModCustomSpeed);
|
|
10689
|
-
if (!customSpeed) {
|
|
10690
|
-
customSpeed = new ModCustomSpeed();
|
|
10691
|
-
map.set(customSpeed);
|
|
10692
|
-
}
|
|
10693
|
-
customSpeed.trackRateMultiplier.value = parseFloat(s.slice(1));
|
|
10694
|
-
break;
|
|
10695
|
-
}
|
|
10696
|
-
}
|
|
10697
|
-
}
|
|
10698
|
-
if (customCS !== undefined ||
|
|
10699
|
-
customAR !== undefined ||
|
|
10700
|
-
customOD !== undefined ||
|
|
10701
|
-
customHP !== undefined) {
|
|
10702
|
-
map.set(new ModDifficultyAdjust({
|
|
10703
|
-
cs: customCS,
|
|
10704
|
-
ar: customAR,
|
|
10705
|
-
od: customOD,
|
|
10706
|
-
hp: customHP,
|
|
10707
|
-
}));
|
|
10708
|
-
}
|
|
10709
|
-
}
|
|
10710
|
-
}
|
|
10711
|
-
/**
|
|
10712
|
-
* All `Mod`s that can be stored in the legacy mods format by their respective encode character.
|
|
10713
|
-
*/
|
|
10714
|
-
DroidLegacyModConverter.legacyStorableMods = new Map([
|
|
10715
|
-
["a", ModAuto],
|
|
10716
|
-
["b", ModTraceable],
|
|
10717
|
-
["c", ModNightCore],
|
|
10718
|
-
["d", ModDoubleTime],
|
|
10719
|
-
["e", ModEasy],
|
|
10720
|
-
["f", ModPerfect],
|
|
10721
|
-
["h", ModHidden],
|
|
10722
|
-
["i", ModFlashlight],
|
|
10723
|
-
["l", ModReallyEasy],
|
|
10724
|
-
["m", ModSmallCircle],
|
|
10725
|
-
["n", ModNoFail],
|
|
10726
|
-
["p", ModAutopilot],
|
|
10727
|
-
["r", ModHardRock],
|
|
10728
|
-
["s", ModPrecise],
|
|
10729
|
-
["t", ModHalfTime],
|
|
10730
|
-
["u", ModSuddenDeath],
|
|
10731
|
-
["v", ModScoreV2],
|
|
10732
|
-
["x", ModRelax],
|
|
10733
|
-
]);
|
|
10734
|
-
|
|
10735
|
-
/**
|
|
10736
|
-
* A single-variable polynomial with real-valued coefficients and non-negative exponents.
|
|
10737
|
-
*
|
|
10738
|
-
* This class shares the same implementation as {@link https://numerics.mathdotnet.com/ Math.NET Numerics}.
|
|
10739
|
-
*/
|
|
10740
|
-
class Polynomial {
|
|
10741
|
-
/**
|
|
10742
|
-
* Evaluates a polynomial at point `z`.
|
|
10743
|
-
*
|
|
10744
|
-
* Coefficients are ordered ascending by power with power `k` at index `k`.
|
|
10745
|
-
* For example, coefficients `[3, -1, 2]` represent `y = 2x^2 - x + 3`.
|
|
10746
|
-
*
|
|
10747
|
-
* @param z The location where to evaluate the polynomial at.
|
|
10748
|
-
* @param coefficients The coefficients of the polynomial, coefficient for power `k` at index `k`.
|
|
10749
|
-
* @returns The polynomial at `z`.
|
|
10750
|
-
*/
|
|
10751
|
-
static evaluate(z, coefficients) {
|
|
10752
|
-
// Zero polynomials need explicit handling, otherwise we
|
|
10753
|
-
// will attempt to peek coefficients at negative indices.
|
|
10754
|
-
if (coefficients.length === 0) {
|
|
10755
|
-
return 0;
|
|
10756
|
-
}
|
|
10757
|
-
let sum = coefficients.at(-1);
|
|
10758
|
-
for (let i = coefficients.length - 2; i >= 0; --i) {
|
|
10759
|
-
sum *= z;
|
|
10760
|
-
sum += coefficients[i];
|
|
10761
|
-
}
|
|
10762
|
-
return sum;
|
|
10763
|
-
}
|
|
10764
|
-
/**
|
|
10765
|
-
* Solve for the exact real roots of any polynomial up to degree 4.
|
|
10766
|
-
*
|
|
10767
|
-
* @param coefficients The coefficients of the polynomial, in ascending order ([1, 3, 5] -> x^2 + 3x + 5).
|
|
10768
|
-
* @returns The real roots of the polynomial, and `null` if the root does not exist.
|
|
10769
|
-
*/
|
|
10770
|
-
static solve(coefficients) {
|
|
10771
|
-
let xVals = [];
|
|
10772
|
-
switch (coefficients.length) {
|
|
10773
|
-
case 5:
|
|
10774
|
-
xVals = this.solveP4(coefficients[0], coefficients[1], coefficients[2], coefficients[3], coefficients[4]).roots;
|
|
10775
|
-
break;
|
|
10776
|
-
case 4:
|
|
10777
|
-
xVals = this.solveP3(coefficients[0], coefficients[1], coefficients[2], coefficients[3]).roots;
|
|
10778
|
-
break;
|
|
10779
|
-
case 3:
|
|
10780
|
-
xVals = this.solveP2(coefficients[0], coefficients[1], coefficients[2]).roots;
|
|
10781
|
-
break;
|
|
10782
|
-
case 2:
|
|
10783
|
-
xVals = this.solveP2(0, coefficients[0], coefficients[1]).roots;
|
|
10784
|
-
break;
|
|
10785
|
-
}
|
|
10786
|
-
return xVals;
|
|
10787
|
-
}
|
|
10788
|
-
// https://github.com/sasamil/Quartic/blob/master/quartic.cpp
|
|
10789
|
-
static solveP4(a, b, c, d, e) {
|
|
10790
|
-
const result = {
|
|
10791
|
-
count: 0,
|
|
10792
|
-
roots: new Array(4),
|
|
10793
|
-
};
|
|
10794
|
-
if (a === 0) {
|
|
10795
|
-
const xValsCubic = this.solveP3(b, c, d, e);
|
|
10796
|
-
result.count = xValsCubic.count;
|
|
10797
|
-
result.roots[0] = xValsCubic.roots[0];
|
|
10798
|
-
result.roots[1] = xValsCubic.roots[1];
|
|
10799
|
-
result.roots[2] = xValsCubic.roots[2];
|
|
10800
|
-
result.roots[3] = null;
|
|
10801
|
-
return result;
|
|
10802
|
-
}
|
|
10803
|
-
b /= a;
|
|
10804
|
-
c /= a;
|
|
10805
|
-
d /= a;
|
|
10806
|
-
e /= a;
|
|
10807
|
-
const a3 = -c;
|
|
10808
|
-
const b3 = b * d - 4 * e;
|
|
10809
|
-
const c3 = -b * b * e - d * d + 4 * c * e;
|
|
10810
|
-
const x3 = this.solveP3(1, a3, b3, c3);
|
|
10811
|
-
let q1;
|
|
10812
|
-
let q2;
|
|
10813
|
-
let p1;
|
|
10814
|
-
let p2;
|
|
10815
|
-
let sqD;
|
|
10816
|
-
let y = x3.roots[0];
|
|
10817
|
-
// Get the y value with the highest absolute value.
|
|
10818
|
-
if (x3.count !== 1) {
|
|
10819
|
-
if (Math.abs(x3.roots[1]) > Math.abs(y)) {
|
|
10820
|
-
y = x3.roots[1];
|
|
10821
|
-
}
|
|
10822
|
-
if (Math.abs(x3.roots[2]) > Math.abs(y)) {
|
|
10823
|
-
y = x3.roots[2];
|
|
10824
|
-
}
|
|
10825
|
-
}
|
|
10826
|
-
let upperD = y * y - 4 * e;
|
|
10827
|
-
if (Precision.almostEquals(upperD, 0)) {
|
|
10828
|
-
q1 = q2 = y * 0.5;
|
|
10829
|
-
upperD = b * b - 4 * (c - y);
|
|
10830
|
-
if (Precision.almostEquals(upperD, 0)) {
|
|
10831
|
-
p1 = p2 = b * 0.5;
|
|
10832
|
-
}
|
|
10833
|
-
else {
|
|
10834
|
-
sqD = Math.sqrt(upperD);
|
|
10835
|
-
p1 = (b + sqD) * 0.5;
|
|
10836
|
-
p2 = (b - sqD) * 0.5;
|
|
10837
|
-
}
|
|
10838
|
-
}
|
|
10839
|
-
else {
|
|
10840
|
-
sqD = Math.sqrt(upperD);
|
|
10841
|
-
q1 = (y + sqD) * 0.5;
|
|
10842
|
-
q2 = (y - sqD) * 0.5;
|
|
10843
|
-
p1 = (b * q1 - d) / (q1 - q2);
|
|
10844
|
-
p2 = (d - b * q2) / (q1 - q2);
|
|
10631
|
+
else {
|
|
10632
|
+
sqD = Math.sqrt(upperD);
|
|
10633
|
+
q1 = (y + sqD) * 0.5;
|
|
10634
|
+
q2 = (y - sqD) * 0.5;
|
|
10635
|
+
p1 = (b * q1 - d) / (q1 - q2);
|
|
10636
|
+
p2 = (d - b * q2) / (q1 - q2);
|
|
10845
10637
|
}
|
|
10846
10638
|
// Solving quadratic eq. - x^2 + p1*x + q1 = 0.
|
|
10847
10639
|
upperD = p1 * p1 - 4 * q1;
|
|
@@ -11677,167 +11469,594 @@ ErrorFunction.ervInvImpFn = [
|
|
|
11677
11469
|
* Polynomial coefficients for a denominator of erfInvImp
|
|
11678
11470
|
* calculation for erf^-1(z) in the interval [0.75, 1] with x between 18 and 44.
|
|
11679
11471
|
*/
|
|
11680
|
-
ErrorFunction.ervInvImpFd = [
|
|
11681
|
-
1, 0.20712311221442251, 0.01694108381209759, 0.0006905382656226846,
|
|
11682
|
-
0.14500735981823264e-4, 0.14443775662814415e-6, 0.5097612765997785e-9,
|
|
11683
|
-
];
|
|
11472
|
+
ErrorFunction.ervInvImpFd = [
|
|
11473
|
+
1, 0.20712311221442251, 0.01694108381209759, 0.0006905382656226846,
|
|
11474
|
+
0.14500735981823264e-4, 0.14443775662814415e-6, 0.5097612765997785e-9,
|
|
11475
|
+
];
|
|
11476
|
+
/**
|
|
11477
|
+
* Polynomial coefficients for a numerator of erfInvImp
|
|
11478
|
+
* calculation for erf^-1(z) in the interval [0.75, 1] with x greater than 44.
|
|
11479
|
+
*/
|
|
11480
|
+
ErrorFunction.ervInvImpGn = [
|
|
11481
|
+
-5390429110190786e-19, -2.839875900472772e-7, 0.8994651148922914e-6,
|
|
11482
|
+
0.2293458592659209e-7, 0.2255614448635001e-9, 0.9478466275030226e-12,
|
|
11483
|
+
0.13588013010892486e-14, -3488903933999489e-37,
|
|
11484
|
+
];
|
|
11485
|
+
/**
|
|
11486
|
+
* Polynomial coefficients for a denominator of erfInvImp
|
|
11487
|
+
* calculation for erf^-1(z) in the interval [0.75, 1] with x greater than 44.
|
|
11488
|
+
*/
|
|
11489
|
+
ErrorFunction.ervInvImpGd = [
|
|
11490
|
+
1, 0.08457462340018994, 0.002820929847262647, 0.4682929219408942e-4,
|
|
11491
|
+
0.3999688121938621e-6, 0.1618092908879045e-8, 0.2315586083102596e-11,
|
|
11492
|
+
];
|
|
11493
|
+
|
|
11494
|
+
/**
|
|
11495
|
+
* Continuous Univariate Normal distribution, also known as Gaussian distribution.
|
|
11496
|
+
*
|
|
11497
|
+
* For details about this distribution, see {@link http://en.wikipedia.org/wiki/Normal_distribution Wikipedia - Normal distribution}.
|
|
11498
|
+
*
|
|
11499
|
+
* This class shares the same implementation as {@link https://numerics.mathdotnet.com/ Math.NET Numerics}.
|
|
11500
|
+
*/
|
|
11501
|
+
class NormalDistribution {
|
|
11502
|
+
/**
|
|
11503
|
+
* Computes the cumulative distribution function (CDF) of the distribution at x, i.e. P(X ≤ x).
|
|
11504
|
+
*
|
|
11505
|
+
* @param mean The mean (μ) of the normal distribution.
|
|
11506
|
+
* @param stdDev The standard deviation (σ) of the normal distribution. Range: σ ≥ 0.
|
|
11507
|
+
* @param x The location at which to compute the cumulative distribution function.
|
|
11508
|
+
* @returns The cumulative distribution at {@link x}.
|
|
11509
|
+
*/
|
|
11510
|
+
static cdf(mean, stdDev, x) {
|
|
11511
|
+
if (stdDev < 0) {
|
|
11512
|
+
throw new RangeError("Invalid parametrization for the distribution.");
|
|
11513
|
+
}
|
|
11514
|
+
if (mean === x && stdDev === 0) {
|
|
11515
|
+
return 0;
|
|
11516
|
+
}
|
|
11517
|
+
return 0.5 * ErrorFunction.erfc((mean - x) / (stdDev * Math.SQRT2));
|
|
11518
|
+
}
|
|
11519
|
+
/**
|
|
11520
|
+
* Computes the probability density of the distribution (PDF) at x, i.e. ∂P(X ≤ x)/∂x.
|
|
11521
|
+
*
|
|
11522
|
+
* In MATLAB, this is known as `normpdf`.
|
|
11523
|
+
*
|
|
11524
|
+
* @param mean The mean (μ) of the normal distribution.
|
|
11525
|
+
* @param stdDev The standard deviation (σ) of the normal distribution. Range: σ ≥ 0.
|
|
11526
|
+
* @param x The location at which to compute the density.
|
|
11527
|
+
* @returns The density at {@link x}.
|
|
11528
|
+
*/
|
|
11529
|
+
static pdf(mean, stdDev, x) {
|
|
11530
|
+
if (stdDev < 0) {
|
|
11531
|
+
throw new RangeError("Invalid parametrization for the distribution.");
|
|
11532
|
+
}
|
|
11533
|
+
const d = (x - mean) / stdDev;
|
|
11534
|
+
return Math.exp(-0.5 * d * d) / (stdDev * Math.sqrt(2 * Math.PI));
|
|
11535
|
+
}
|
|
11536
|
+
/**
|
|
11537
|
+
* Computes the inverse of the cumulative distribution function (InvCDF) for the distribution
|
|
11538
|
+
* at the given probability. This is also known as the quantile or percent point function.
|
|
11539
|
+
*
|
|
11540
|
+
* @param mean The mean (μ) of the normal distribution.
|
|
11541
|
+
* @param stdDev The standard deviation (σ) of the normal distribution. Range: σ ≥ 0.
|
|
11542
|
+
* @param p The location at which to compute the inverse cumulative density.
|
|
11543
|
+
* @returns The inverse cumulative density at `p`.
|
|
11544
|
+
*/
|
|
11545
|
+
static invCDF(mean, stdDev, p) {
|
|
11546
|
+
if (stdDev < 0) {
|
|
11547
|
+
throw new RangeError("Invalid parametrization for the distribution.");
|
|
11548
|
+
}
|
|
11549
|
+
return mean - stdDev * Math.SQRT2 * ErrorFunction.erfcInv(2 * p);
|
|
11550
|
+
}
|
|
11551
|
+
}
|
|
11552
|
+
|
|
11553
|
+
/**
|
|
11554
|
+
* Approximation of the {@link https://en.wikipedia.org/wiki/Poisson_binomial_distribution Poisson binomial distribution}, which can be
|
|
11555
|
+
* updated iteratively.
|
|
11556
|
+
*
|
|
11557
|
+
* For the approximation method, see "Refined Normal Approximation (RNA)" from:
|
|
11558
|
+
*
|
|
11559
|
+
* {@link https://www.researchgate.net/publication/257017356_On_computing_the_distribution_function_for_the_Poisson_binomial_distribution Hong, Y. (2013). On computing the distribution function for the Poisson binomial distribution. Computational Statistics and Data Analysis, Vol. 59, pp. 41-51}.
|
|
11560
|
+
*
|
|
11561
|
+
* This has been verified against a reference implementation provided by the authors in the R package "poibin",
|
|
11562
|
+
* which can be viewed {@link https://rdrr.io/cran/poibin/man/poibin-package.html here}.
|
|
11563
|
+
*/
|
|
11564
|
+
class IterativePoissonBinomial {
|
|
11565
|
+
constructor() {
|
|
11566
|
+
this.mu = 0;
|
|
11567
|
+
this.var = 0;
|
|
11568
|
+
this.gamma = 0;
|
|
11569
|
+
}
|
|
11570
|
+
/**
|
|
11571
|
+
* Adds a new trial with the provided probability of success to the distribution.
|
|
11572
|
+
*
|
|
11573
|
+
* @param p The probability of success for the new trial.
|
|
11574
|
+
*/
|
|
11575
|
+
addProbability(p) {
|
|
11576
|
+
this.mu += p;
|
|
11577
|
+
this.var += p * (1 - p);
|
|
11578
|
+
this.gamma += p * (1 - p) * (1 - 2 * p);
|
|
11579
|
+
}
|
|
11580
|
+
/**
|
|
11581
|
+
* Adds multiple trials with the same probability of success to the distribution.
|
|
11582
|
+
*
|
|
11583
|
+
* @param p The probability of success for the new trials.
|
|
11584
|
+
* @param count The number of trials to add.
|
|
11585
|
+
*/
|
|
11586
|
+
addBinnedProbabilities(p, count) {
|
|
11587
|
+
this.mu += p * count;
|
|
11588
|
+
this.var += p * (1 - p) * count;
|
|
11589
|
+
this.gamma += p * (1 - p) * (1 - 2 * p) * count;
|
|
11590
|
+
}
|
|
11591
|
+
/**
|
|
11592
|
+
* Computes the value of the cumulative distribution function for this distribution.
|
|
11593
|
+
*
|
|
11594
|
+
* @param count The argument of the CDF to sample the distribution for. In the discrete case (when it is a whole number),
|
|
11595
|
+
* this corresponds to the number of successful Bernoulli trials to query the CDF for.
|
|
11596
|
+
* @returns The value of CDF at {@link count}. In the discrete case, this corresponds to the probability that at most
|
|
11597
|
+
* {@link count} Bernoulli trials ended in a success.
|
|
11598
|
+
*/
|
|
11599
|
+
cdf(count) {
|
|
11600
|
+
if (this.var === 0) {
|
|
11601
|
+
return this.mu <= count ? 1 : 0;
|
|
11602
|
+
}
|
|
11603
|
+
const sigma = Math.sqrt(this.var);
|
|
11604
|
+
const v = this.gamma / (6 * Math.pow(sigma, 3));
|
|
11605
|
+
const k = (count + 0.5 - this.mu) / sigma;
|
|
11606
|
+
const result = NormalDistribution.cdf(0, 1, k) +
|
|
11607
|
+
v * (1 - k * k) * NormalDistribution.pdf(0, 1, k);
|
|
11608
|
+
return MathUtils.clamp(result, 0, 1);
|
|
11609
|
+
}
|
|
11610
|
+
/**
|
|
11611
|
+
* Resets the distribution to an empty state.
|
|
11612
|
+
*/
|
|
11613
|
+
reset() {
|
|
11614
|
+
this.mu = 0;
|
|
11615
|
+
this.var = 0;
|
|
11616
|
+
this.gamma = 0;
|
|
11617
|
+
}
|
|
11618
|
+
}
|
|
11619
|
+
|
|
11620
|
+
/**
|
|
11621
|
+
* Approximation of the {@link https://en.wikipedia.org/wiki/Poisson_binomial_distribution Poisson binomial distribution}.
|
|
11622
|
+
*
|
|
11623
|
+
* For the approximation method, see "Refined Normal Approximation (RNA)" from:
|
|
11624
|
+
*
|
|
11625
|
+
* {@link https://www.researchgate.net/publication/257017356_On_computing_the_distribution_function_for_the_Poisson_binomial_distribution Hong, Y. (2013). On computing the distribution function for the Poisson binomial distribution. Computational Statistics and Data Analysis, Vol. 59, pp. 41-51}.
|
|
11626
|
+
*
|
|
11627
|
+
* This has been verified against a reference implementation provided by the authors in the R package "poibin",
|
|
11628
|
+
* which can be viewed {@link https://rdrr.io/cran/poibin/man/poibin-package.html here}.
|
|
11629
|
+
*/
|
|
11630
|
+
class PoissonBinomial {
|
|
11631
|
+
/**
|
|
11632
|
+
* Creates a new Poisson binomial distribution based on N trials with the provided list or bins of
|
|
11633
|
+
* difficulties, skill, and method for getting the miss probabilities.
|
|
11634
|
+
*
|
|
11635
|
+
* @param difficulties The list or bins of difficulties.
|
|
11636
|
+
* @param skill The skill level to get the miss probabilities with.
|
|
11637
|
+
* @param hitProbability The method for converting difficulties and skill into miss probabilities.
|
|
11638
|
+
*/
|
|
11639
|
+
constructor(difficulties, skill, hitProbability) {
|
|
11640
|
+
this.mu = 0;
|
|
11641
|
+
let variance = 0;
|
|
11642
|
+
let gamma = 0;
|
|
11643
|
+
for (const d of difficulties) {
|
|
11644
|
+
if (d instanceof Bin) {
|
|
11645
|
+
const p = 1 - hitProbability(skill, d.difficulty);
|
|
11646
|
+
this.mu += p * d.noteCount;
|
|
11647
|
+
variance += p * (1 - p) * d.noteCount;
|
|
11648
|
+
gamma += p * (1 - p) * (1 - 2 * p) * d.noteCount;
|
|
11649
|
+
}
|
|
11650
|
+
else {
|
|
11651
|
+
const p = 1 - hitProbability(skill, d);
|
|
11652
|
+
this.mu += p;
|
|
11653
|
+
variance += p * (1 - p);
|
|
11654
|
+
gamma += p * (1 - p) * (1 - 2 * p);
|
|
11655
|
+
}
|
|
11656
|
+
}
|
|
11657
|
+
this.sigma = Math.sqrt(variance);
|
|
11658
|
+
this.v = gamma / (6 * Math.pow(this.sigma, 3));
|
|
11659
|
+
}
|
|
11660
|
+
/**
|
|
11661
|
+
* Computes the value of the cumulative distribution function for this distribution.
|
|
11662
|
+
*
|
|
11663
|
+
* @param count The argument of the CDF to sample the distribution for. In the discrete case (when it is a whole number),
|
|
11664
|
+
* this corresponds to the number of successful Bernoulli trials to query the CDF for.
|
|
11665
|
+
* @returns The value of CDF at {@link count}. In the discrete case, this corresponds to the probability that at most
|
|
11666
|
+
* {@link count} Bernoulli trials ended in a success.
|
|
11667
|
+
*/
|
|
11668
|
+
cdf(count) {
|
|
11669
|
+
if (this.sigma === 0) {
|
|
11670
|
+
return 1;
|
|
11671
|
+
}
|
|
11672
|
+
const k = (count + 0.5 - this.mu) / this.sigma;
|
|
11673
|
+
// See equation (14) of the cited paper.
|
|
11674
|
+
const result = NormalDistribution.cdf(0, 1, k) +
|
|
11675
|
+
this.v * (1 - k * k) * NormalDistribution.pdf(0, 1, k);
|
|
11676
|
+
return MathUtils.clamp(result, 0, 1);
|
|
11677
|
+
}
|
|
11678
|
+
}
|
|
11679
|
+
|
|
11680
|
+
/**
|
|
11681
|
+
* A set of utilities to handle legacy mods storage conversion to the new storage format in osu!droid.
|
|
11682
|
+
*/
|
|
11683
|
+
class DroidLegacyModConverter {
|
|
11684
|
+
/**
|
|
11685
|
+
* Converts a legacy mod string to an array of `Mod`s.
|
|
11686
|
+
*
|
|
11687
|
+
* @param str The mod string to convert.
|
|
11688
|
+
* @param difficulty The `BeatmapDifficulty` to use for `IMigratableDroidMod` migrations. When omitted, `IMigratableDroidMod`s will not be migrated.
|
|
11689
|
+
* @returns An array of `Mod`s.
|
|
11690
|
+
*/
|
|
11691
|
+
static convert(str, difficulty) {
|
|
11692
|
+
const map = new ModMap();
|
|
11693
|
+
if (!str) {
|
|
11694
|
+
return map;
|
|
11695
|
+
}
|
|
11696
|
+
const data = str.split("|");
|
|
11697
|
+
for (const c of data[0]) {
|
|
11698
|
+
const modType = this.legacyStorableMods.get(c);
|
|
11699
|
+
if (!modType) {
|
|
11700
|
+
continue;
|
|
11701
|
+
}
|
|
11702
|
+
const mod = new modType();
|
|
11703
|
+
if (mod.isMigratableDroidMod() && difficulty) {
|
|
11704
|
+
map.set(mod.migrateDroidMod(difficulty));
|
|
11705
|
+
}
|
|
11706
|
+
else {
|
|
11707
|
+
map.set(mod);
|
|
11708
|
+
}
|
|
11709
|
+
}
|
|
11710
|
+
if (data.length > 1) {
|
|
11711
|
+
this.parseExtraModString(map, data.slice(1));
|
|
11712
|
+
}
|
|
11713
|
+
return map;
|
|
11714
|
+
}
|
|
11715
|
+
/**
|
|
11716
|
+
* Parses the extra strings of a mod string.
|
|
11717
|
+
*
|
|
11718
|
+
* @param map The current `Mod`s.
|
|
11719
|
+
* @param extraStrings The extra strings to parse.
|
|
11720
|
+
*/
|
|
11721
|
+
static parseExtraModString(map, extraStrings) {
|
|
11722
|
+
let customCS;
|
|
11723
|
+
let customAR;
|
|
11724
|
+
let customOD;
|
|
11725
|
+
let customHP;
|
|
11726
|
+
for (const s of extraStrings) {
|
|
11727
|
+
switch (true) {
|
|
11728
|
+
// Forced stats
|
|
11729
|
+
case s.startsWith("CS"):
|
|
11730
|
+
customCS = parseFloat(s.slice(2));
|
|
11731
|
+
break;
|
|
11732
|
+
case s.startsWith("AR"):
|
|
11733
|
+
customAR = parseFloat(s.slice(2));
|
|
11734
|
+
break;
|
|
11735
|
+
case s.startsWith("OD"):
|
|
11736
|
+
customOD = parseFloat(s.slice(2));
|
|
11737
|
+
break;
|
|
11738
|
+
case s.startsWith("HP"):
|
|
11739
|
+
customHP = parseFloat(s.slice(2));
|
|
11740
|
+
break;
|
|
11741
|
+
// FL follow delay
|
|
11742
|
+
case s.startsWith("FLD"): {
|
|
11743
|
+
let flashlight = map.get(ModFlashlight);
|
|
11744
|
+
if (!flashlight) {
|
|
11745
|
+
flashlight = new ModFlashlight();
|
|
11746
|
+
map.set(flashlight);
|
|
11747
|
+
}
|
|
11748
|
+
flashlight.followDelay.value = parseFloat(s.slice(3));
|
|
11749
|
+
break;
|
|
11750
|
+
}
|
|
11751
|
+
// Speed multiplier
|
|
11752
|
+
case s.startsWith("x"): {
|
|
11753
|
+
let customSpeed = map.get(ModCustomSpeed);
|
|
11754
|
+
if (!customSpeed) {
|
|
11755
|
+
customSpeed = new ModCustomSpeed();
|
|
11756
|
+
map.set(customSpeed);
|
|
11757
|
+
}
|
|
11758
|
+
customSpeed.trackRateMultiplier.value = parseFloat(s.slice(1));
|
|
11759
|
+
break;
|
|
11760
|
+
}
|
|
11761
|
+
}
|
|
11762
|
+
}
|
|
11763
|
+
if (customCS !== undefined ||
|
|
11764
|
+
customAR !== undefined ||
|
|
11765
|
+
customOD !== undefined ||
|
|
11766
|
+
customHP !== undefined) {
|
|
11767
|
+
map.set(new ModDifficultyAdjust({
|
|
11768
|
+
cs: customCS,
|
|
11769
|
+
ar: customAR,
|
|
11770
|
+
od: customOD,
|
|
11771
|
+
hp: customHP,
|
|
11772
|
+
}));
|
|
11773
|
+
}
|
|
11774
|
+
}
|
|
11775
|
+
}
|
|
11776
|
+
/**
|
|
11777
|
+
* All `Mod`s that can be stored in the legacy mods format by their respective encode character.
|
|
11778
|
+
*/
|
|
11779
|
+
DroidLegacyModConverter.legacyStorableMods = new Map([
|
|
11780
|
+
["a", ModAuto],
|
|
11781
|
+
["b", ModTraceable],
|
|
11782
|
+
["c", ModNightCore],
|
|
11783
|
+
["d", ModDoubleTime],
|
|
11784
|
+
["e", ModEasy],
|
|
11785
|
+
["f", ModPerfect],
|
|
11786
|
+
["h", ModHidden],
|
|
11787
|
+
["i", ModFlashlight],
|
|
11788
|
+
["l", ModReallyEasy],
|
|
11789
|
+
["m", ModSmallCircle],
|
|
11790
|
+
["n", ModNoFail],
|
|
11791
|
+
["p", ModAutopilot],
|
|
11792
|
+
["r", ModHardRock],
|
|
11793
|
+
["s", ModPrecise],
|
|
11794
|
+
["t", ModHalfTime],
|
|
11795
|
+
["u", ModSuddenDeath],
|
|
11796
|
+
["v", ModScoreV2],
|
|
11797
|
+
["x", ModRelax],
|
|
11798
|
+
]);
|
|
11799
|
+
|
|
11800
|
+
/**
|
|
11801
|
+
* Represents the "old" `ModNightCore`.
|
|
11802
|
+
*
|
|
11803
|
+
* This `Mod` is used solely for difficulty calculation of replays with version 3 or older. The reason behind this is a
|
|
11804
|
+
* bug that was patched in replay version 4, where all audio that did not have 44100Hz frequency would slow down or
|
|
11805
|
+
* speed up depending on the frequency of the audio.
|
|
11806
|
+
*
|
|
11807
|
+
* The equation for the playback rate with respect to the audio frequency (in Hz) was:
|
|
11808
|
+
*
|
|
11809
|
+
* ```
|
|
11810
|
+
* playback_rate = 44100 * 1.5 / audio_frequency
|
|
11811
|
+
* ```
|
|
11812
|
+
*
|
|
11813
|
+
* For example, if the audio's frequency is 48000Hz, the audio would play at `44100 * 1.5 / 48000 = 1.378125` playback
|
|
11814
|
+
* rate.
|
|
11815
|
+
*
|
|
11816
|
+
* This `Mod` assumes that the audio frequency is 48000Hz and applies the same equation to calculate the playback rate.
|
|
11817
|
+
* The frequency was chosen after sampling many audio files that were affected by this bug, and it seemed that 48000Hz
|
|
11818
|
+
* was the most common frequency used in those files.
|
|
11819
|
+
*
|
|
11820
|
+
* Realistically, it is possible to obtain the audio frequency in the game during gameplay loading (and therefore would
|
|
11821
|
+
* result in the correct playback rate), but this would require additional work and the current solution is deemed
|
|
11822
|
+
* sufficient for the purpose it serves.
|
|
11823
|
+
*/
|
|
11824
|
+
class ModOldNightCore extends ModNightCore {
|
|
11825
|
+
constructor() {
|
|
11826
|
+
super();
|
|
11827
|
+
this.trackRateMultiplier.value = (44.1 * 1.5) / 48;
|
|
11828
|
+
}
|
|
11829
|
+
get droidScoreMultiplier() {
|
|
11830
|
+
return 1.12;
|
|
11831
|
+
}
|
|
11832
|
+
get migrationDroidScoreMultiplier() {
|
|
11833
|
+
return this.droidScoreMultiplier;
|
|
11834
|
+
}
|
|
11835
|
+
}
|
|
11836
|
+
|
|
11684
11837
|
/**
|
|
11685
|
-
*
|
|
11686
|
-
* calculation for erf^-1(z) in the interval [0.75, 1] with x greater than 44.
|
|
11838
|
+
* Available genres in an online osu! beatmap.
|
|
11687
11839
|
*/
|
|
11688
|
-
|
|
11689
|
-
|
|
11690
|
-
|
|
11691
|
-
|
|
11692
|
-
];
|
|
11840
|
+
exports.BeatmapGenre = void 0;
|
|
11841
|
+
(function (BeatmapGenre) {
|
|
11842
|
+
BeatmapGenre[BeatmapGenre["any"] = 0] = "any";
|
|
11843
|
+
BeatmapGenre[BeatmapGenre["unspecified"] = 1] = "unspecified";
|
|
11844
|
+
BeatmapGenre[BeatmapGenre["videoGame"] = 2] = "videoGame";
|
|
11845
|
+
BeatmapGenre[BeatmapGenre["anime"] = 3] = "anime";
|
|
11846
|
+
BeatmapGenre[BeatmapGenre["rock"] = 4] = "rock";
|
|
11847
|
+
BeatmapGenre[BeatmapGenre["pop"] = 5] = "pop";
|
|
11848
|
+
BeatmapGenre[BeatmapGenre["other"] = 6] = "other";
|
|
11849
|
+
BeatmapGenre[BeatmapGenre["novelty"] = 7] = "novelty";
|
|
11850
|
+
BeatmapGenre[BeatmapGenre["hipHop"] = 9] = "hipHop";
|
|
11851
|
+
BeatmapGenre[BeatmapGenre["electronic"] = 10] = "electronic";
|
|
11852
|
+
BeatmapGenre[BeatmapGenre["metal"] = 11] = "metal";
|
|
11853
|
+
BeatmapGenre[BeatmapGenre["classical"] = 12] = "classical";
|
|
11854
|
+
BeatmapGenre[BeatmapGenre["folk"] = 13] = "folk";
|
|
11855
|
+
BeatmapGenre[BeatmapGenre["jazz"] = 14] = "jazz";
|
|
11856
|
+
})(exports.BeatmapGenre || (exports.BeatmapGenre = {}));
|
|
11857
|
+
|
|
11693
11858
|
/**
|
|
11694
|
-
*
|
|
11695
|
-
* calculation for erf^-1(z) in the interval [0.75, 1] with x greater than 44.
|
|
11859
|
+
* Available languages in an online osu! beatmap.
|
|
11696
11860
|
*/
|
|
11697
|
-
|
|
11698
|
-
|
|
11699
|
-
|
|
11700
|
-
];
|
|
11861
|
+
exports.BeatmapLanguage = void 0;
|
|
11862
|
+
(function (BeatmapLanguage) {
|
|
11863
|
+
BeatmapLanguage[BeatmapLanguage["any"] = 0] = "any";
|
|
11864
|
+
BeatmapLanguage[BeatmapLanguage["unspecified"] = 1] = "unspecified";
|
|
11865
|
+
BeatmapLanguage[BeatmapLanguage["english"] = 2] = "english";
|
|
11866
|
+
BeatmapLanguage[BeatmapLanguage["japanese"] = 3] = "japanese";
|
|
11867
|
+
BeatmapLanguage[BeatmapLanguage["chinese"] = 4] = "chinese";
|
|
11868
|
+
BeatmapLanguage[BeatmapLanguage["instrumental"] = 5] = "instrumental";
|
|
11869
|
+
BeatmapLanguage[BeatmapLanguage["korean"] = 6] = "korean";
|
|
11870
|
+
BeatmapLanguage[BeatmapLanguage["french"] = 7] = "french";
|
|
11871
|
+
BeatmapLanguage[BeatmapLanguage["german"] = 8] = "german";
|
|
11872
|
+
BeatmapLanguage[BeatmapLanguage["swedish"] = 9] = "swedish";
|
|
11873
|
+
BeatmapLanguage[BeatmapLanguage["spanish"] = 10] = "spanish";
|
|
11874
|
+
BeatmapLanguage[BeatmapLanguage["italian"] = 11] = "italian";
|
|
11875
|
+
BeatmapLanguage[BeatmapLanguage["russian"] = 12] = "russian";
|
|
11876
|
+
BeatmapLanguage[BeatmapLanguage["polish"] = 13] = "polish";
|
|
11877
|
+
BeatmapLanguage[BeatmapLanguage["other"] = 14] = "other";
|
|
11878
|
+
})(exports.BeatmapLanguage || (exports.BeatmapLanguage = {}));
|
|
11879
|
+
|
|
11880
|
+
/******************************************************************************
|
|
11881
|
+
Copyright (c) Microsoft Corporation.
|
|
11882
|
+
|
|
11883
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
11884
|
+
purpose with or without fee is hereby granted.
|
|
11885
|
+
|
|
11886
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
11887
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11888
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11889
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11890
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
11891
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
11892
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
11893
|
+
***************************************************************************** */
|
|
11894
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
11895
|
+
|
|
11896
|
+
|
|
11897
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
11898
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
11899
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11900
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11901
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11902
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11903
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11904
|
+
});
|
|
11905
|
+
}
|
|
11906
|
+
|
|
11907
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
11908
|
+
var e = new Error(message);
|
|
11909
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
11910
|
+
};
|
|
11701
11911
|
|
|
11702
11912
|
/**
|
|
11703
|
-
*
|
|
11704
|
-
*
|
|
11705
|
-
* For details about this distribution, see {@link http://en.wikipedia.org/wiki/Normal_distribution Wikipedia - Normal distribution}.
|
|
11706
|
-
*
|
|
11707
|
-
* This class shares the same implementation as {@link https://numerics.mathdotnet.com/ Math.NET Numerics}.
|
|
11913
|
+
* The base of API request builders.
|
|
11708
11914
|
*/
|
|
11709
|
-
|
|
11915
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
11916
|
+
class APIRequestBuilder {
|
|
11917
|
+
constructor() {
|
|
11918
|
+
/**
|
|
11919
|
+
* Whether or not to include the API key in the request URL.
|
|
11920
|
+
*/
|
|
11921
|
+
this.requiresAPIkey = true;
|
|
11922
|
+
/**
|
|
11923
|
+
* The endpoint of this builder.
|
|
11924
|
+
*/
|
|
11925
|
+
this.endpoint = "";
|
|
11926
|
+
/**
|
|
11927
|
+
* The parameters of this builder.
|
|
11928
|
+
*/
|
|
11929
|
+
this.params = new Map();
|
|
11930
|
+
this.fetchAttempts = 0;
|
|
11931
|
+
}
|
|
11710
11932
|
/**
|
|
11711
|
-
*
|
|
11712
|
-
*
|
|
11713
|
-
* @param mean The mean (μ) of the normal distribution.
|
|
11714
|
-
* @param stdDev The standard deviation (σ) of the normal distribution. Range: σ ≥ 0.
|
|
11715
|
-
* @param x The location at which to compute the cumulative distribution function.
|
|
11716
|
-
* @returns The cumulative distribution at {@link x}.
|
|
11933
|
+
* The base URL of this builder.
|
|
11717
11934
|
*/
|
|
11718
|
-
|
|
11719
|
-
|
|
11720
|
-
throw new RangeError("Invalid parametrization for the distribution.");
|
|
11721
|
-
}
|
|
11722
|
-
if (mean === x && stdDev === 0) {
|
|
11723
|
-
return 0;
|
|
11724
|
-
}
|
|
11725
|
-
return 0.5 * ErrorFunction.erfc((mean - x) / (stdDev * Math.SQRT2));
|
|
11935
|
+
get baseURL() {
|
|
11936
|
+
return this.host + this.endpoint;
|
|
11726
11937
|
}
|
|
11727
11938
|
/**
|
|
11728
|
-
*
|
|
11729
|
-
*
|
|
11730
|
-
* In MATLAB, this is known as `normpdf`.
|
|
11939
|
+
* Sets the API endpoint.
|
|
11731
11940
|
*
|
|
11732
|
-
* @param
|
|
11733
|
-
* @param stdDev The standard deviation (σ) of the normal distribution. Range: σ ≥ 0.
|
|
11734
|
-
* @param x The location at which to compute the density.
|
|
11735
|
-
* @returns The density at {@link x}.
|
|
11941
|
+
* @param endpoint The endpoint to set.
|
|
11736
11942
|
*/
|
|
11737
|
-
|
|
11738
|
-
|
|
11739
|
-
|
|
11740
|
-
}
|
|
11741
|
-
const d = (x - mean) / stdDev;
|
|
11742
|
-
return Math.exp(-0.5 * d * d) / (stdDev * Math.sqrt(2 * Math.PI));
|
|
11943
|
+
setEndpoint(endpoint) {
|
|
11944
|
+
this.endpoint = endpoint;
|
|
11945
|
+
return this;
|
|
11743
11946
|
}
|
|
11744
11947
|
/**
|
|
11745
|
-
*
|
|
11746
|
-
* at the given probability. This is also known as the quantile or percent point function.
|
|
11948
|
+
* Sets if this builder includes the API key in the request URL.
|
|
11747
11949
|
*
|
|
11748
|
-
* @param
|
|
11749
|
-
* @param stdDev The standard deviation (σ) of the normal distribution. Range: σ ≥ 0.
|
|
11750
|
-
* @param p The location at which to compute the inverse cumulative density.
|
|
11751
|
-
* @returns The inverse cumulative density at `p`.
|
|
11950
|
+
* @param requireAPIkey Whether or not to include the API key in the request URL.
|
|
11752
11951
|
*/
|
|
11753
|
-
|
|
11754
|
-
|
|
11755
|
-
|
|
11756
|
-
}
|
|
11757
|
-
return mean - stdDev * Math.SQRT2 * ErrorFunction.erfcInv(2 * p);
|
|
11952
|
+
setRequireAPIkey(requireAPIkey) {
|
|
11953
|
+
this.requiresAPIkey = requireAPIkey;
|
|
11954
|
+
return this;
|
|
11758
11955
|
}
|
|
11759
|
-
|
|
11760
|
-
|
|
11761
|
-
|
|
11762
|
-
|
|
11763
|
-
|
|
11764
|
-
|
|
11765
|
-
|
|
11766
|
-
|
|
11767
|
-
|
|
11768
|
-
|
|
11769
|
-
|
|
11770
|
-
|
|
11771
|
-
|
|
11772
|
-
|
|
11773
|
-
|
|
11774
|
-
this.mu = 0;
|
|
11775
|
-
this.var = 0;
|
|
11776
|
-
this.gamma = 0;
|
|
11956
|
+
/**
|
|
11957
|
+
* Builds the URL to request the API.
|
|
11958
|
+
*/
|
|
11959
|
+
buildURL() {
|
|
11960
|
+
let url = this.baseURL + "?";
|
|
11961
|
+
if (this.requiresAPIkey) {
|
|
11962
|
+
if (!this.APIkey) {
|
|
11963
|
+
throw new Error("An API key has not been specified");
|
|
11964
|
+
}
|
|
11965
|
+
url += this.APIkeyParam;
|
|
11966
|
+
}
|
|
11967
|
+
for (const [param, value] of this.params.entries()) {
|
|
11968
|
+
url += `${param}=${encodeURIComponent(value)}&`;
|
|
11969
|
+
}
|
|
11970
|
+
return url;
|
|
11777
11971
|
}
|
|
11778
11972
|
/**
|
|
11779
|
-
*
|
|
11973
|
+
* Sends a request to the API using built parameters.
|
|
11780
11974
|
*
|
|
11781
|
-
*
|
|
11975
|
+
* If the request fails, it will be redone 5 times.
|
|
11782
11976
|
*/
|
|
11783
|
-
|
|
11784
|
-
|
|
11785
|
-
|
|
11786
|
-
|
|
11977
|
+
sendRequest() {
|
|
11978
|
+
return new Promise((resolve) => {
|
|
11979
|
+
const url = this.buildURL();
|
|
11980
|
+
fetch(url)
|
|
11981
|
+
.then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
11982
|
+
++this.fetchAttempts;
|
|
11983
|
+
if (res.status >= 500 && this.fetchAttempts < 5) {
|
|
11984
|
+
console.error(`Request to ${url} failed with the following error: ${yield res.text()}; ${this.fetchAttempts.toString()} attempts so far; retrying`);
|
|
11985
|
+
resolve(this.sendRequest());
|
|
11986
|
+
return;
|
|
11987
|
+
}
|
|
11988
|
+
this.fetchAttempts = 0;
|
|
11989
|
+
resolve({
|
|
11990
|
+
data: Buffer.from(yield res.arrayBuffer()),
|
|
11991
|
+
statusCode: res.status,
|
|
11992
|
+
});
|
|
11993
|
+
}))
|
|
11994
|
+
.catch((e) => {
|
|
11995
|
+
console.error(`Request to ${url} failed with the following error: ${e.message}; ${this.fetchAttempts.toString()} attempts so far; aborting`);
|
|
11996
|
+
this.fetchAttempts = 0;
|
|
11997
|
+
resolve({
|
|
11998
|
+
data: Buffer.from([]),
|
|
11999
|
+
statusCode: 400,
|
|
12000
|
+
});
|
|
12001
|
+
return;
|
|
12002
|
+
});
|
|
12003
|
+
});
|
|
11787
12004
|
}
|
|
11788
12005
|
/**
|
|
11789
|
-
* Adds
|
|
12006
|
+
* Adds a parameter to the builder.
|
|
11790
12007
|
*
|
|
11791
|
-
* @param
|
|
11792
|
-
* @param
|
|
12008
|
+
* @param param The parameter to add.
|
|
12009
|
+
* @param value The value to add for the parameter.
|
|
11793
12010
|
*/
|
|
11794
|
-
|
|
11795
|
-
this.
|
|
11796
|
-
this
|
|
11797
|
-
this.gamma += p * (1 - p) * (1 - 2 * p) * count;
|
|
12011
|
+
addParameter(param, value) {
|
|
12012
|
+
this.params.set(param, value.toString());
|
|
12013
|
+
return this;
|
|
11798
12014
|
}
|
|
11799
12015
|
/**
|
|
11800
|
-
*
|
|
12016
|
+
* Removes a parameter from the builder.
|
|
11801
12017
|
*
|
|
11802
|
-
* @param
|
|
11803
|
-
* this corresponds to the number of successful Bernoulli trials to query the CDF for.
|
|
11804
|
-
* @returns The value of CDF at {@link count}. In the discrete case, this corresponds to the probability that at most
|
|
11805
|
-
* {@link count} Bernoulli trials ended in a success.
|
|
11806
|
-
*/
|
|
11807
|
-
cdf(count) {
|
|
11808
|
-
if (this.var === 0) {
|
|
11809
|
-
return this.mu <= count ? 1 : 0;
|
|
11810
|
-
}
|
|
11811
|
-
const sigma = Math.sqrt(this.var);
|
|
11812
|
-
const v = this.gamma / (6 * Math.pow(sigma, 3));
|
|
11813
|
-
const k = (count + 0.5 - this.mu) / sigma;
|
|
11814
|
-
const result = NormalDistribution.cdf(0, 1, k) +
|
|
11815
|
-
v * (1 - k * k) * NormalDistribution.pdf(0, 1, k);
|
|
11816
|
-
return MathUtils.clamp(result, 0, 1);
|
|
11817
|
-
}
|
|
11818
|
-
/**
|
|
11819
|
-
* Resets the distribution to an empty state.
|
|
12018
|
+
* @param param The parameter to remove.
|
|
11820
12019
|
*/
|
|
11821
|
-
|
|
11822
|
-
this.
|
|
11823
|
-
this
|
|
11824
|
-
this.gamma = 0;
|
|
12020
|
+
removeParameter(param) {
|
|
12021
|
+
this.params.delete(param);
|
|
12022
|
+
return this;
|
|
11825
12023
|
}
|
|
11826
12024
|
}
|
|
11827
12025
|
|
|
11828
12026
|
/**
|
|
11829
|
-
*
|
|
12027
|
+
* An API request builder for osu!droid.
|
|
11830
12028
|
*/
|
|
11831
|
-
|
|
11832
|
-
(
|
|
11833
|
-
|
|
11834
|
-
|
|
11835
|
-
|
|
11836
|
-
|
|
11837
|
-
|
|
11838
|
-
|
|
11839
|
-
|
|
11840
|
-
|
|
12029
|
+
class DroidAPIRequestBuilder extends APIRequestBuilder {
|
|
12030
|
+
constructor() {
|
|
12031
|
+
super(...arguments);
|
|
12032
|
+
this.host = "https://osudroid.moe/api/";
|
|
12033
|
+
this.APIkey = DroidAPIRequestBuilder.apiKey;
|
|
12034
|
+
this.APIkeyParam = `apiKey=${this.APIkey}&`;
|
|
12035
|
+
}
|
|
12036
|
+
/**
|
|
12037
|
+
* Sets the API key for all subsequent initializations of a `DroidAPIRequestBuilder`.
|
|
12038
|
+
*
|
|
12039
|
+
* @param key The API key.
|
|
12040
|
+
*/
|
|
12041
|
+
static setAPIKey(key) {
|
|
12042
|
+
this.apiKey = key;
|
|
12043
|
+
}
|
|
12044
|
+
buildURL() {
|
|
12045
|
+
switch (this.endpoint) {
|
|
12046
|
+
case "upload":
|
|
12047
|
+
case "bestpp": {
|
|
12048
|
+
let url = this.baseURL + "/";
|
|
12049
|
+
for (const [, value] of this.params.entries()) {
|
|
12050
|
+
url += encodeURIComponent(value);
|
|
12051
|
+
}
|
|
12052
|
+
return url;
|
|
12053
|
+
}
|
|
12054
|
+
default:
|
|
12055
|
+
return super.buildURL();
|
|
12056
|
+
}
|
|
12057
|
+
}
|
|
12058
|
+
}
|
|
12059
|
+
DroidAPIRequestBuilder.apiKey = "";
|
|
11841
12060
|
|
|
11842
12061
|
/**
|
|
11843
12062
|
* An API request builder for osu!standard.
|
|
@@ -12250,96 +12469,107 @@ class MapInfo {
|
|
|
12250
12469
|
}
|
|
12251
12470
|
|
|
12252
12471
|
/**
|
|
12253
|
-
*
|
|
12254
|
-
*
|
|
12255
|
-
* This `Mod` is used solely for difficulty calculation of replays with version 3 or older. The reason behind this is a
|
|
12256
|
-
* bug that was patched in replay version 4, where all audio that did not have 44100Hz frequency would slow down or
|
|
12257
|
-
* speed up depending on the frequency of the audio.
|
|
12258
|
-
*
|
|
12259
|
-
* The equation for the playback rate with respect to the audio frequency (in Hz) was:
|
|
12260
|
-
*
|
|
12261
|
-
* ```
|
|
12262
|
-
* playback_rate = 44100 * 1.5 / audio_frequency
|
|
12263
|
-
* ```
|
|
12264
|
-
*
|
|
12265
|
-
* For example, if the audio's frequency is 48000Hz, the audio would play at `44100 * 1.5 / 48000 = 1.378125` playback
|
|
12266
|
-
* rate.
|
|
12267
|
-
*
|
|
12268
|
-
* This `Mod` assumes that the audio frequency is 48000Hz and applies the same equation to calculate the playback rate.
|
|
12269
|
-
* The frequency was chosen after sampling many audio files that were affected by this bug, and it seemed that 48000Hz
|
|
12270
|
-
* was the most common frequency used in those files.
|
|
12271
|
-
*
|
|
12272
|
-
* Realistically, it is possible to obtain the audio frequency in the game during gameplay loading (and therefore would
|
|
12273
|
-
* result in the correct playback rate), but this would require additional work and the current solution is deemed
|
|
12274
|
-
* sufficient for the purpose it serves.
|
|
12275
|
-
*/
|
|
12276
|
-
class ModOldNightCore extends ModNightCore {
|
|
12277
|
-
constructor() {
|
|
12278
|
-
super();
|
|
12279
|
-
this.trackRateMultiplier.value = (44.1 * 1.5) / 48;
|
|
12280
|
-
}
|
|
12281
|
-
get droidScoreMultiplier() {
|
|
12282
|
-
return 1.12;
|
|
12283
|
-
}
|
|
12284
|
-
}
|
|
12285
|
-
|
|
12286
|
-
/**
|
|
12287
|
-
* Approximation of the {@link https://en.wikipedia.org/wiki/Poisson_binomial_distribution Poisson binomial distribution}.
|
|
12288
|
-
*
|
|
12289
|
-
* For the approximation method, see "Refined Normal Approximation (RNA)" from:
|
|
12290
|
-
*
|
|
12291
|
-
* {@link https://www.researchgate.net/publication/257017356_On_computing_the_distribution_function_for_the_Poisson_binomial_distribution Hong, Y. (2013). On computing the distribution function for the Poisson binomial distribution. Computational Statistics and Data Analysis, Vol. 59, pp. 41-51}.
|
|
12292
|
-
*
|
|
12293
|
-
* This has been verified against a reference implementation provided by the authors in the R package "poibin",
|
|
12294
|
-
* which can be viewed {@link https://rdrr.io/cran/poibin/man/poibin-package.html here}.
|
|
12472
|
+
* An accuracy calculator that calculates accuracy based on given parameters.
|
|
12295
12473
|
*/
|
|
12296
|
-
class
|
|
12474
|
+
class Accuracy {
|
|
12297
12475
|
/**
|
|
12298
|
-
*
|
|
12299
|
-
* difficulties, skill, and method for getting the miss probabilities.
|
|
12476
|
+
* Calculates accuracy based on given parameters.
|
|
12300
12477
|
*
|
|
12301
|
-
*
|
|
12302
|
-
*
|
|
12303
|
-
*
|
|
12478
|
+
* If `percent` and `nobjects` are specified, `n300`, `n100`, and `n50` will
|
|
12479
|
+
* be automatically calculated to be the closest to the given
|
|
12480
|
+
* acc percent.
|
|
12481
|
+
*
|
|
12482
|
+
* @param values Function parameters.
|
|
12304
12483
|
*/
|
|
12305
|
-
constructor(
|
|
12306
|
-
|
|
12307
|
-
|
|
12308
|
-
|
|
12309
|
-
|
|
12310
|
-
|
|
12311
|
-
|
|
12312
|
-
|
|
12313
|
-
|
|
12314
|
-
|
|
12484
|
+
constructor(values) {
|
|
12485
|
+
var _a, _b, _c, _d;
|
|
12486
|
+
this.nmiss = (_a = values.nmiss) !== null && _a !== void 0 ? _a : 0;
|
|
12487
|
+
this.n300 = (_b = values.n300) !== null && _b !== void 0 ? _b : -1;
|
|
12488
|
+
this.n100 = (_c = values.n100) !== null && _c !== void 0 ? _c : 0;
|
|
12489
|
+
this.n50 = (_d = values.n50) !== null && _d !== void 0 ? _d : 0;
|
|
12490
|
+
let nobjects;
|
|
12491
|
+
if (values.nobjects) {
|
|
12492
|
+
let n300 = this.n300;
|
|
12493
|
+
nobjects = values.nobjects;
|
|
12494
|
+
let hitcount;
|
|
12495
|
+
if (n300 < 0) {
|
|
12496
|
+
n300 = Math.max(0, nobjects - this.n100 - this.n50 - this.nmiss);
|
|
12315
12497
|
}
|
|
12316
|
-
|
|
12317
|
-
|
|
12318
|
-
|
|
12319
|
-
variance += p * (1 - p);
|
|
12320
|
-
gamma += p * (1 - p) * (1 - 2 * p);
|
|
12498
|
+
hitcount = n300 + this.n100 + this.n50 + this.nmiss;
|
|
12499
|
+
if (hitcount > nobjects) {
|
|
12500
|
+
n300 -= Math.min(n300, hitcount - nobjects);
|
|
12321
12501
|
}
|
|
12502
|
+
hitcount = n300 + this.n100 + this.n50 + this.nmiss;
|
|
12503
|
+
if (hitcount > nobjects) {
|
|
12504
|
+
this.n100 -= Math.min(this.n100, hitcount - nobjects);
|
|
12505
|
+
}
|
|
12506
|
+
hitcount = n300 + this.n100 + this.n50 + this.nmiss;
|
|
12507
|
+
if (hitcount > nobjects) {
|
|
12508
|
+
this.n50 -= Math.min(this.n50, hitcount - nobjects);
|
|
12509
|
+
}
|
|
12510
|
+
hitcount = n300 + this.n100 + this.n50 + this.nmiss;
|
|
12511
|
+
if (hitcount > nobjects) {
|
|
12512
|
+
this.nmiss -= Math.min(this.nmiss, hitcount - nobjects);
|
|
12513
|
+
}
|
|
12514
|
+
this.n300 = nobjects - this.n100 - this.n50 - this.nmiss;
|
|
12515
|
+
}
|
|
12516
|
+
if (values.percent) {
|
|
12517
|
+
if (!values.nobjects) {
|
|
12518
|
+
throw new TypeError("nobjects is required when specifying percent");
|
|
12519
|
+
}
|
|
12520
|
+
nobjects = values.nobjects;
|
|
12521
|
+
const max300 = nobjects - this.nmiss;
|
|
12522
|
+
const maxacc = new Accuracy({
|
|
12523
|
+
n300: max300,
|
|
12524
|
+
n100: 0,
|
|
12525
|
+
n50: 0,
|
|
12526
|
+
nmiss: this.nmiss,
|
|
12527
|
+
}).value() * 100;
|
|
12528
|
+
let acc_percent = values.percent;
|
|
12529
|
+
acc_percent = Math.max(0, Math.min(maxacc, acc_percent));
|
|
12530
|
+
// just some black magic maths from wolfram alpha
|
|
12531
|
+
this.n100 = Math.round(-3 * ((acc_percent * 0.01 - 1) * nobjects + this.nmiss) * 0.5);
|
|
12532
|
+
if (this.n100 > max300) {
|
|
12533
|
+
// acc lower than all 100s, use 50s
|
|
12534
|
+
this.n100 = 0;
|
|
12535
|
+
this.n50 = Math.round(-6 *
|
|
12536
|
+
((acc_percent * 0.01 - 1) * nobjects + this.nmiss) *
|
|
12537
|
+
0.5);
|
|
12538
|
+
this.n50 = Math.min(max300, this.n50);
|
|
12539
|
+
}
|
|
12540
|
+
this.n300 = nobjects - this.n100 - this.n50 - this.nmiss;
|
|
12322
12541
|
}
|
|
12323
|
-
this.sigma = Math.sqrt(variance);
|
|
12324
|
-
this.v = gamma / (6 * Math.pow(this.sigma, 3));
|
|
12325
12542
|
}
|
|
12326
12543
|
/**
|
|
12327
|
-
*
|
|
12544
|
+
* Calculates the accuracy value (0.0 - 1.0).
|
|
12328
12545
|
*
|
|
12329
|
-
* @param
|
|
12330
|
-
* this corresponds to the number of successful Bernoulli trials to query the CDF for.
|
|
12331
|
-
* @returns The value of CDF at {@link count}. In the discrete case, this corresponds to the probability that at most
|
|
12332
|
-
* {@link count} Bernoulli trials ended in a success.
|
|
12546
|
+
* @param nobjects The amount of objects in the beatmap. If `n300` was not specified in the constructor, this is required.
|
|
12333
12547
|
*/
|
|
12334
|
-
|
|
12335
|
-
|
|
12336
|
-
|
|
12548
|
+
value(nobjects) {
|
|
12549
|
+
let n300 = this.n300;
|
|
12550
|
+
if (n300 < 0) {
|
|
12551
|
+
if (!nobjects) {
|
|
12552
|
+
throw new TypeError("Either n300 or nobjects must be specified");
|
|
12553
|
+
}
|
|
12554
|
+
n300 = nobjects - this.n100 - this.n50 - this.nmiss;
|
|
12337
12555
|
}
|
|
12338
|
-
|
|
12339
|
-
|
|
12340
|
-
|
|
12341
|
-
|
|
12342
|
-
return MathUtils.clamp(
|
|
12556
|
+
else {
|
|
12557
|
+
nobjects !== null && nobjects !== void 0 ? nobjects : (nobjects = n300 + this.n100 + this.n50 + this.nmiss);
|
|
12558
|
+
}
|
|
12559
|
+
const res = (n300 * 6 + this.n100 * 2 + this.n50) / (nobjects * 6);
|
|
12560
|
+
return MathUtils.clamp(res, 0, 1);
|
|
12561
|
+
}
|
|
12562
|
+
/**
|
|
12563
|
+
* Determines whether this accuracy instance is equal to another instance.
|
|
12564
|
+
*
|
|
12565
|
+
* @param other The other accuracy instance.
|
|
12566
|
+
* @returns Whether both instances are equal.
|
|
12567
|
+
*/
|
|
12568
|
+
equals(other) {
|
|
12569
|
+
return (this.n300 === other.n300 &&
|
|
12570
|
+
this.n100 === other.n100 &&
|
|
12571
|
+
this.n50 === other.n50 &&
|
|
12572
|
+
this.nmiss === other.nmiss);
|
|
12343
12573
|
}
|
|
12344
12574
|
}
|
|
12345
12575
|
|
|
@@ -12375,6 +12605,7 @@ exports.CommandTimelineGroup = CommandTimelineGroup;
|
|
|
12375
12605
|
exports.CommandTrigger = CommandTrigger;
|
|
12376
12606
|
exports.ControlPointManager = ControlPointManager;
|
|
12377
12607
|
exports.DecimalModSetting = DecimalModSetting;
|
|
12608
|
+
exports.DifficultyAdjustModSetting = DifficultyAdjustModSetting;
|
|
12378
12609
|
exports.DifficultyControlPoint = DifficultyControlPoint;
|
|
12379
12610
|
exports.DifficultyControlPointManager = DifficultyControlPointManager;
|
|
12380
12611
|
exports.DroidAPIRequestBuilder = DroidAPIRequestBuilder;
|
|
@@ -12478,6 +12709,7 @@ exports.StoryboardSprite = StoryboardSprite;
|
|
|
12478
12709
|
exports.TimedHitSampleInfo = TimedHitSampleInfo;
|
|
12479
12710
|
exports.TimingControlPoint = TimingControlPoint;
|
|
12480
12711
|
exports.TimingControlPointManager = TimingControlPointManager;
|
|
12712
|
+
exports.UnadjustedOsuHitWindow = UnadjustedOsuHitWindow;
|
|
12481
12713
|
exports.Utils = Utils;
|
|
12482
12714
|
exports.Vector2 = Vector2;
|
|
12483
12715
|
exports.Vector4 = Vector4;
|