@rian8337/osu-base 4.0.0-beta.96 → 4.0.0-beta.98

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.
Files changed (3) hide show
  1. package/dist/index.js +2693 -1490
  2. package/package.json +2 -2
  3. package/typings/index.d.ts +706 -291
package/dist/index.js CHANGED
@@ -1172,51 +1172,6 @@ HitObject.preemptMin = 450;
1172
1172
  */
1173
1173
  HitObject.controlPointLeniency = 1;
1174
1174
 
1175
- /**
1176
- * Types of easing.
1177
- *
1178
- * See {@link http://easings.net/ this} page for more samples.
1179
- */
1180
- exports.Easing = void 0;
1181
- (function (Easing) {
1182
- Easing[Easing["None"] = 0] = "None";
1183
- Easing[Easing["Out"] = 1] = "Out";
1184
- Easing[Easing["In"] = 2] = "In";
1185
- Easing[Easing["InQuad"] = 3] = "InQuad";
1186
- Easing[Easing["OutQuad"] = 4] = "OutQuad";
1187
- Easing[Easing["InOutQuad"] = 5] = "InOutQuad";
1188
- Easing[Easing["InCubic"] = 6] = "InCubic";
1189
- Easing[Easing["OutCubic"] = 7] = "OutCubic";
1190
- Easing[Easing["InOutCubic"] = 8] = "InOutCubic";
1191
- Easing[Easing["InQuart"] = 9] = "InQuart";
1192
- Easing[Easing["OutQuart"] = 10] = "OutQuart";
1193
- Easing[Easing["InOutQuart"] = 11] = "InOutQuart";
1194
- Easing[Easing["InQuint"] = 12] = "InQuint";
1195
- Easing[Easing["OutQuint"] = 13] = "OutQuint";
1196
- Easing[Easing["InOutQuint"] = 14] = "InOutQuint";
1197
- Easing[Easing["InSine"] = 15] = "InSine";
1198
- Easing[Easing["OutSine"] = 16] = "OutSine";
1199
- Easing[Easing["InOutSine"] = 17] = "InOutSine";
1200
- Easing[Easing["InExpo"] = 18] = "InExpo";
1201
- Easing[Easing["OutExpo"] = 19] = "OutExpo";
1202
- Easing[Easing["InOutExpo"] = 20] = "InOutExpo";
1203
- Easing[Easing["InCirc"] = 21] = "InCirc";
1204
- Easing[Easing["OutCirc"] = 22] = "OutCirc";
1205
- Easing[Easing["InOutCirc"] = 23] = "InOutCirc";
1206
- Easing[Easing["InElastic"] = 24] = "InElastic";
1207
- Easing[Easing["OutElastic"] = 25] = "OutElastic";
1208
- Easing[Easing["OutElasticHalf"] = 26] = "OutElasticHalf";
1209
- Easing[Easing["OutElasticQuarter"] = 27] = "OutElasticQuarter";
1210
- Easing[Easing["InOutElastic"] = 28] = "InOutElastic";
1211
- Easing[Easing["InBack"] = 29] = "InBack";
1212
- Easing[Easing["OutBack"] = 30] = "OutBack";
1213
- Easing[Easing["InOutBack"] = 31] = "InOutBack";
1214
- Easing[Easing["InBounce"] = 32] = "InBounce";
1215
- Easing[Easing["OutBounce"] = 33] = "OutBounce";
1216
- Easing[Easing["InOutBounce"] = 34] = "InOutBounce";
1217
- Easing[Easing["OutPow10"] = 35] = "OutPow10";
1218
- })(exports.Easing || (exports.Easing = {}));
1219
-
1220
1175
  /**
1221
1176
  * Represents a `Mod` specific setting.
1222
1177
  */
@@ -1294,7 +1249,16 @@ class ModSetting {
1294
1249
  * @returns A string representation of this `ModSetting`'s value.
1295
1250
  */
1296
1251
  toDisplayString() {
1297
- return this.displayFormatter(this.value);
1252
+ return this.formatValue(this.value);
1253
+ }
1254
+ /**
1255
+ * Formats a value of this `ModSetting` to a string using the display formatter.
1256
+ *
1257
+ * @param value The value to format.
1258
+ * @returns The formatted string representation of the value.
1259
+ */
1260
+ formatValue(value) {
1261
+ return this.displayFormatter(value);
1298
1262
  }
1299
1263
  /**
1300
1264
  * Binds an action that will be called when the value of this `ModSetting` changes.
@@ -1329,17 +1293,6 @@ class Mod {
1329
1293
  * Should be `false` for cases where the user is not meant to apply the `Mod` by themselves.
1330
1294
  */
1331
1295
  this.userPlayable = true;
1332
- /**
1333
- * The {@link Mod}s this {@link Mod} cannot be enabled with.
1334
- *
1335
- * This is merely a static list of {@link Mod} constructors that this {@link Mod} is incompatible with,
1336
- * regardless of the actual instance of the {@link Mod}.
1337
- *
1338
- * Some {@link Mod}s may have additional compatibility requirements that are captured in
1339
- * {@link isCompatibleWith}. When checking for {@link Mod} compatibility, always use
1340
- * {@link isCompatibleWith}.
1341
- */
1342
- this.incompatibleMods = new Set();
1343
1296
  this.settingsBacking = null;
1344
1297
  }
1345
1298
  /**
@@ -1367,15 +1320,24 @@ class Mod {
1367
1320
  /**
1368
1321
  * Determines whether this {@link Mod} is compatible with another {@link Mod}.
1369
1322
  *
1370
- * This extends {@link incompatibleMods} by allowing for dynamic checks against
1371
- * the actual instance of the {@link Mod} (i.e., its specific settings).
1372
- *
1373
1323
  * @param other The {@link Mod} to check compatibility with.
1374
1324
  * @return `true` if this {@link Mod} is compatible with {@link other}, `false` otherwise.
1375
1325
  */
1326
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1376
1327
  isCompatibleWith(other) {
1377
- return (!this.incompatibleMods.has(other.constructor) &&
1378
- !other.incompatibleMods.has(this.constructor));
1328
+ return true;
1329
+ }
1330
+ /**
1331
+ * Determines whether {@link other} is an instance of any of the given {@link Mod} types.
1332
+ *
1333
+ * This is a convenience method for {@link isCompatibleWith} overrides that need to exclude a
1334
+ * fixed set of {@link Mod} types.
1335
+ *
1336
+ * @param other The {@link Mod} to check.
1337
+ * @param types The {@link Mod} types to check {@link other} against.
1338
+ */
1339
+ isInstanceOfAny(other, ...types) {
1340
+ return types.some((type) => other instanceof type);
1379
1341
  }
1380
1342
  /**
1381
1343
  * Serializes this `Mod` to a `SerializedMod`.
@@ -1471,12 +1433,6 @@ class Mod {
1471
1433
  facilitatesAdjustment() {
1472
1434
  return "facilitateAdjustment" in this;
1473
1435
  }
1474
- /**
1475
- * Whether this `Mod` requires the original `BeatmapDifficulty` for conversion and processing.
1476
- */
1477
- requiresBeatmapDifficulty() {
1478
- return "applyFromBeatmapDifficulty" in this;
1479
- }
1480
1436
  /**
1481
1437
  * Compares this `Mod` to another `Mod` for equality.
1482
1438
  *
@@ -1515,287 +1471,699 @@ class Mod {
1515
1471
  }
1516
1472
 
1517
1473
  /**
1518
- * Represents a hitobject that can be nested within a slider.
1474
+ * Represents a `Mod` specific setting that is constrained to a boolean value.
1519
1475
  */
1520
- class SliderNestedHitObject extends HitObject {
1521
- constructor(values) {
1522
- super(values);
1523
- this.spanIndex = values.spanIndex;
1524
- this.spanStartTime = values.spanStartTime;
1525
- }
1526
- toString() {
1527
- return `Position: [${this.position.x.toString()}, ${this.position.y.toString()}], span index: ${this.spanIndex.toString()}, span start time: ${this.spanStartTime.toString()}`;
1476
+ class BooleanModSetting extends ModSetting {
1477
+ constructor() {
1478
+ super(...arguments);
1479
+ this.displayFormatter = (v) => v ? "Enabled" : "Disabled";
1528
1480
  }
1529
- }
1530
-
1531
- /**
1532
- * Represents the head of a slider.
1533
- */
1534
- class SliderHead extends SliderNestedHitObject {
1535
- constructor(values) {
1536
- super(Object.assign(Object.assign({}, values), { spanIndex: 0, spanStartTime: values.startTime }));
1481
+ load(settings) {
1482
+ if (this.key === null) {
1483
+ return;
1484
+ }
1485
+ const stored = settings[this.key];
1486
+ if (typeof stored === "boolean") {
1487
+ this.value = stored;
1488
+ }
1537
1489
  }
1538
1490
  }
1539
1491
 
1540
1492
  /**
1541
- * An empty `HitWindow` that does not have any hit windows.
1542
- *
1543
- * No time values are provided (meaning instantaneous hit or miss).
1493
+ * Represents the SuddenDeath mod.
1544
1494
  */
1545
- class EmptyHitWindow extends HitWindow {
1495
+ class ModSuddenDeath extends Mod {
1546
1496
  constructor() {
1547
- super(0);
1548
- }
1549
- get greatWindow() {
1550
- return 0;
1551
- }
1552
- get okWindow() {
1553
- return 0;
1554
- }
1555
- get mehWindow() {
1556
- return 0;
1497
+ super(...arguments);
1498
+ this.acronym = "SD";
1499
+ this.name = "Sudden Death";
1500
+ this.droidRanked = true;
1501
+ this.isDroidRelevant = true;
1502
+ this.osuRanked = true;
1503
+ this.isOsuRelevant = true;
1504
+ this.bitwise = 1 << 5;
1505
+ /**
1506
+ * Whether a miss on a slider's tail should also trigger a fail.
1507
+ */
1508
+ this.failOnSliderTail = new BooleanModSetting("Also fail when missing a slider tail", "failOnSliderTail", "Whether a miss on a slider's tail should also trigger a fail.", false);
1557
1509
  }
1558
- hitWindowFor() {
1559
- return 0;
1510
+ isCompatibleWith(other) {
1511
+ return (!this.isInstanceOfAny(other, ModNoFail, ModPerfect) &&
1512
+ super.isCompatibleWith(other));
1560
1513
  }
1561
1514
  }
1562
1515
 
1563
1516
  /**
1564
- * Represents a nested hit object that is at the end of a slider path (either repeat or tail).
1517
+ * Represents the NoFail mod.
1565
1518
  */
1566
- class SliderEndCircle extends SliderNestedHitObject {
1567
- constructor(values) {
1568
- super(values);
1569
- this.sliderSpanDuration = values.sliderSpanDuration;
1570
- this.sliderStartTime = values.sliderStartTime;
1571
- }
1572
- applyDefaults(controlPoints, difficulty, mode) {
1573
- super.applyDefaults(controlPoints, difficulty, mode);
1574
- if (this.spanIndex > 0) {
1575
- // Repeat points after the first span should appear behind the still-visible one.
1576
- this.timeFadeIn = 0;
1577
- // The next end circle should appear exactly after the previous circle (on the same end) is hit.
1578
- this.timePreempt = this.sliderSpanDuration * 2;
1579
- }
1580
- else {
1581
- // The first end circle should fade in with the slider.
1582
- this.timePreempt += this.startTime - this.sliderStartTime;
1583
- }
1519
+ class ModNoFail extends Mod {
1520
+ constructor() {
1521
+ super(...arguments);
1522
+ this.acronym = "NF";
1523
+ this.name = "NoFail";
1524
+ this.droidRanked = true;
1525
+ this.isDroidRelevant = true;
1526
+ this.osuRanked = true;
1527
+ this.isOsuRelevant = true;
1528
+ this.bitwise = 1 << 0;
1584
1529
  }
1585
- createHitWindow() {
1586
- return new EmptyHitWindow();
1530
+ isCompatibleWith(other) {
1531
+ return (!this.isInstanceOfAny(other, ModPerfect, ModSuddenDeath) &&
1532
+ super.isCompatibleWith(other));
1587
1533
  }
1588
1534
  }
1589
1535
 
1590
1536
  /**
1591
- * Represents a slider repeat.
1592
- */
1593
- class SliderRepeat extends SliderEndCircle {
1594
- }
1595
-
1596
- /**
1597
- * Represents a slider tick in a slider.
1537
+ * Represents the Perfect mod.
1598
1538
  */
1599
- class SliderTick extends SliderNestedHitObject {
1600
- applyDefaults(controlPoints, difficulty, mode) {
1601
- super.applyDefaults(controlPoints, difficulty, mode);
1602
- let offset;
1603
- if (this.spanIndex > 0) {
1604
- // Adding 200 to include the offset stable used.
1605
- // This is so on repeats ticks don't appear too late to be visually processed by the player.
1606
- offset = 200;
1607
- }
1608
- else {
1609
- offset = this.timePreempt * 0.66;
1610
- }
1611
- this.timePreempt = (this.startTime - this.spanStartTime) / 2 + offset;
1539
+ class ModPerfect extends Mod {
1540
+ constructor() {
1541
+ super(...arguments);
1542
+ this.acronym = "PF";
1543
+ this.name = "Perfect";
1544
+ this.droidRanked = true;
1545
+ this.isDroidRelevant = true;
1546
+ this.osuRanked = true;
1547
+ this.isOsuRelevant = true;
1548
+ this.bitwise = 1 << 14;
1612
1549
  }
1613
- createHitWindow() {
1614
- return new EmptyHitWindow();
1550
+ isCompatibleWith(other) {
1551
+ return (!this.isInstanceOfAny(other, ModNoFail, ModSuddenDeath) &&
1552
+ super.isCompatibleWith(other));
1615
1553
  }
1616
1554
  }
1617
1555
 
1618
1556
  /**
1619
- * Represents the tail of a slider.
1620
- */
1621
- class SliderTail extends SliderEndCircle {
1622
- }
1623
-
1624
- /**
1625
- * Describes a value that can be cached.
1557
+ * Represents a `Mod` specific setting that is constrained to a range of values.
1626
1558
  */
1627
- class Cached {
1559
+ class RangeConstrainedModSetting extends ModSetting {
1628
1560
  /**
1629
- * The cached value.
1561
+ * The minimum value of this `RangeConstrainedModSetting`.
1630
1562
  */
1631
- get value() {
1632
- if (!this._isValid) {
1633
- throw new Error("May not query value of an invalid cache.");
1634
- }
1635
- return this._value;
1563
+ get min() {
1564
+ return this._min;
1636
1565
  }
1637
- /**
1638
- * The cached value.
1639
- */
1640
- set value(value) {
1641
- this._value = value;
1642
- this._isValid = true;
1566
+ set min(value) {
1567
+ this._min = value;
1568
+ this.value = this.processValue(this.value);
1643
1569
  }
1644
1570
  /**
1645
- * Whether the cache is valid.
1571
+ * The maximum value of this `RangeConstrainedModSetting`.
1646
1572
  */
1647
- get isValid() {
1648
- return this._isValid;
1573
+ get max() {
1574
+ return this._max;
1649
1575
  }
1650
- constructor(value) {
1651
- this._isValid = true;
1652
- this._value = value;
1576
+ set max(value) {
1577
+ this._max = value;
1578
+ this.value = this.processValue(this.value);
1653
1579
  }
1654
1580
  /**
1655
- * Invalidates the cache of this `Cached`.
1656
- *
1657
- * @return `true` if the cache was invalidated from a valid state.
1581
+ * The step size of this `RangeConstrainedModSetting`.
1658
1582
  */
1659
- invalidate() {
1660
- if (this._isValid) {
1661
- this._isValid = false;
1662
- return true;
1663
- }
1664
- return false;
1583
+ get step() {
1584
+ return this._step;
1665
1585
  }
1666
- }
1667
-
1668
- /**
1669
- * Represents a gameplay hit sample that is meant to be played sequentially at specific times.
1670
- */
1671
- class SequenceHitSampleInfo {
1672
- /**
1673
- * Whether this `SequenceHitSampleInfo` contains no `TimedHitSampleInfo`s.
1674
- */
1675
- get isEmpty() {
1676
- return this.samples.length === 0;
1586
+ set step(value) {
1587
+ this._step = value;
1588
+ this.value = this.processValue(this.value);
1677
1589
  }
1678
- constructor(samples) {
1679
- this.samples = samples;
1590
+ get value() {
1591
+ return super.value;
1592
+ }
1593
+ set value(value) {
1594
+ super.value = this.processValue(value);
1595
+ }
1596
+ constructor(name, key, description, defaultValue, min, max, step) {
1597
+ super(name, key, description, defaultValue);
1598
+ this._min = min;
1599
+ this._max = max;
1600
+ this._step = step;
1601
+ }
1602
+ }
1603
+
1604
+ /**
1605
+ * Represents a `Mod` specific setting that is constrained to a number of values.
1606
+ */
1607
+ class NumberModSetting extends RangeConstrainedModSetting {
1608
+ constructor(name, key, description, defaultValue, min, max, step) {
1609
+ super(name, key, description, defaultValue, min, max, step);
1610
+ this.displayFormatter = (v) => v.toString();
1611
+ if (min > max) {
1612
+ throw new RangeError(`The minimum value (${min.toString()}) must be less than or equal to the maximum value (${max.toString()}).`);
1613
+ }
1614
+ if (step < 0) {
1615
+ throw new RangeError(`The step size (${step.toString()}) must be greater than or equal to 0.`);
1616
+ }
1617
+ if (defaultValue < min || defaultValue > max) {
1618
+ throw new RangeError(`The default value (${defaultValue.toString()}) must be between the minimum (${min.toString()}) and maximum (${max.toString()}) values.`);
1619
+ }
1620
+ }
1621
+ load(settings) {
1622
+ if (this.key === null) {
1623
+ return;
1624
+ }
1625
+ const stored = settings[this.key];
1626
+ if (typeof stored === "number") {
1627
+ this.value = stored;
1628
+ }
1680
1629
  }
1630
+ processValue(value) {
1631
+ const stepped = this.step > 0
1632
+ ? Math.round(value / this.step) * this.step
1633
+ : value;
1634
+ return MathUtils.clamp(stepped, this.min, this.max);
1635
+ }
1636
+ }
1637
+
1638
+ /**
1639
+ * Represents a `Mod` specific setting that is constrained to a range of decimal values.
1640
+ */
1641
+ class DecimalModSetting extends NumberModSetting {
1681
1642
  /**
1682
- * Obtains the `TimedHitSampleInfo` to play at a given time.
1643
+ * The number of decimal places to round the value to.
1683
1644
  *
1684
- * @param time The time, in milliseconds.
1685
- * @return The `TimedHitSampleInfo` to play at the given time,
1686
- * or `null` if no `TimedHitSampleInfo`s should be played.
1645
+ * When set to `null`, the value will not be rounded.
1687
1646
  */
1688
- sampleAt(time) {
1689
- if (this.isEmpty || time < this.samples[0].time) {
1690
- return null;
1647
+ get precision() {
1648
+ return this._precision;
1649
+ }
1650
+ set precision(value) {
1651
+ if (value !== null && value < 0) {
1652
+ throw new RangeError(`The precision (${value.toString()}) must be greater than or equal to 0.`);
1691
1653
  }
1692
- const lastSample = this.samples[this.samples.length - 1];
1693
- if (time >= lastSample.time) {
1694
- return lastSample;
1654
+ this._precision = value;
1655
+ if (value !== null) {
1656
+ this.value = this.processValue(this.value);
1695
1657
  }
1696
- let l = 0;
1697
- let r = this.samples.length - 2;
1698
- while (l <= r) {
1699
- const pivot = l + ((r - l) >> 1);
1700
- const sample = this.samples[pivot];
1701
- if (sample.time < time) {
1702
- l = pivot + 1;
1703
- }
1704
- else if (sample.time > time) {
1705
- r = pivot - 1;
1706
- }
1707
- else {
1708
- return sample;
1658
+ }
1659
+ constructor(name, key, description, defaultValue, min = -Number.MAX_VALUE, max = Number.MAX_VALUE, step = 0, precision = null) {
1660
+ super(name, key, description, defaultValue, min, max, step);
1661
+ this.displayFormatter = (v) => {
1662
+ if (this.precision !== null) {
1663
+ return v.toFixed(this.precision);
1709
1664
  }
1665
+ return super.toDisplayString();
1666
+ };
1667
+ if (precision !== null && precision < 0) {
1668
+ throw new RangeError(`The precision (${precision.toString()}) must be greater than or equal to 0.`);
1710
1669
  }
1711
- // l will be the first sample with time > sample.time, but we want the one before it
1712
- return this.samples[l - 1];
1670
+ this._precision = precision;
1671
+ }
1672
+ processValue(value) {
1673
+ const processedValue = super.processValue(value);
1674
+ if (this.precision !== null) {
1675
+ return parseFloat(processedValue.toFixed(this.precision));
1676
+ }
1677
+ return processedValue;
1713
1678
  }
1714
1679
  }
1715
1680
 
1716
1681
  /**
1717
- * A `HitSampleInfo` that has a time associated with it.
1682
+ * Represents a `Mod` specific setting that is constrained to one of a fixed set of enum-like values.
1683
+ *
1684
+ * Values are serialized by their index within {@link entries} to match the format used by osu!droid's
1685
+ * `EnumModSetting`.
1718
1686
  */
1719
- class TimedHitSampleInfo {
1720
- constructor(time, sample) {
1721
- this.time = time;
1722
- this.sample = sample;
1687
+ class EnumModSetting extends ModSetting {
1688
+ constructor(name, key, description, defaultValue, entries, displayFormatter) {
1689
+ super(name, key, description, defaultValue);
1690
+ this.entries = entries;
1691
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
1692
+ this.displayFormatter = displayFormatter !== null && displayFormatter !== void 0 ? displayFormatter : ((v) => `${v}`);
1693
+ }
1694
+ load(settings) {
1695
+ if (this.key === null) {
1696
+ return;
1697
+ }
1698
+ const stored = settings[this.key];
1699
+ if (typeof stored === "number" && this.entries[stored] !== undefined) {
1700
+ this.value = this.entries[stored];
1701
+ }
1702
+ }
1703
+ save(settings) {
1704
+ if (this.key !== null) {
1705
+ settings[this.key] = this.entries.indexOf(this.value);
1706
+ }
1723
1707
  }
1724
1708
  }
1725
1709
 
1726
1710
  /**
1727
- * Represents a custom gameplay hit sample that can be loaded from files.
1711
+ * The mode of accuracy that triggers a failure in {@link ModAccuracyChallenge}.
1728
1712
  */
1729
- class FileHitSampleInfo extends HitSampleInfo {
1730
- get lookupNames() {
1731
- const names = [];
1732
- names.push(this.filename);
1733
- // Fallback to file name without extension.
1734
- const extensionIndex = this.filename.lastIndexOf(".");
1735
- if (extensionIndex !== -1) {
1736
- names.push(this.filename.substring(0, extensionIndex));
1737
- }
1738
- return names;
1713
+ exports.AccuracyMode = void 0;
1714
+ (function (AccuracyMode) {
1715
+ AccuracyMode[AccuracyMode["MaximumAchievable"] = 0] = "MaximumAchievable";
1716
+ AccuracyMode[AccuracyMode["Standard"] = 1] = "Standard";
1717
+ })(exports.AccuracyMode || (exports.AccuracyMode = {}));
1718
+ /**
1719
+ * Represents the Accuracy Challenge mod.
1720
+ */
1721
+ class ModAccuracyChallenge extends Mod {
1722
+ constructor() {
1723
+ super(...arguments);
1724
+ this.acronym = "AC";
1725
+ this.name = "Accuracy Challenge";
1726
+ this.osuRanked = true;
1727
+ this.isOsuRelevant = true;
1728
+ this.osuScoreMultiplier = 1;
1729
+ /**
1730
+ * Trigger a failure if accuracy goes below this value.
1731
+ */
1732
+ this.minimumAccuracy = new DecimalModSetting("Minimum accuracy", "minimumAccuracy", "Trigger a failure if your accuracy goes below this value.", 0.9, 0.6, 0.999, 0.001, 3);
1733
+ /**
1734
+ * The mode of accuracy that will trigger failure.
1735
+ */
1736
+ this.accuracyJudgeMode = new EnumModSetting("Accuracy mode", "accuracyJudgeMode", "The mode of accuracy that will trigger failure.", exports.AccuracyMode.MaximumAchievable, [exports.AccuracyMode.MaximumAchievable, exports.AccuracyMode.Standard], (v) => exports.AccuracyMode[v]);
1739
1737
  }
1740
- constructor(filename, volume = 0) {
1741
- super(volume);
1742
- this.filename = filename;
1738
+ isCompatibleWith(other) {
1739
+ return (!this.isInstanceOfAny(other, ModPerfect) &&
1740
+ super.isCompatibleWith(other));
1743
1741
  }
1744
1742
  }
1745
1743
 
1746
1744
  /**
1747
- * Represents a slider in a beatmap.
1745
+ * Represents the Relax mod.
1748
1746
  */
1749
- class Slider extends HitObject {
1750
- get position() {
1751
- return super.position;
1747
+ class ModRelax extends Mod {
1748
+ constructor() {
1749
+ super(...arguments);
1750
+ this.acronym = "RX";
1751
+ this.name = "Relax";
1752
+ this.droidRanked = false;
1753
+ this.isDroidRelevant = true;
1754
+ this.osuRanked = false;
1755
+ this.isOsuRelevant = true;
1756
+ this.bitwise = 1 << 7;
1752
1757
  }
1753
- set position(value) {
1754
- super.position = value;
1755
- this.updateNestedPositions();
1758
+ isCompatibleWith(other) {
1759
+ return (!this.isInstanceOfAny(other, ModAuto, ModAutopilot) &&
1760
+ super.isCompatibleWith(other));
1756
1761
  }
1757
- get endTime() {
1758
- return (this.startTime + (this.spanCount * this.distance) / this.velocity);
1762
+ }
1763
+
1764
+ /**
1765
+ * Represents the Autopilot mod.
1766
+ */
1767
+ class ModAutopilot extends Mod {
1768
+ constructor() {
1769
+ super(...arguments);
1770
+ this.acronym = "AP";
1771
+ this.name = "Autopilot";
1772
+ this.droidRanked = false;
1773
+ this.isDroidRelevant = true;
1774
+ this.osuRanked = false;
1775
+ this.isOsuRelevant = true;
1776
+ this.bitwise = 1 << 13;
1759
1777
  }
1760
- get endPosition() {
1761
- if (!this.endPositionCache.isValid) {
1762
- this.endPositionCache.value = this.position.add(this.curvePositionAt(1));
1763
- }
1764
- return this.endPositionCache.value;
1778
+ isCompatibleWith(other) {
1779
+ return (!this.isInstanceOfAny(other, ModRelax, ModAuto) &&
1780
+ super.isCompatibleWith(other));
1765
1781
  }
1766
- /**
1767
- * The slider's path.
1768
- */
1769
- get path() {
1770
- return this._path;
1782
+ }
1783
+
1784
+ /**
1785
+ * Represents the Auto mod.
1786
+ */
1787
+ class ModAuto extends Mod {
1788
+ constructor() {
1789
+ super(...arguments);
1790
+ this.acronym = "AT";
1791
+ this.name = "Autoplay";
1792
+ this.droidRanked = false;
1793
+ this.isDroidRelevant = true;
1794
+ this.osuRanked = false;
1795
+ this.isOsuRelevant = true;
1796
+ this.bitwise = 1 << 11;
1771
1797
  }
1772
- /**
1773
- * The slider's path.
1774
- */
1775
- set path(value) {
1776
- this._path = value;
1777
- this.updateNestedPositions();
1798
+ isCompatibleWith(other) {
1799
+ return (!this.isInstanceOfAny(other, ModAutopilot, ModRelax) &&
1800
+ super.isCompatibleWith(other));
1778
1801
  }
1779
- /**
1780
- * The slider's velocity.
1781
- */
1782
- get velocity() {
1783
- return this._velocity;
1802
+ }
1803
+
1804
+ /**
1805
+ * Represents the Single Tap mod.
1806
+ */
1807
+ class ModSingleTap extends Mod {
1808
+ constructor() {
1809
+ super(...arguments);
1810
+ this.acronym = "SG";
1811
+ this.name = "Single Tap";
1812
+ this.osuRanked = true;
1813
+ this.isOsuRelevant = true;
1814
+ this.osuScoreMultiplier = 1;
1784
1815
  }
1785
- /**
1786
- * The distance of this slider.
1787
- */
1788
- get distance() {
1789
- return this.path.expectedDistance;
1816
+ isCompatibleWith(other) {
1817
+ return (!this.isInstanceOfAny(other, ModAuto, ModRelax, ModAlternate) &&
1818
+ super.isCompatibleWith(other));
1790
1819
  }
1791
- /**
1792
- * The amount of times this slider repeats.
1793
- */
1794
- get repeatCount() {
1795
- return this._repeatCount;
1820
+ }
1821
+
1822
+ /**
1823
+ * Represents the Alternate mod.
1824
+ */
1825
+ class ModAlternate extends Mod {
1826
+ constructor() {
1827
+ super(...arguments);
1828
+ this.acronym = "AL";
1829
+ this.name = "Alternate";
1830
+ this.osuRanked = true;
1831
+ this.isOsuRelevant = true;
1832
+ this.osuScoreMultiplier = 1;
1796
1833
  }
1797
- /**
1798
- * The amount of times this slider repeats.
1834
+ isCompatibleWith(other) {
1835
+ return (!this.isInstanceOfAny(other, ModAuto, ModRelax, ModSingleTap) &&
1836
+ super.isCompatibleWith(other));
1837
+ }
1838
+ }
1839
+
1840
+ /**
1841
+ * Types of easing.
1842
+ *
1843
+ * See {@link http://easings.net/ this} page for more samples.
1844
+ */
1845
+ exports.Easing = void 0;
1846
+ (function (Easing) {
1847
+ Easing[Easing["None"] = 0] = "None";
1848
+ Easing[Easing["Out"] = 1] = "Out";
1849
+ Easing[Easing["In"] = 2] = "In";
1850
+ Easing[Easing["InQuad"] = 3] = "InQuad";
1851
+ Easing[Easing["OutQuad"] = 4] = "OutQuad";
1852
+ Easing[Easing["InOutQuad"] = 5] = "InOutQuad";
1853
+ Easing[Easing["InCubic"] = 6] = "InCubic";
1854
+ Easing[Easing["OutCubic"] = 7] = "OutCubic";
1855
+ Easing[Easing["InOutCubic"] = 8] = "InOutCubic";
1856
+ Easing[Easing["InQuart"] = 9] = "InQuart";
1857
+ Easing[Easing["OutQuart"] = 10] = "OutQuart";
1858
+ Easing[Easing["InOutQuart"] = 11] = "InOutQuart";
1859
+ Easing[Easing["InQuint"] = 12] = "InQuint";
1860
+ Easing[Easing["OutQuint"] = 13] = "OutQuint";
1861
+ Easing[Easing["InOutQuint"] = 14] = "InOutQuint";
1862
+ Easing[Easing["InSine"] = 15] = "InSine";
1863
+ Easing[Easing["OutSine"] = 16] = "OutSine";
1864
+ Easing[Easing["InOutSine"] = 17] = "InOutSine";
1865
+ Easing[Easing["InExpo"] = 18] = "InExpo";
1866
+ Easing[Easing["OutExpo"] = 19] = "OutExpo";
1867
+ Easing[Easing["InOutExpo"] = 20] = "InOutExpo";
1868
+ Easing[Easing["InCirc"] = 21] = "InCirc";
1869
+ Easing[Easing["OutCirc"] = 22] = "OutCirc";
1870
+ Easing[Easing["InOutCirc"] = 23] = "InOutCirc";
1871
+ Easing[Easing["InElastic"] = 24] = "InElastic";
1872
+ Easing[Easing["OutElastic"] = 25] = "OutElastic";
1873
+ Easing[Easing["OutElasticHalf"] = 26] = "OutElasticHalf";
1874
+ Easing[Easing["OutElasticQuarter"] = 27] = "OutElasticQuarter";
1875
+ Easing[Easing["InOutElastic"] = 28] = "InOutElastic";
1876
+ Easing[Easing["InBack"] = 29] = "InBack";
1877
+ Easing[Easing["OutBack"] = 30] = "OutBack";
1878
+ Easing[Easing["InOutBack"] = 31] = "InOutBack";
1879
+ Easing[Easing["InBounce"] = 32] = "InBounce";
1880
+ Easing[Easing["OutBounce"] = 33] = "OutBounce";
1881
+ Easing[Easing["InOutBounce"] = 34] = "InOutBounce";
1882
+ Easing[Easing["OutPow10"] = 35] = "OutPow10";
1883
+ })(exports.Easing || (exports.Easing = {}));
1884
+
1885
+ /**
1886
+ * Represents a hitobject that can be nested within a slider.
1887
+ */
1888
+ class SliderNestedHitObject extends HitObject {
1889
+ constructor(values) {
1890
+ super(values);
1891
+ this.spanIndex = values.spanIndex;
1892
+ this.spanStartTime = values.spanStartTime;
1893
+ }
1894
+ toString() {
1895
+ return `Position: [${this.position.x.toString()}, ${this.position.y.toString()}], span index: ${this.spanIndex.toString()}, span start time: ${this.spanStartTime.toString()}`;
1896
+ }
1897
+ }
1898
+
1899
+ /**
1900
+ * Represents the head of a slider.
1901
+ */
1902
+ class SliderHead extends SliderNestedHitObject {
1903
+ constructor(values) {
1904
+ super(Object.assign(Object.assign({}, values), { spanIndex: 0, spanStartTime: values.startTime }));
1905
+ }
1906
+ }
1907
+
1908
+ /**
1909
+ * An empty `HitWindow` that does not have any hit windows.
1910
+ *
1911
+ * No time values are provided (meaning instantaneous hit or miss).
1912
+ */
1913
+ class EmptyHitWindow extends HitWindow {
1914
+ constructor() {
1915
+ super(0);
1916
+ }
1917
+ get greatWindow() {
1918
+ return 0;
1919
+ }
1920
+ get okWindow() {
1921
+ return 0;
1922
+ }
1923
+ get mehWindow() {
1924
+ return 0;
1925
+ }
1926
+ hitWindowFor() {
1927
+ return 0;
1928
+ }
1929
+ }
1930
+
1931
+ /**
1932
+ * Represents a nested hit object that is at the end of a slider path (either repeat or tail).
1933
+ */
1934
+ class SliderEndCircle extends SliderNestedHitObject {
1935
+ constructor(values) {
1936
+ super(values);
1937
+ this.sliderSpanDuration = values.sliderSpanDuration;
1938
+ this.sliderStartTime = values.sliderStartTime;
1939
+ }
1940
+ applyDefaults(controlPoints, difficulty, mode) {
1941
+ super.applyDefaults(controlPoints, difficulty, mode);
1942
+ if (this.spanIndex > 0) {
1943
+ // Repeat points after the first span should appear behind the still-visible one.
1944
+ this.timeFadeIn = 0;
1945
+ // The next end circle should appear exactly after the previous circle (on the same end) is hit.
1946
+ this.timePreempt = this.sliderSpanDuration * 2;
1947
+ }
1948
+ else {
1949
+ // The first end circle should fade in with the slider.
1950
+ this.timePreempt += this.startTime - this.sliderStartTime;
1951
+ }
1952
+ }
1953
+ createHitWindow() {
1954
+ return new EmptyHitWindow();
1955
+ }
1956
+ }
1957
+
1958
+ /**
1959
+ * Represents a slider repeat.
1960
+ */
1961
+ class SliderRepeat extends SliderEndCircle {
1962
+ }
1963
+
1964
+ /**
1965
+ * Represents a slider tick in a slider.
1966
+ */
1967
+ class SliderTick extends SliderNestedHitObject {
1968
+ applyDefaults(controlPoints, difficulty, mode) {
1969
+ super.applyDefaults(controlPoints, difficulty, mode);
1970
+ let offset;
1971
+ if (this.spanIndex > 0) {
1972
+ // Adding 200 to include the offset stable used.
1973
+ // This is so on repeats ticks don't appear too late to be visually processed by the player.
1974
+ offset = 200;
1975
+ }
1976
+ else {
1977
+ offset = this.timePreempt * 0.66;
1978
+ }
1979
+ this.timePreempt = (this.startTime - this.spanStartTime) / 2 + offset;
1980
+ }
1981
+ createHitWindow() {
1982
+ return new EmptyHitWindow();
1983
+ }
1984
+ }
1985
+
1986
+ /**
1987
+ * Represents the tail of a slider.
1988
+ */
1989
+ class SliderTail extends SliderEndCircle {
1990
+ }
1991
+
1992
+ /**
1993
+ * Describes a value that can be cached.
1994
+ */
1995
+ class Cached {
1996
+ /**
1997
+ * The cached value.
1998
+ */
1999
+ get value() {
2000
+ if (!this._isValid) {
2001
+ throw new Error("May not query value of an invalid cache.");
2002
+ }
2003
+ return this._value;
2004
+ }
2005
+ /**
2006
+ * The cached value.
2007
+ */
2008
+ set value(value) {
2009
+ this._value = value;
2010
+ this._isValid = true;
2011
+ }
2012
+ /**
2013
+ * Whether the cache is valid.
2014
+ */
2015
+ get isValid() {
2016
+ return this._isValid;
2017
+ }
2018
+ constructor(value) {
2019
+ this._isValid = true;
2020
+ this._value = value;
2021
+ }
2022
+ /**
2023
+ * Invalidates the cache of this `Cached`.
2024
+ *
2025
+ * @return `true` if the cache was invalidated from a valid state.
2026
+ */
2027
+ invalidate() {
2028
+ if (this._isValid) {
2029
+ this._isValid = false;
2030
+ return true;
2031
+ }
2032
+ return false;
2033
+ }
2034
+ }
2035
+
2036
+ /**
2037
+ * Represents a gameplay hit sample that is meant to be played sequentially at specific times.
2038
+ */
2039
+ class SequenceHitSampleInfo {
2040
+ /**
2041
+ * Whether this `SequenceHitSampleInfo` contains no `TimedHitSampleInfo`s.
2042
+ */
2043
+ get isEmpty() {
2044
+ return this.samples.length === 0;
2045
+ }
2046
+ constructor(samples) {
2047
+ this.samples = samples;
2048
+ }
2049
+ /**
2050
+ * Obtains the `TimedHitSampleInfo` to play at a given time.
2051
+ *
2052
+ * @param time The time, in milliseconds.
2053
+ * @return The `TimedHitSampleInfo` to play at the given time,
2054
+ * or `null` if no `TimedHitSampleInfo`s should be played.
2055
+ */
2056
+ sampleAt(time) {
2057
+ if (this.isEmpty || time < this.samples[0].time) {
2058
+ return null;
2059
+ }
2060
+ const lastSample = this.samples[this.samples.length - 1];
2061
+ if (time >= lastSample.time) {
2062
+ return lastSample;
2063
+ }
2064
+ let l = 0;
2065
+ let r = this.samples.length - 2;
2066
+ while (l <= r) {
2067
+ const pivot = l + ((r - l) >> 1);
2068
+ const sample = this.samples[pivot];
2069
+ if (sample.time < time) {
2070
+ l = pivot + 1;
2071
+ }
2072
+ else if (sample.time > time) {
2073
+ r = pivot - 1;
2074
+ }
2075
+ else {
2076
+ return sample;
2077
+ }
2078
+ }
2079
+ // l will be the first sample with time > sample.time, but we want the one before it
2080
+ return this.samples[l - 1];
2081
+ }
2082
+ }
2083
+
2084
+ /**
2085
+ * A `HitSampleInfo` that has a time associated with it.
2086
+ */
2087
+ class TimedHitSampleInfo {
2088
+ constructor(time, sample) {
2089
+ this.time = time;
2090
+ this.sample = sample;
2091
+ }
2092
+ }
2093
+
2094
+ /**
2095
+ * Represents a custom gameplay hit sample that can be loaded from files.
2096
+ */
2097
+ class FileHitSampleInfo extends HitSampleInfo {
2098
+ get lookupNames() {
2099
+ const names = [];
2100
+ names.push(this.filename);
2101
+ // Fallback to file name without extension.
2102
+ const extensionIndex = this.filename.lastIndexOf(".");
2103
+ if (extensionIndex !== -1) {
2104
+ names.push(this.filename.substring(0, extensionIndex));
2105
+ }
2106
+ return names;
2107
+ }
2108
+ constructor(filename, volume = 0) {
2109
+ super(volume);
2110
+ this.filename = filename;
2111
+ }
2112
+ }
2113
+
2114
+ /**
2115
+ * Represents a slider in a beatmap.
2116
+ */
2117
+ class Slider extends HitObject {
2118
+ get position() {
2119
+ return super.position;
2120
+ }
2121
+ set position(value) {
2122
+ super.position = value;
2123
+ this.updateNestedPositions();
2124
+ }
2125
+ get endTime() {
2126
+ return (this.startTime + (this.spanCount * this.distance) / this.velocity);
2127
+ }
2128
+ get endPosition() {
2129
+ if (!this.endPositionCache.isValid) {
2130
+ this.endPositionCache.value = this.position.add(this.curvePositionAt(1));
2131
+ }
2132
+ return this.endPositionCache.value;
2133
+ }
2134
+ /**
2135
+ * The slider's path.
2136
+ */
2137
+ get path() {
2138
+ return this._path;
2139
+ }
2140
+ /**
2141
+ * The slider's path.
2142
+ */
2143
+ set path(value) {
2144
+ this._path = value;
2145
+ this.updateNestedPositions();
2146
+ }
2147
+ /**
2148
+ * The slider's velocity.
2149
+ */
2150
+ get velocity() {
2151
+ return this._velocity;
2152
+ }
2153
+ /**
2154
+ * The distance of this slider.
2155
+ */
2156
+ get distance() {
2157
+ return this.path.expectedDistance;
2158
+ }
2159
+ /**
2160
+ * The amount of times this slider repeats.
2161
+ */
2162
+ get repeatCount() {
2163
+ return this._repeatCount;
2164
+ }
2165
+ /**
2166
+ * The amount of times this slider repeats.
1799
2167
  */
1800
2168
  set repeatCount(value) {
1801
2169
  this._repeatCount = Math.max(0, value);
@@ -2143,36 +2511,17 @@ Slider.legacyLastTickOffset = 36;
2143
2511
  */
2144
2512
  class ModTraceable extends Mod {
2145
2513
  constructor() {
2146
- super();
2514
+ super(...arguments);
2147
2515
  this.acronym = "TC";
2148
2516
  this.name = "Traceable";
2149
2517
  this.droidRanked = false;
2150
2518
  this.isDroidRelevant = true;
2151
- this.droidScoreMultiplier = 1.06;
2152
- this.migrationDroidScoreMultiplier = 1.06;
2153
2519
  this.osuRanked = true;
2154
2520
  this.isOsuRelevant = true;
2155
- this.osuScoreMultiplier = 1;
2156
- this.incompatibleMods.add(ModHidden);
2157
2521
  }
2158
- }
2159
-
2160
- /**
2161
- * Represents a `Mod` specific setting that is constrained to a boolean value.
2162
- */
2163
- class BooleanModSetting extends ModSetting {
2164
- constructor() {
2165
- super(...arguments);
2166
- this.displayFormatter = (v) => v ? "Enabled" : "Disabled";
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
- }
2522
+ isCompatibleWith(other) {
2523
+ return (!this.isInstanceOfAny(other, ModHidden) &&
2524
+ super.isCompatibleWith(other));
2176
2525
  }
2177
2526
  }
2178
2527
 
@@ -2180,14 +2529,8 @@ class BooleanModSetting extends ModSetting {
2180
2529
  * Represents the Hidden mod.
2181
2530
  */
2182
2531
  class ModHidden extends Mod {
2183
- get droidRanked() {
2184
- return this.usesDefaultSettings;
2185
- }
2186
- get osuRanked() {
2187
- return this.usesDefaultSettings;
2188
- }
2189
2532
  constructor() {
2190
- super();
2533
+ super(...arguments);
2191
2534
  this.acronym = "HD";
2192
2535
  this.name = "Hidden";
2193
2536
  this.isDroidRelevant = true;
@@ -2199,200 +2542,74 @@ class ModHidden extends Mod {
2199
2542
  * The main object body will not fade when enabled.
2200
2543
  */
2201
2544
  this.onlyFadeApproachCircles = new BooleanModSetting("Only fade approach circles", "onlyFadeApproachCircles", "The main object body will not fade when enabled.", false);
2202
- this.incompatibleMods
2203
- .add(ModTraceable)
2204
- .add(ModApproachDifferent)
2205
- .add(ModFreezeFrame);
2206
- }
2207
- get droidScoreMultiplier() {
2208
- return this.usesDefaultSettings ? 1.06 : 1;
2209
- }
2210
- get migrationDroidScoreMultiplier() {
2211
- return this.droidScoreMultiplier;
2212
- }
2213
- get osuScoreMultiplier() {
2214
- return this.usesDefaultSettings ? 1.06 : 1;
2215
- }
2216
- applyToBeatmap(beatmap) {
2217
- const applyFadeInAdjustment = (hitObject) => {
2218
- hitObject.timeFadeIn =
2219
- hitObject.timePreempt * ModHidden.fadeInDurationMultiplier;
2220
- if (hitObject instanceof Slider) {
2221
- hitObject.nestedHitObjects.forEach(applyFadeInAdjustment);
2222
- }
2223
- };
2224
- beatmap.hitObjects.objects.forEach(applyFadeInAdjustment);
2225
- }
2226
- toString() {
2227
- if (!this.onlyFadeApproachCircles.value) {
2228
- return super.toString();
2229
- }
2230
- return `${super.toString()} (approach circles only)`;
2231
- }
2232
- }
2233
- ModHidden.fadeInDurationMultiplier = 0.4;
2234
- ModHidden.fadeOutDurationMultiplier = 0.3;
2235
-
2236
- /**
2237
- * Represents the Freeze Frame mod.
2238
- */
2239
- class ModFreezeFrame extends Mod {
2240
- constructor() {
2241
- super();
2242
- this.name = "Freeze Frame";
2243
- this.acronym = "FR";
2244
- this.droidRanked = false;
2245
- this.isDroidRelevant = true;
2246
- this.droidScoreMultiplier = 1;
2247
- this.migrationDroidScoreMultiplier = 1;
2248
- this.osuRanked = false;
2249
- this.isOsuRelevant = true;
2250
- this.osuScoreMultiplier = 1;
2251
- this.lastNewComboTime = 0;
2252
- this.incompatibleMods.add(ModApproachDifferent).add(ModHidden);
2253
- }
2254
- applyToBeatmap(beatmap) {
2255
- this.lastNewComboTime = 0;
2256
- for (const hitObject of beatmap.hitObjects) {
2257
- if (hitObject.isNewCombo) {
2258
- this.lastNewComboTime = hitObject.startTime;
2259
- }
2260
- this.applyFadeInAdjustment(hitObject);
2261
- }
2262
2545
  }
2263
- applyFadeInAdjustment(hitObject) {
2264
- hitObject.timePreempt += hitObject.startTime - this.lastNewComboTime;
2265
- if (hitObject instanceof Slider) {
2266
- // Freezing slider ticks doesn't play well with snaking sliders, and slider repeats will not
2267
- // layer correctly if its preempt is changed.
2268
- this.applyFadeInAdjustment(hitObject.head);
2269
- this.applyFadeInAdjustment(hitObject.tail);
2270
- }
2271
- }
2272
- }
2273
-
2274
- /**
2275
- * Represents a `Mod` specific setting that is constrained to a range of values.
2276
- */
2277
- class RangeConstrainedModSetting extends ModSetting {
2278
- /**
2279
- * The minimum value of this `RangeConstrainedModSetting`.
2280
- */
2281
- get min() {
2282
- return this._min;
2283
- }
2284
- set min(value) {
2285
- this._min = value;
2286
- this.value = this.processValue(this.value);
2287
- }
2288
- /**
2289
- * The maximum value of this `RangeConstrainedModSetting`.
2290
- */
2291
- get max() {
2292
- return this._max;
2293
- }
2294
- set max(value) {
2295
- this._max = value;
2296
- this.value = this.processValue(this.value);
2297
- }
2298
- /**
2299
- * The step size of this `RangeConstrainedModSetting`.
2300
- */
2301
- get step() {
2302
- return this._step;
2303
- }
2304
- set step(value) {
2305
- this._step = value;
2306
- this.value = this.processValue(this.value);
2307
- }
2308
- get value() {
2309
- return super.value;
2310
- }
2311
- set value(value) {
2312
- super.value = this.processValue(value);
2313
- }
2314
- constructor(name, key, description, defaultValue, min, max, step) {
2315
- super(name, key, description, defaultValue);
2316
- this._min = min;
2317
- this._max = max;
2318
- this._step = step;
2546
+ get droidRanked() {
2547
+ return this.usesDefaultSettings;
2319
2548
  }
2320
- }
2321
-
2322
- /**
2323
- * Represents a `Mod` specific setting that is constrained to a number of values.
2324
- */
2325
- class NumberModSetting extends RangeConstrainedModSetting {
2326
- constructor(name, key, description, defaultValue, min, max, step) {
2327
- super(name, key, description, defaultValue, min, max, step);
2328
- this.displayFormatter = (v) => v.toString();
2329
- if (min > max) {
2330
- throw new RangeError(`The minimum value (${min.toString()}) must be less than or equal to the maximum value (${max.toString()}).`);
2331
- }
2332
- if (step < 0) {
2333
- throw new RangeError(`The step size (${step.toString()}) must be greater than or equal to 0.`);
2334
- }
2335
- if (defaultValue < min || defaultValue > max) {
2336
- throw new RangeError(`The default value (${defaultValue.toString()}) must be between the minimum (${min.toString()}) and maximum (${max.toString()}) values.`);
2337
- }
2549
+ get osuRanked() {
2550
+ return this.usesDefaultSettings;
2338
2551
  }
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
- }
2552
+ isCompatibleWith(other) {
2553
+ return (!this.isInstanceOfAny(other, ModTraceable, ModApproachDifferent, ModFreezeFrame) && super.isCompatibleWith(other));
2347
2554
  }
2348
- processValue(value) {
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);
2555
+ applyToBeatmap(beatmap) {
2556
+ const applyFadeInAdjustment = (hitObject) => {
2557
+ // Sliders keep their default fade-in time to match osu!stable.
2558
+ if (!(hitObject instanceof Slider)) {
2559
+ hitObject.timeFadeIn =
2560
+ hitObject.timePreempt * ModHidden.fadeInDurationMultiplier;
2561
+ }
2562
+ if (hitObject instanceof Slider) {
2563
+ hitObject.nestedHitObjects.forEach(applyFadeInAdjustment);
2564
+ }
2565
+ };
2566
+ beatmap.hitObjects.objects.forEach(applyFadeInAdjustment);
2567
+ }
2568
+ toString() {
2569
+ if (!this.onlyFadeApproachCircles.value) {
2570
+ return super.toString();
2571
+ }
2572
+ return `${super.toString()} (approach circles only)`;
2353
2573
  }
2354
2574
  }
2575
+ ModHidden.fadeInDurationMultiplier = 0.4;
2576
+ ModHidden.fadeOutDurationMultiplier = 0.3;
2355
2577
 
2356
2578
  /**
2357
- * Represents a `Mod` specific setting that is constrained to a range of decimal values.
2579
+ * Represents the Freeze Frame mod.
2358
2580
  */
2359
- class DecimalModSetting extends NumberModSetting {
2360
- /**
2361
- * The number of decimal places to round the value to.
2362
- *
2363
- * When set to `null`, the value will not be rounded.
2364
- */
2365
- get precision() {
2366
- return this._precision;
2581
+ class ModFreezeFrame extends Mod {
2582
+ constructor() {
2583
+ super(...arguments);
2584
+ this.name = "Freeze Frame";
2585
+ this.acronym = "FR";
2586
+ this.droidRanked = false;
2587
+ this.isDroidRelevant = true;
2588
+ this.osuRanked = false;
2589
+ this.isOsuRelevant = true;
2590
+ this.lastNewComboTime = 0;
2367
2591
  }
2368
- set precision(value) {
2369
- if (value !== null && value < 0) {
2370
- throw new RangeError(`The precision (${value.toString()}) must be greater than or equal to 0.`);
2371
- }
2372
- this._precision = value;
2373
- if (value !== null) {
2374
- this.value = this.processValue(this.value);
2375
- }
2592
+ isCompatibleWith(other) {
2593
+ return (!this.isInstanceOfAny(other, ModApproachDifferent, ModHidden) &&
2594
+ super.isCompatibleWith(other));
2376
2595
  }
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);
2379
- this.displayFormatter = (v) => {
2380
- if (this.precision !== null) {
2381
- return v.toFixed(this.precision);
2596
+ applyToBeatmap(beatmap) {
2597
+ this.lastNewComboTime = 0;
2598
+ for (const hitObject of beatmap.hitObjects) {
2599
+ if (hitObject.isNewCombo) {
2600
+ this.lastNewComboTime = hitObject.startTime;
2382
2601
  }
2383
- return super.toDisplayString();
2384
- };
2385
- if (precision !== null && precision < 0) {
2386
- throw new RangeError(`The precision (${precision.toString()}) must be greater than or equal to 0.`);
2602
+ this.applyFadeInAdjustment(hitObject);
2387
2603
  }
2388
- this._precision = precision;
2389
2604
  }
2390
- processValue(value) {
2391
- const processedValue = super.processValue(value);
2392
- if (this.precision !== null) {
2393
- return parseFloat(processedValue.toFixed(this.precision));
2605
+ applyFadeInAdjustment(hitObject) {
2606
+ hitObject.timePreempt += hitObject.startTime - this.lastNewComboTime;
2607
+ if (hitObject instanceof Slider) {
2608
+ // Freezing slider ticks doesn't play well with snaking sliders, and slider repeats will not
2609
+ // layer correctly if its preempt is changed.
2610
+ this.applyFadeInAdjustment(hitObject.head);
2611
+ this.applyFadeInAdjustment(hitObject.tail);
2394
2612
  }
2395
- return processedValue;
2396
2613
  }
2397
2614
  }
2398
2615
 
@@ -2400,6 +2617,34 @@ class DecimalModSetting extends NumberModSetting {
2400
2617
  * Represents the Approach Different mod.
2401
2618
  */
2402
2619
  class ModApproachDifferent extends Mod {
2620
+ constructor() {
2621
+ super(...arguments);
2622
+ this.name = "Approach Different";
2623
+ this.acronym = "AD";
2624
+ this.droidRanked = false;
2625
+ this.isDroidRelevant = true;
2626
+ this.osuRanked = false;
2627
+ this.isOsuRelevant = true;
2628
+ /**
2629
+ * The initial size of the approach circle, relative to hit circles.
2630
+ */
2631
+ 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);
2632
+ /**
2633
+ * The animation style of the approach circles.
2634
+ */
2635
+ this.style = new EnumModSetting("Style", "style", "The animation style of the approach circles.", exports.AnimationStyle.Gravity, [
2636
+ exports.AnimationStyle.Linear,
2637
+ exports.AnimationStyle.Gravity,
2638
+ exports.AnimationStyle.InOut1,
2639
+ exports.AnimationStyle.InOut2,
2640
+ exports.AnimationStyle.Accelerate1,
2641
+ exports.AnimationStyle.Accelerate2,
2642
+ exports.AnimationStyle.Accelerate3,
2643
+ exports.AnimationStyle.Decelerate1,
2644
+ exports.AnimationStyle.Decelerate2,
2645
+ exports.AnimationStyle.Decelerate3,
2646
+ ], (v) => exports.AnimationStyle[v]);
2647
+ }
2403
2648
  /**
2404
2649
  * The {@link Easing} to apply to the approach circle animation.
2405
2650
  */
@@ -2427,26 +2672,9 @@ class ModApproachDifferent extends Mod {
2427
2672
  return exports.Easing.OutQuint;
2428
2673
  }
2429
2674
  }
2430
- constructor() {
2431
- super();
2432
- this.name = "Approach Different";
2433
- this.acronym = "AD";
2434
- this.droidRanked = false;
2435
- this.droidScoreMultiplier = 1;
2436
- this.migrationDroidScoreMultiplier = 1;
2437
- this.isDroidRelevant = true;
2438
- this.osuRanked = false;
2439
- this.isOsuRelevant = true;
2440
- this.osuScoreMultiplier = 1;
2441
- /**
2442
- * The initial size of the approach circle, relative to hit circles.
2443
- */
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);
2445
- /**
2446
- * The animation style of the approach circles.
2447
- */
2448
- this.style = new ModSetting("Style", "style", "The animation style of the approach circles.", exports.AnimationStyle.Gravity);
2449
- this.incompatibleMods.add(ModHidden).add(ModFreezeFrame);
2675
+ isCompatibleWith(other) {
2676
+ return (!this.isInstanceOfAny(other, ModHidden, ModFreezeFrame) &&
2677
+ super.isCompatibleWith(other));
2450
2678
  }
2451
2679
  }
2452
2680
  exports.AnimationStyle = void 0;
@@ -2464,86 +2692,164 @@ exports.AnimationStyle = void 0;
2464
2692
  })(exports.AnimationStyle || (exports.AnimationStyle = {}));
2465
2693
 
2466
2694
  /**
2467
- * Represents the Relax mod.
2695
+ * Represents the Magnetised mod.
2468
2696
  */
2469
- class ModRelax extends Mod {
2697
+ class ModMagnetised extends Mod {
2470
2698
  constructor() {
2471
- super();
2472
- this.acronym = "RX";
2473
- this.name = "Relax";
2474
- this.droidRanked = false;
2475
- this.isDroidRelevant = true;
2476
- this.droidScoreMultiplier = 0.001;
2477
- this.migrationDroidScoreMultiplier = 0.001;
2699
+ super(...arguments);
2700
+ this.acronym = "MG";
2701
+ this.name = "Magnetised";
2702
+ this.osuScoreMultiplier = 0.5;
2478
2703
  this.osuRanked = false;
2479
2704
  this.isOsuRelevant = true;
2480
- this.osuScoreMultiplier = 0;
2481
- this.bitwise = 1 << 7;
2482
- this.incompatibleMods.add(ModAuto).add(ModAutopilot);
2705
+ /**
2706
+ * How strong the pull is.
2707
+ */
2708
+ this.attractionStrength = new DecimalModSetting("Attraction Strength", "attractionStrength", "How strong the pull is.", 0.5, 0.05, 1, 0.05, 2);
2483
2709
  }
2484
2710
  }
2485
2711
 
2486
2712
  /**
2487
- * Represents the Autopilot mod.
2713
+ * Represents the Depth mod.
2488
2714
  */
2489
- class ModAutopilot extends Mod {
2715
+ class ModDepth extends Mod {
2490
2716
  constructor() {
2491
- super();
2492
- this.acronym = "AP";
2493
- this.name = "Autopilot";
2494
- this.droidRanked = false;
2495
- this.isDroidRelevant = true;
2496
- this.droidScoreMultiplier = 0.001;
2497
- this.migrationDroidScoreMultiplier = 0.001;
2717
+ super(...arguments);
2718
+ this.acronym = "DP";
2719
+ this.name = "Depth";
2498
2720
  this.osuRanked = false;
2499
2721
  this.isOsuRelevant = true;
2500
- this.osuScoreMultiplier = 0;
2501
- this.bitwise = 1 << 13;
2502
- this.incompatibleMods.add(ModRelax).add(ModAuto);
2722
+ this.osuScoreMultiplier = 1;
2723
+ /**
2724
+ * How far away objects appear.
2725
+ */
2726
+ this.maxDepth = new DecimalModSetting("Maximum depth", "maxDepth", "How far away objects appear.", 100, 50, 200, 10, 0);
2727
+ /**
2728
+ * Whether approach circles should be visible.
2729
+ */
2730
+ this.showApproachCircles = new BooleanModSetting("Show Approach Circles", "showApproachCircles", "Whether approach circles should be visible.", true);
2731
+ }
2732
+ isCompatibleWith(other) {
2733
+ return (!this.isInstanceOfAny(other, ModMagnetised, ModRepel, ModFreezeFrame) && super.isCompatibleWith(other));
2503
2734
  }
2504
2735
  }
2505
2736
 
2506
2737
  /**
2507
- * Represents the Auto mod.
2738
+ * Represents the Wiggle mod.
2508
2739
  */
2509
- class ModAuto extends Mod {
2740
+ class ModWiggle extends Mod {
2510
2741
  constructor() {
2511
- super();
2512
- this.acronym = "AT";
2513
- this.name = "Autoplay";
2514
- this.droidRanked = false;
2515
- this.isDroidRelevant = true;
2516
- this.droidScoreMultiplier = 1;
2517
- this.migrationDroidScoreMultiplier = 1;
2742
+ super(...arguments);
2743
+ this.acronym = "WG";
2744
+ this.name = "Wiggle";
2518
2745
  this.osuRanked = false;
2519
2746
  this.isOsuRelevant = true;
2520
2747
  this.osuScoreMultiplier = 1;
2521
- this.bitwise = 1 << 11;
2522
- this.incompatibleMods.add(ModAutopilot).add(ModRelax);
2748
+ /**
2749
+ * Multiplier applied to the wiggling strength.
2750
+ */
2751
+ this.strength = new DecimalModSetting("Strength", "strength", "Multiplier applied to the wiggling strength.", 1, 0.1, 2, 0.1, 1);
2752
+ }
2753
+ isCompatibleWith(other) {
2754
+ return (!this.isInstanceOfAny(other, ModTransform, ModMagnetised, ModRepel, ModDepth) && super.isCompatibleWith(other));
2523
2755
  }
2524
2756
  }
2525
2757
 
2526
2758
  /**
2527
- * Represents the Flashlight mod.
2759
+ * Represents the Transform mod.
2528
2760
  */
2529
- class ModFlashlight extends Mod {
2530
- get droidRanked() {
2531
- return this.usesDefaultSettings;
2761
+ class ModTransform extends Mod {
2762
+ constructor() {
2763
+ super(...arguments);
2764
+ this.acronym = "TR";
2765
+ this.name = "Transform";
2766
+ this.osuRanked = false;
2767
+ this.isOsuRelevant = true;
2768
+ this.osuScoreMultiplier = 1;
2532
2769
  }
2533
- get droidScoreMultiplier() {
2534
- return this.usesDefaultSettings ? 1.12 : 1;
2770
+ isCompatibleWith(other) {
2771
+ return (!this.isInstanceOfAny(other, ModWiggle, ModMagnetised, ModRepel, ModFreezeFrame, ModDepth) && super.isCompatibleWith(other));
2535
2772
  }
2536
- get migrationDroidScoreMultiplier() {
2537
- return this.droidScoreMultiplier;
2773
+ }
2774
+
2775
+ /**
2776
+ * Represents the Repel mod.
2777
+ */
2778
+ class ModRepel extends Mod {
2779
+ constructor() {
2780
+ super(...arguments);
2781
+ this.acronym = "RP";
2782
+ this.name = "Repel";
2783
+ this.osuRanked = false;
2784
+ this.isOsuRelevant = true;
2785
+ this.osuScoreMultiplier = 1;
2786
+ /**
2787
+ * How strong the repulsion is.
2788
+ */
2789
+ this.repulsionStrength = new DecimalModSetting("Repulsion strength", "repulsionStrength", "How strong the repulsion is.", 0.5, 0.05, 1, 0.05, 2);
2538
2790
  }
2539
- get osuRanked() {
2540
- return this.usesDefaultSettings;
2791
+ isCompatibleWith(other) {
2792
+ return (!this.isInstanceOfAny(other, ModAutopilot, ModWiggle, ModTransform, ModAuto, ModMagnetised, ModBubbles, ModDepth) && super.isCompatibleWith(other));
2541
2793
  }
2542
- get osuScoreMultiplier() {
2543
- return this.usesDefaultSettings ? 1.12 : 1;
2794
+ }
2795
+
2796
+ /**
2797
+ * Represents the Bubbles mod.
2798
+ */
2799
+ class ModBubbles extends Mod {
2800
+ constructor() {
2801
+ super(...arguments);
2802
+ this.acronym = "BU";
2803
+ this.name = "Bubbles";
2804
+ this.osuRanked = false;
2805
+ this.isOsuRelevant = true;
2806
+ this.osuScoreMultiplier = 1;
2544
2807
  }
2808
+ isCompatibleWith(other) {
2809
+ return (!this.isInstanceOfAny(other, ModBarrelRoll, ModMagnetised, ModRepel) && super.isCompatibleWith(other));
2810
+ }
2811
+ }
2812
+
2813
+ /**
2814
+ * The direction of rotation of {@link ModBarrelRoll}.
2815
+ */
2816
+ exports.RotationDirection = void 0;
2817
+ (function (RotationDirection) {
2818
+ RotationDirection[RotationDirection["Clockwise"] = 0] = "Clockwise";
2819
+ RotationDirection[RotationDirection["Counterclockwise"] = 1] = "Counterclockwise";
2820
+ })(exports.RotationDirection || (exports.RotationDirection = {}));
2821
+ /**
2822
+ * Represents the Barrel Roll mod.
2823
+ */
2824
+ class ModBarrelRoll extends Mod {
2545
2825
  constructor() {
2546
- super();
2826
+ super(...arguments);
2827
+ this.acronym = "BR";
2828
+ this.name = "Barrel Roll";
2829
+ this.osuRanked = false;
2830
+ this.isOsuRelevant = true;
2831
+ this.osuScoreMultiplier = 1;
2832
+ /**
2833
+ * Rotations per minute.
2834
+ */
2835
+ this.spinSpeed = new DecimalModSetting("Roll speed", "spinSpeed", "Rotations per minute", 0.5, 0.02, 12, 0.01, 2);
2836
+ /**
2837
+ * The direction of rotation.
2838
+ */
2839
+ this.direction = new EnumModSetting("Direction", "direction", "The direction of rotation", exports.RotationDirection.Clockwise, [exports.RotationDirection.Clockwise, exports.RotationDirection.Counterclockwise], (v) => exports.RotationDirection[v]);
2840
+ }
2841
+ isCompatibleWith(other) {
2842
+ return (!this.isInstanceOfAny(other, ModBubbles) &&
2843
+ super.isCompatibleWith(other));
2844
+ }
2845
+ }
2846
+
2847
+ /**
2848
+ * Represents the Flashlight mod.
2849
+ */
2850
+ class ModFlashlight extends Mod {
2851
+ constructor() {
2852
+ super(...arguments);
2547
2853
  this.acronym = "FL";
2548
2854
  this.name = "Flashlight";
2549
2855
  this.isDroidRelevant = true;
@@ -2561,7 +2867,16 @@ class ModFlashlight extends Mod {
2561
2867
  * Whether to decrease the Flashlight size as combo increases.
2562
2868
  */
2563
2869
  this.comboBasedSize = new BooleanModSetting("Change size based on combo", "comboBasedSize", "Whether to decrease the Flashlight size as combo increases.", true);
2564
- this.incompatibleMods.add(ModBlinds);
2870
+ }
2871
+ get droidRanked() {
2872
+ return this.usesDefaultSettings;
2873
+ }
2874
+ get osuRanked() {
2875
+ return this.usesDefaultSettings;
2876
+ }
2877
+ isCompatibleWith(other) {
2878
+ return (!this.isInstanceOfAny(other, ModBlinds) &&
2879
+ super.isCompatibleWith(other));
2565
2880
  }
2566
2881
  toString() {
2567
2882
  if (this.usesDefaultSettings) {
@@ -2590,163 +2905,280 @@ ModFlashlight.defaultFollowDelay = 0.12;
2590
2905
  */
2591
2906
  class ModBlinds extends Mod {
2592
2907
  constructor() {
2593
- super();
2908
+ super(...arguments);
2594
2909
  this.acronym = "BL";
2595
2910
  this.name = "Blinds";
2596
2911
  this.osuRanked = true;
2597
2912
  this.isOsuRelevant = true;
2598
2913
  this.osuScoreMultiplier = 1.12;
2599
- this.incompatibleMods.add(ModFlashlight);
2914
+ }
2915
+ isCompatibleWith(other) {
2916
+ return (!this.isInstanceOfAny(other, ModFlashlight) &&
2917
+ super.isCompatibleWith(other));
2600
2918
  }
2601
2919
  }
2602
2920
 
2603
2921
  /**
2604
- * Helper class for `Mod`s related to track rate adjustments.
2922
+ * Represents a `Mod` specific setting that is constrained to a range of integer values.
2605
2923
  */
2606
- class ModRateAdjustHelper {
2607
- /**
2608
- * The osu!droid score multiplier of this `Mod`.
2609
- */
2610
- get droidScoreMultiplier() {
2611
- return this.trackRateMultiplier >= 1
2612
- ? 1 + (this.trackRateMultiplier - 1) * 0.24
2613
- : Math.pow(0.3, (1 - this.trackRateMultiplier) * 4);
2924
+ class IntegerModSetting extends NumberModSetting {
2925
+ constructor(name, key, description, defaultValue, min = -2147483648, max = 2147483647) {
2926
+ super(name, key, description, defaultValue, min, max, 1);
2614
2927
  }
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;
2928
+ }
2929
+
2930
+ /**
2931
+ * Represents the No Scope mod.
2932
+ */
2933
+ class ModNoScope extends Mod {
2934
+ constructor() {
2935
+ super(...arguments);
2936
+ this.acronym = "NS";
2937
+ this.name = "No Scope";
2938
+ this.osuRanked = true;
2939
+ this.isOsuRelevant = true;
2940
+ this.osuScoreMultiplier = 1;
2941
+ /**
2942
+ * The combo count at which the cursor becomes completely hidden.
2943
+ */
2944
+ this.hiddenComboCount = new IntegerModSetting("Hidden at combo", "hiddenComboCount", "The combo count at which the cursor becomes completely hidden", 10, 0, 50);
2625
2945
  }
2626
- constructor(trackRateMultiplier) {
2627
- this.trackRateMultiplier = trackRateMultiplier;
2946
+ isCompatibleWith(other) {
2947
+ return (!this.isInstanceOfAny(other, ModBloom) &&
2948
+ super.isCompatibleWith(other));
2628
2949
  }
2629
2950
  }
2630
2951
 
2631
2952
  /**
2632
- * Represents a `Mod` that adjusts the playback rate of a track.
2953
+ * Represents the TouchDevice mod.
2633
2954
  */
2634
- class ModRateAdjust extends Mod {
2635
- /**
2636
- * The generic osu!droid score multiplier of this `Mod`.
2637
- */
2638
- get droidScoreMultiplier() {
2639
- return new ModRateAdjustHelper(this.rate).droidScoreMultiplier;
2640
- }
2641
- /**
2642
- * The generic osu!droid migration score multiplier of this `Mod`.
2643
- */
2644
- get migrationDroidScoreMultiplier() {
2645
- return this.droidScoreMultiplier;
2955
+ class ModTouchDevice extends Mod {
2956
+ constructor() {
2957
+ super(...arguments);
2958
+ this.acronym = "TD";
2959
+ this.name = "Touch Device";
2960
+ this.osuRanked = true;
2961
+ this.bitwise = 1 << 2;
2962
+ this.isOsuRelevant = true;
2963
+ this.osuScoreMultiplier = 1;
2646
2964
  }
2647
- /**
2648
- * Generic getter to determine if this `ModRateAdjust` is relevant.
2649
- */
2650
- get isRelevant() {
2651
- return this.rate !== 1;
2965
+ }
2966
+
2967
+ /**
2968
+ * Represents the Bloom mod.
2969
+ */
2970
+ class ModBloom extends Mod {
2971
+ constructor() {
2972
+ super(...arguments);
2973
+ this.acronym = "BM";
2974
+ this.name = "Bloom";
2975
+ this.osuRanked = false;
2976
+ this.isOsuRelevant = true;
2977
+ this.osuScoreMultiplier = 1;
2978
+ /**
2979
+ * The combo count at which the cursor reaches its maximum size.
2980
+ */
2981
+ this.maxSizeComboCount = new IntegerModSetting("Max size at combo", "maxSizeComboCount", "The combo count at which the cursor reaches its maximum size", 50, 5, 100);
2982
+ /**
2983
+ * The multiplier applied to cursor size when combo reaches maximum.
2984
+ */
2985
+ this.maxCursorSize = new DecimalModSetting("Final size multiplier", "maxCursorSize", "The multiplier applied to cursor size when combo reaches maximum", 10, 5, 15, 0.5, 1);
2652
2986
  }
2653
- applyToRate(_, rate) {
2654
- return rate * this.rate;
2987
+ isCompatibleWith(other) {
2988
+ return (!this.isInstanceOfAny(other, ModFlashlight, ModNoScope, ModTouchDevice) && super.isCompatibleWith(other));
2655
2989
  }
2656
2990
  }
2657
2991
 
2658
2992
  /**
2659
- * Represents the Custom Speed mod.
2660
- *
2661
- * This is a replacement `Mod` for speed modify in osu!droid and custom rates in osu!lazer.
2993
+ * Represents the SpunOut mod.
2662
2994
  */
2663
- class ModCustomSpeed extends ModRateAdjust {
2664
- get rate() {
2665
- return this.trackRateMultiplier.value;
2995
+ class ModSpunOut extends Mod {
2996
+ constructor() {
2997
+ super(...arguments);
2998
+ this.acronym = "SO";
2999
+ this.name = "Spun Out";
3000
+ this.osuRanked = true;
3001
+ this.bitwise = 1 << 12;
3002
+ this.isOsuRelevant = true;
3003
+ this.osuScoreMultiplier = 0.9;
2666
3004
  }
2667
- get isDroidRelevant() {
2668
- return this.isRelevant;
3005
+ }
3006
+
3007
+ /**
3008
+ * Represents the Cinema mod.
3009
+ */
3010
+ class ModCinema extends Mod {
3011
+ constructor() {
3012
+ super(...arguments);
3013
+ this.acronym = "CN";
3014
+ this.name = "Cinema";
3015
+ this.osuRanked = false;
3016
+ this.isOsuRelevant = true;
3017
+ this.osuScoreMultiplier = 1;
2669
3018
  }
2670
- get droidScoreMultiplier() {
2671
- return super.droidScoreMultiplier;
3019
+ isCompatibleWith(other) {
3020
+ return (!this.isInstanceOfAny(other, ModAuto, ModNoFail, ModMagnetised, ModAutopilot, ModSpunOut, ModAlternate, ModSingleTap, ModRepel) && super.isCompatibleWith(other));
2672
3021
  }
2673
- get migrationDroidScoreMultiplier() {
2674
- return super.migrationDroidScoreMultiplier;
3022
+ }
3023
+
3024
+ /**
3025
+ * Represents a circle in a beatmap.
3026
+ *
3027
+ * All we need from circles is their position. All positions
3028
+ * stored in the objects are in playfield coordinates (512*384
3029
+ * rectangle).
3030
+ */
3031
+ class Circle extends HitObject {
3032
+ toString() {
3033
+ return `Position: [${this.position.x.toString()}, ${this.position.y.toString()}]`;
2675
3034
  }
2676
- get isOsuRelevant() {
2677
- return this.isRelevant;
3035
+ }
3036
+
3037
+ /**
3038
+ * Some utilities, no biggie.
3039
+ */
3040
+ class Utils {
3041
+ /**
3042
+ * Returns a random element of an array.
3043
+ *
3044
+ * @param array The array to get the element from.
3045
+ */
3046
+ static getRandomArrayElement(array) {
3047
+ return array[Math.floor(Math.random() * array.length)];
2678
3048
  }
2679
- get osuScoreMultiplier() {
2680
- // Round to the nearest multiple of 0.1.
2681
- let value = Math.trunc(this.trackRateMultiplier.value * 10) / 10;
2682
- // Offset back to 0.
2683
- --value;
2684
- return this.trackRateMultiplier.value >= 1
2685
- ? 1 + value / 5
2686
- : 0.6 + value;
3049
+ /**
3050
+ * Creates an array with specific length that's prefilled with an initial value.
3051
+ *
3052
+ * @param length The length of the array.
3053
+ * @param initialValue The initial value of each element, or a function that returns the initial value of each element.
3054
+ * @returns The array.
3055
+ */
3056
+ static initializeArray(length, initialValue) {
3057
+ const array = new Array(length);
3058
+ if (initialValue !== undefined) {
3059
+ for (let i = 0; i < length; ++i) {
3060
+ array[i] =
3061
+ typeof initialValue === "function"
3062
+ ? initialValue(i)
3063
+ : initialValue;
3064
+ }
3065
+ }
3066
+ return array;
2687
3067
  }
2688
- constructor(trackRateMultiplier = 1) {
2689
- super();
2690
- this.acronym = "CS";
2691
- this.name = "Custom Speed";
2692
- /**
2693
- * The setting to change the multiplier for the track's playback rate after applying this `ModCustomSpeed`.
2694
- */
2695
- 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);
2696
- this.droidRanked = true;
2697
- this.osuRanked = false;
2698
- this.trackRateMultiplier.value = trackRateMultiplier;
3068
+ /**
3069
+ * Performs a binary search on an array with a custom predicate function.
3070
+ *
3071
+ * The predicate function should return:
3072
+ * - a negative number if the element is less than the target,
3073
+ * - a positive number if the element is greater than the target, and
3074
+ * - 0 if the element is equal to the target.
3075
+ *
3076
+ * @param array The array to search through. Must be sorted according to the predicate function.
3077
+ * @param predicate The predicate function to determine the order of elements.
3078
+ * @returns The result of the binary search.
3079
+ */
3080
+ static binarySearch(array, predicate) {
3081
+ let left = 0;
3082
+ let right = array.length - 1;
3083
+ while (left <= right) {
3084
+ const mid = left + ((right - left) >> 1);
3085
+ const result = predicate(array[mid]);
3086
+ if (result === 0) {
3087
+ return { index: mid, found: true };
3088
+ }
3089
+ else if (result < 0) {
3090
+ left = mid + 1;
3091
+ }
3092
+ else {
3093
+ right = mid - 1;
3094
+ }
3095
+ }
3096
+ return { index: left, found: false };
2699
3097
  }
2700
- toString() {
2701
- return `${super.toString()} (${this.trackRateMultiplier.toDisplayString()}x)`;
3098
+ /**
3099
+ * Pauses the execution of a function for
3100
+ * the specified duration.
3101
+ *
3102
+ * @param duration The duration to pause for, in seconds.
3103
+ */
3104
+ static sleep(duration) {
3105
+ return new Promise((resolve) => setTimeout(resolve, duration * 1000));
2702
3106
  }
2703
3107
  }
2704
3108
 
2705
3109
  /**
2706
- * Represents a `Mod` that adjusts the size of `HitObject`s during their fade in animation.
3110
+ * A pseudo-random number generator that shares the same implementation with
3111
+ * {@link https://github.com/dotnet/runtime/blob/v9.0.4/src/libraries/System.Private.CoreLib/src/System/Random.Net5CompatImpl.cs .NET 5's `System.Random`}.
3112
+ *
3113
+ * Used in the Random mod to ensure that a seed generates the result that users expect.
2707
3114
  */
2708
- class ModObjectScaleTween extends Mod {
2709
- constructor() {
2710
- super();
2711
- /**
2712
- * The final size multiplier applied to all [HitObject]s.
2713
- */
2714
- this.endScale = 1;
2715
- this.incompatibleMods.add(ModObjectScaleTween).add(ModTraceable);
3115
+ class Random {
3116
+ /**
3117
+ * Constructs a new instance of the `Random` class using the specified seed.
3118
+ *
3119
+ * @param seed The seed to use for the random number generator. This value is clamped to the range [-2147483648, 2147483647] and must be an integer.
3120
+ */
3121
+ constructor(seed) {
3122
+ this.seedArray = Utils.initializeArray(56, 0);
3123
+ this.iNext = 0;
3124
+ this.iNextP = 21;
3125
+ seed = Math.trunc(seed);
3126
+ const subtraction = seed <= Random.MIN_VALUE ? Random.MAX_VALUE : Math.abs(seed);
3127
+ // Magic number based on Phi (golden ratio).
3128
+ let mj = 161803398 - subtraction;
3129
+ this.seedArray[55] = mj;
3130
+ let mk = 1;
3131
+ let ii = 0;
3132
+ for (let i = 1; i < 55; ++i) {
3133
+ // The range [1..55] is special (Knuth) and so we're wasting the 0'th position.
3134
+ ii = (21 * i) % 55;
3135
+ this.seedArray[ii] = mk;
3136
+ mk = mj - mk;
3137
+ if (mk < 0) {
3138
+ mk += Random.MAX_VALUE;
3139
+ }
3140
+ mj = this.seedArray[ii];
3141
+ }
3142
+ for (let k = 1; k < 5; ++k) {
3143
+ for (let i = 1; i < 56; ++i) {
3144
+ const n = (i + 30) % 55;
3145
+ this.seedArray[i] -= this.seedArray[n + 1];
3146
+ if (this.seedArray[i] < 0) {
3147
+ this.seedArray[i] += Random.MAX_VALUE;
3148
+ }
3149
+ }
3150
+ }
3151
+ }
3152
+ nextDouble() {
3153
+ return this.sample();
2716
3154
  }
2717
- }
2718
-
2719
- /**
2720
- * Represents the Deflate mod.
2721
- */
2722
- class ModDeflate extends ModObjectScaleTween {
2723
- constructor() {
2724
- super(...arguments);
2725
- this.name = "Deflate";
2726
- this.acronym = "DF";
2727
- this.droidRanked = false;
2728
- this.isDroidRelevant = true;
2729
- this.droidScoreMultiplier = 1;
2730
- this.migrationDroidScoreMultiplier = 1;
2731
- this.osuRanked = false;
2732
- this.isOsuRelevant = true;
2733
- this.osuScoreMultiplier = 1;
2734
- this.startScale = new DecimalModSetting("Start scale", "startScale", "The initial size multiplier applied to all hit objects.", 2, 1, 25, 0.1, 1);
3155
+ sample() {
3156
+ return this.internalSample() / 2147483647;
2735
3157
  }
2736
- }
2737
-
2738
- /**
2739
- * Represents a circle in a beatmap.
2740
- *
2741
- * All we need from circles is their position. All positions
2742
- * stored in the objects are in playfield coordinates (512*384
2743
- * rectangle).
2744
- */
2745
- class Circle extends HitObject {
2746
- toString() {
2747
- return `Position: [${this.position.x.toString()}, ${this.position.y.toString()}]`;
3158
+ internalSample() {
3159
+ let locINext = this.iNext;
3160
+ if (++locINext >= 56) {
3161
+ locINext = 1;
3162
+ }
3163
+ let locINextP = this.iNextP;
3164
+ if (++locINextP >= 56) {
3165
+ locINextP = 1;
3166
+ }
3167
+ let retVal = this.seedArray[locINext] - this.seedArray[locINextP];
3168
+ if (retVal === Random.MAX_VALUE) {
3169
+ --retVal;
3170
+ }
3171
+ if (retVal < 0) {
3172
+ retVal += Random.MAX_VALUE;
3173
+ }
3174
+ this.seedArray[locINext] = retVal;
3175
+ this.iNext = locINext;
3176
+ this.iNextP = locINextP;
3177
+ return retVal;
2748
3178
  }
2749
3179
  }
3180
+ Random.MIN_VALUE = -2147483648;
3181
+ Random.MAX_VALUE = 2147483647;
2750
3182
 
2751
3183
  var _a$1;
2752
3184
  /**
@@ -3956,44 +4388,26 @@ exports.Axes = void 0;
3956
4388
  Axes[Axes["Both"] = 3] = "Both";
3957
4389
  })(exports.Axes || (exports.Axes = {}));
3958
4390
 
3959
- // Serializes Axes as a 0-indexed ordinal to match the Kotlin EnumModSetting format:
3960
- // Axes.x (1) -> 0, Axes.y (2) -> 1, Axes.both (3) -> 2.
3961
- class AxesModSetting extends ModSetting {
3962
- load(settings) {
3963
- if (this.key === null) {
3964
- return;
3965
- }
3966
- const stored = settings[this.key];
3967
- if (typeof stored === "number") {
3968
- this.value = (stored + 1);
3969
- }
3970
- }
3971
- save(settings) {
3972
- if (this.key !== null) {
3973
- settings[this.key] = this.value - 1;
3974
- }
3975
- }
3976
- }
3977
4391
  /**
3978
4392
  * Represents the Mirror mod.
3979
4393
  */
3980
4394
  class ModMirror extends Mod {
3981
4395
  constructor() {
3982
- super();
4396
+ super(...arguments);
3983
4397
  this.name = "Mirror";
3984
4398
  this.acronym = "MR";
3985
4399
  this.droidRanked = false;
3986
4400
  this.isDroidRelevant = true;
3987
- this.droidScoreMultiplier = 1;
3988
- this.migrationDroidScoreMultiplier = 1;
3989
4401
  this.osuRanked = false;
3990
4402
  this.isOsuRelevant = true;
3991
- this.osuScoreMultiplier = 1;
3992
4403
  /**
3993
4404
  * The axes to reflect the `HitObject`s along.
3994
4405
  */
3995
- this.flippedAxes = new AxesModSetting("Flipped axes", "flippedAxes", "The axes to reflect the hit objects along.", exports.Axes.X);
3996
- this.incompatibleMods.add(ModHardRock);
4406
+ this.flippedAxes = new EnumModSetting("Flipped axes", "flippedAxes", "The axes to reflect the hit objects along.", exports.Axes.X, [exports.Axes.X, exports.Axes.Y, exports.Axes.Both]);
4407
+ }
4408
+ isCompatibleWith(other) {
4409
+ return (!this.isInstanceOfAny(other, ModHardRock) &&
4410
+ super.isCompatibleWith(other));
3997
4411
  }
3998
4412
  applyToHitObject(_, hitObject) {
3999
4413
  switch (this.flippedAxes.value) {
@@ -4040,8 +4454,6 @@ class ModReplayV6 extends Mod {
4040
4454
  this.userPlayable = false;
4041
4455
  this.droidRanked = false;
4042
4456
  this.isDroidRelevant = true;
4043
- this.droidScoreMultiplier = 1;
4044
- this.migrationDroidScoreMultiplier = 1;
4045
4457
  this.facilitateAdjustment = true;
4046
4458
  }
4047
4459
  applyToBeatmap(beatmap) {
@@ -4082,19 +4494,14 @@ class ModReplayV6 extends Mod {
4082
4494
  */
4083
4495
  class ModHardRock extends Mod {
4084
4496
  constructor() {
4085
- super();
4497
+ super(...arguments);
4086
4498
  this.acronym = "HR";
4087
- this.name = "HardRock";
4499
+ this.name = "Hard Rock";
4088
4500
  this.droidRanked = true;
4089
4501
  this.isDroidRelevant = true;
4090
- this.droidScoreMultiplier = 1.06;
4091
- this.migrationDroidScoreMultiplier = 1.06;
4092
4502
  this.osuRanked = true;
4093
4503
  this.isOsuRelevant = true;
4094
- this.osuScoreMultiplier = 1.06;
4095
4504
  this.bitwise = 1 << 4;
4096
- this.incompatibleMods.add(ModEasy);
4097
- this.incompatibleMods.add(ModMirror);
4098
4505
  }
4099
4506
  applyToDifficulty(mode, difficulty, adjustmentMods) {
4100
4507
  if (mode === exports.Modes.Osu || !adjustmentMods.has(ModReplayV6)) {
@@ -4120,7 +4527,8 @@ class ModHardRock extends Mod {
4120
4527
  other.od.value === null ||
4121
4528
  other.hp.value === null);
4122
4529
  }
4123
- return super.isCompatibleWith(other);
4530
+ return (!this.isInstanceOfAny(other, ModEasy, ModMirror) &&
4531
+ super.isCompatibleWith(other));
4124
4532
  }
4125
4533
  applySetting(value, ratio = 1.4) {
4126
4534
  return Math.min(value * ratio, 10);
@@ -4132,18 +4540,18 @@ class ModHardRock extends Mod {
4132
4540
  */
4133
4541
  class ModEasy extends Mod {
4134
4542
  constructor() {
4135
- super();
4543
+ super(...arguments);
4136
4544
  this.acronym = "EZ";
4137
4545
  this.name = "Easy";
4138
4546
  this.droidRanked = true;
4139
4547
  this.isDroidRelevant = true;
4140
- this.droidScoreMultiplier = 0.5;
4141
- this.migrationDroidScoreMultiplier = 0.5;
4142
4548
  this.osuRanked = true;
4143
4549
  this.isOsuRelevant = true;
4144
- this.osuScoreMultiplier = 0.5;
4145
4550
  this.bitwise = 1 << 1;
4146
- this.incompatibleMods.add(ModHardRock);
4551
+ /**
4552
+ * The amount of extra lives to give the player.
4553
+ */
4554
+ this.retries = new IntegerModSetting("Extra Lives", "retries", "Number of extra lives", 2, 0, 10);
4147
4555
  }
4148
4556
  applyToDifficulty(mode, difficulty, adjustmentMods) {
4149
4557
  if (mode === exports.Modes.Osu || !adjustmentMods.has(ModReplayV6)) {
@@ -4166,7 +4574,64 @@ class ModEasy extends Mod {
4166
4574
  other.od.value === null ||
4167
4575
  other.hp.value === null);
4168
4576
  }
4169
- return super.isCompatibleWith(other);
4577
+ return (!this.isInstanceOfAny(other, ModHardRock) &&
4578
+ super.isCompatibleWith(other));
4579
+ }
4580
+ }
4581
+
4582
+ /**
4583
+ * Represents a `Mod` that adjusts the playback rate of a track.
4584
+ */
4585
+ class ModRateAdjust extends Mod {
4586
+ /**
4587
+ * Generic getter to determine if this `ModRateAdjust` is relevant.
4588
+ */
4589
+ get isRelevant() {
4590
+ return this.rate !== 1;
4591
+ }
4592
+ applyToRate(_, rate) {
4593
+ return rate * this.rate;
4594
+ }
4595
+ }
4596
+
4597
+ /**
4598
+ * Represents the Custom Speed mod.
4599
+ *
4600
+ * This is a replacement `Mod` for speed modify in osu!droid and custom rates in osu!lazer.
4601
+ */
4602
+ class ModCustomSpeed extends ModRateAdjust {
4603
+ get rate() {
4604
+ return this.trackRateMultiplier.value;
4605
+ }
4606
+ get isDroidRelevant() {
4607
+ return this.isRelevant;
4608
+ }
4609
+ get isOsuRelevant() {
4610
+ return this.isRelevant;
4611
+ }
4612
+ get osuScoreMultiplier() {
4613
+ // Round to the nearest multiple of 0.1.
4614
+ let value = Math.trunc(this.trackRateMultiplier.value * 10) / 10;
4615
+ // Offset back to 0.
4616
+ --value;
4617
+ return this.trackRateMultiplier.value >= 1
4618
+ ? 1 + value / 5
4619
+ : 0.6 + value;
4620
+ }
4621
+ constructor(trackRateMultiplier = 1) {
4622
+ super();
4623
+ this.acronym = "CS";
4624
+ this.name = "Custom Speed";
4625
+ /**
4626
+ * The setting to change the multiplier for the track's playback rate after applying this `ModCustomSpeed`.
4627
+ */
4628
+ 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);
4629
+ this.droidRanked = true;
4630
+ this.osuRanked = false;
4631
+ this.trackRateMultiplier.value = trackRateMultiplier;
4632
+ }
4633
+ toString() {
4634
+ return `${super.toString()} (${this.trackRateMultiplier.toDisplayString()}x)`;
4170
4635
  }
4171
4636
  }
4172
4637
 
@@ -4180,8 +4645,6 @@ class ModReallyEasy extends Mod {
4180
4645
  this.name = "Really Easy";
4181
4646
  this.droidRanked = false;
4182
4647
  this.isDroidRelevant = true;
4183
- this.droidScoreMultiplier = 0.4;
4184
- this.migrationDroidScoreMultiplier = 0.4;
4185
4648
  }
4186
4649
  applyToDifficultyWithMods(mode, difficulty, mods) {
4187
4650
  var _a;
@@ -4236,11 +4699,9 @@ class ModSmallCircle extends Mod {
4236
4699
  constructor() {
4237
4700
  super(...arguments);
4238
4701
  this.acronym = "SC";
4239
- this.name = "SmallCircle";
4702
+ this.name = "Small Circle";
4240
4703
  this.droidRanked = false;
4241
4704
  this.isDroidRelevant = true;
4242
- this.droidScoreMultiplier = 1;
4243
- this.migrationDroidScoreMultiplier = 1;
4244
4705
  }
4245
4706
  migrateDroidMod(difficulty) {
4246
4707
  return new ModDifficultyAdjust({ cs: difficulty.cs + 4 });
@@ -4341,25 +4802,24 @@ class NullableDecimalModSetting extends RangeConstrainedModSetting {
4341
4802
  }
4342
4803
 
4343
4804
  /**
4344
- * A `NullableDecimalModSetting` variant for `ModDifficultyAdjust` that embeds the beatmap's original
4345
- * difficulty value alongside the user's adjusted value in the serialized format:
4805
+ * A `NullableDecimalModSetting` variant for `ModDifficultyAdjust`.
4346
4806
  *
4347
- * `{ "adjusted": 7.0, "original": 4.0 }`
4807
+ * The serialized format is a plain scalar (e.g. `"cs": 7.0`), matching the game client.
4348
4808
  *
4349
- * When `originalValue` is non-null, the score multiplier can be computed from the serialized format
4350
- * alone, without a beatmap lookup. When `null`, `applyFromBeatmapDifficulty` must be called first.
4351
- *
4352
- * Legacy scalar values (e.g. `"cs": 7.0`) are accepted in `load` for backward compatibility.
4809
+ * The legacy `{ "adjusted": 7.0, "original": 4.0 }` object format is still accepted in `load` for
4810
+ * backward compatibility with old saved data. When present, `original` is used to set `defaultValue`
4811
+ * directly rather than being tracked separately.
4353
4812
  */
4354
4813
  class DifficultyAdjustModSetting extends NullableDecimalModSetting {
4355
4814
  constructor(name, key, description, min = -Number.MAX_VALUE, max = Number.MAX_VALUE, step = 0, precision = null) {
4356
4815
  super(name, key, description, null, min, max, step, precision);
4357
- /**
4358
- * The beatmap's original value for this setting, populated by `applyFromBeatmapDifficulty`.
4359
- *
4360
- * Non-null means the score multiplier is self-contained; `null` means a beatmap lookup is needed.
4361
- */
4362
- this.originalValue = null;
4816
+ }
4817
+ /**
4818
+ * "Default" means no override is active (`value` is `null`), regardless of what `defaultValue`
4819
+ * currently holds (which may be set to the beatmap's difficulty for UI hint display).
4820
+ */
4821
+ get isDefault() {
4822
+ return this.value === null;
4363
4823
  }
4364
4824
  load(settings) {
4365
4825
  if (this.key === null) {
@@ -4367,28 +4827,23 @@ class DifficultyAdjustModSetting extends NullableDecimalModSetting {
4367
4827
  }
4368
4828
  const data = settings[this.key];
4369
4829
  if (typeof data === "object" && data !== null) {
4830
+ // Legacy format. Kept for backward compatibility with old saved data.
4370
4831
  const { adjusted, original } = data;
4371
4832
  this.value = typeof adjusted === "number" ? adjusted : null;
4372
- const originalNum = typeof original === "number" ? original : null;
4373
- this.originalValue = originalNum;
4374
- if (originalNum !== null) {
4375
- this.defaultValue = originalNum;
4833
+ if (typeof original === "number") {
4834
+ this.defaultValue = original;
4376
4835
  }
4377
4836
  }
4378
- else if (typeof data === "number") {
4379
- // Legacy scalar format.
4380
- this.value = data;
4381
- this.originalValue = null;
4837
+ else {
4838
+ // New format: a plain scalar value (or null).
4839
+ super.load(settings);
4382
4840
  }
4383
4841
  }
4384
4842
  save(settings) {
4385
4843
  if (this.key === null || this.value === null) {
4386
4844
  return;
4387
4845
  }
4388
- settings[this.key] = {
4389
- adjusted: this.value,
4390
- original: this.originalValue,
4391
- };
4846
+ settings[this.key] = this.value;
4392
4847
  }
4393
4848
  }
4394
4849
 
@@ -4410,7 +4865,6 @@ class ModDifficultyAdjust extends Mod {
4410
4865
  this.droidRanked = false;
4411
4866
  this.osuRanked = false;
4412
4867
  this.isOsuRelevant = true;
4413
- this.osuScoreMultiplier = 1;
4414
4868
  /**
4415
4869
  * The circle size to enforce.
4416
4870
  */
@@ -4435,34 +4889,6 @@ class ModDifficultyAdjust extends Mod {
4435
4889
  get isDroidRelevant() {
4436
4890
  return this.isRelevant;
4437
4891
  }
4438
- get droidScoreMultiplier() {
4439
- // Graph: https://www.desmos.com/calculator/yrggkhrkzz
4440
- let multiplier = 1;
4441
- if (this.cs.value !== null && this.cs.defaultValue !== null) {
4442
- const diff = this.cs.value - this.cs.defaultValue;
4443
- multiplier *=
4444
- diff >= 0
4445
- ? 1 + 0.0075 * Math.pow(diff, 1.5)
4446
- : 2 / (1 + Math.exp(-0.5 * diff));
4447
- }
4448
- if (this.od.value !== null && this.od.defaultValue !== null) {
4449
- const diff = this.od.value - this.od.defaultValue;
4450
- multiplier *=
4451
- diff >= 0
4452
- ? 1 + 0.005 * Math.pow(diff, 1.3)
4453
- : 2 / (1 + Math.exp(-0.25 * diff));
4454
- }
4455
- return multiplier;
4456
- }
4457
- get migrationDroidScoreMultiplier() {
4458
- return this.droidScoreMultiplier;
4459
- }
4460
- applyFromBeatmapDifficulty(difficulty) {
4461
- this.cs.originalValue = difficulty.cs;
4462
- this.ar.originalValue = difficulty.ar;
4463
- this.od.originalValue = difficulty.od;
4464
- this.hp.originalValue = difficulty.hp;
4465
- }
4466
4892
  applyToDifficultyWithMods(_, difficulty, mods) {
4467
4893
  var _a, _b, _c, _d;
4468
4894
  difficulty.cs = (_a = this.cs.value) !== null && _a !== void 0 ? _a : difficulty.cs;
@@ -4546,600 +4972,735 @@ class ModDifficultyAdjust extends Mod {
4546
4972
  }
4547
4973
 
4548
4974
  /**
4549
- * Represents the NightCore mod.
4550
- */
4551
- class ModNightCore extends ModRateAdjust {
4552
- constructor() {
4553
- super();
4554
- this.acronym = "NC";
4555
- this.name = "NightCore";
4556
- this.droidRanked = true;
4557
- this.osuRanked = true;
4558
- this.osuScoreMultiplier = 1.12;
4559
- this.bitwise = 1 << 9;
4560
- this.rate = 1.5;
4561
- this.incompatibleMods.add(ModDoubleTime).add(ModHalfTime);
4562
- }
4563
- get isDroidRelevant() {
4564
- return this.isRelevant;
4565
- }
4566
- get droidScoreMultiplier() {
4567
- return super.droidScoreMultiplier;
4568
- }
4569
- get migrationDroidScoreMultiplier() {
4570
- return super.migrationDroidScoreMultiplier;
4571
- }
4572
- get isOsuRelevant() {
4573
- return this.isRelevant;
4574
- }
4575
- }
4576
-
4577
- /**
4578
- * Represents the HalfTime mod.
4579
- */
4580
- class ModHalfTime extends ModRateAdjust {
4581
- constructor() {
4582
- super();
4583
- this.acronym = "HT";
4584
- this.name = "HalfTime";
4585
- this.droidRanked = true;
4586
- this.osuRanked = true;
4587
- this.osuScoreMultiplier = 0.3;
4588
- this.bitwise = 1 << 8;
4589
- this.rate = 0.75;
4590
- this.incompatibleMods.add(ModDoubleTime).add(ModNightCore);
4591
- }
4592
- get isDroidRelevant() {
4593
- return this.isRelevant;
4594
- }
4595
- get droidScoreMultiplier() {
4596
- return super.droidScoreMultiplier;
4597
- }
4598
- get migrationDroidScoreMultiplier() {
4599
- return super.migrationDroidScoreMultiplier;
4600
- }
4601
- get isOsuRelevant() {
4602
- return this.isRelevant;
4603
- }
4604
- }
4605
-
4606
- /**
4607
- * Represents the DoubleTime mod.
4975
+ * Represents a `Mod` specific setting that is constrained to a number of values.
4976
+ *
4977
+ * The value can be `null`, which is treated as a special case.
4608
4978
  */
4609
- class ModDoubleTime extends ModRateAdjust {
4610
- constructor() {
4611
- super();
4612
- this.acronym = "DT";
4613
- this.name = "DoubleTime";
4614
- this.droidRanked = true;
4615
- this.osuRanked = true;
4616
- this.osuScoreMultiplier = 1.12;
4617
- this.bitwise = 1 << 6;
4618
- this.rate = 1.5;
4619
- this.incompatibleMods.add(ModHalfTime).add(ModNightCore);
4620
- }
4621
- get isDroidRelevant() {
4622
- return this.isRelevant;
4979
+ class NullableIntegerModSetting extends RangeConstrainedModSetting {
4980
+ constructor(name, key, description, defaultValue, min = -2147483648, max = 2147483647) {
4981
+ super(name, key, description, defaultValue, min, max, 1);
4982
+ this.displayFormatter = (v) => { var _a; return (_a = v === null || v === void 0 ? void 0 : v.toString()) !== null && _a !== void 0 ? _a : "None"; };
4983
+ if (min > max) {
4984
+ throw new RangeError(`The minimum value (${min.toString()}) must be less than or equal to the maximum value (${max.toString()}).`);
4985
+ }
4986
+ if (defaultValue !== null &&
4987
+ (defaultValue < min || defaultValue > max)) {
4988
+ throw new RangeError(`The default value (${defaultValue.toString()}) must be between the minimum (${min.toString()}) and maximum (${max.toString()}) values.`);
4989
+ }
4623
4990
  }
4624
- get droidScoreMultiplier() {
4625
- return super.droidScoreMultiplier;
4991
+ load(settings) {
4992
+ if (this.key === null) {
4993
+ return;
4994
+ }
4995
+ const stored = settings[this.key];
4996
+ if (stored === null || stored === undefined) {
4997
+ this.value = null;
4998
+ }
4999
+ else if (typeof stored === "number") {
5000
+ this.value = stored;
5001
+ }
4626
5002
  }
4627
- get migrationDroidScoreMultiplier() {
4628
- return super.migrationDroidScoreMultiplier;
5003
+ save(settings) {
5004
+ if (this.key !== null) {
5005
+ settings[this.key] = this.value;
5006
+ }
4629
5007
  }
4630
- get isOsuRelevant() {
4631
- return this.isRelevant;
5008
+ processValue(value) {
5009
+ if (value === null) {
5010
+ return null;
5011
+ }
5012
+ return Math.trunc(MathUtils.clamp(value, this.min, this.max));
4632
5013
  }
4633
5014
  }
4634
5015
 
4635
5016
  /**
4636
- * Represents the Grow mod.
5017
+ * Represents the Random mod.
4637
5018
  */
4638
- class ModGrow extends ModObjectScaleTween {
5019
+ class ModRandom extends Mod {
4639
5020
  constructor() {
4640
5021
  super(...arguments);
4641
- this.name = "Grow";
4642
- this.acronym = "GR";
5022
+ this.name = "Random";
5023
+ this.acronym = "RD";
4643
5024
  this.droidRanked = false;
4644
5025
  this.isDroidRelevant = true;
4645
- this.droidScoreMultiplier = 1;
4646
- this.migrationDroidScoreMultiplier = 1;
4647
- this.osuRanked = false;
4648
- this.isOsuRelevant = true;
4649
- this.osuScoreMultiplier = 1;
4650
- this.startScale = new DecimalModSetting("Start scale", "startScale", "The initial size multiplier applied to all hit objects.", 0.5, 0, 0.99, 0.01, 2);
4651
- }
4652
- }
4653
-
4654
- /**
4655
- * Represents the Magnetised mod.
4656
- */
4657
- class ModMagnetised extends Mod {
4658
- constructor() {
4659
- super(...arguments);
4660
- this.acronym = "MG";
4661
- this.name = "Magnetised";
4662
- this.osuScoreMultiplier = 0.5;
4663
5026
  this.osuRanked = false;
4664
5027
  this.isOsuRelevant = true;
4665
5028
  /**
4666
- * How strong the pull is.
5029
+ * The seed to use.
4667
5030
  */
4668
- this.attractionStrength = new DecimalModSetting("Attraction Strength", "attractionStrength", "How strong the pull is.", 0.5, 0.05, 1, 0.05, 2);
5031
+ this.seed = new NullableIntegerModSetting("Seed", "seed", "Use a custom seed instead of a random one.", null, 0, 2147483647);
5032
+ /**
5033
+ * Defines how sharp the angles of `HitObject`s should be.
5034
+ */
5035
+ this.angleSharpness = new DecimalModSetting("Angle sharpness", "angleSharpness", "Defines how sharp the angles of hit objects should be.", 7, 1, 10, 0.1, 1);
5036
+ this.random = null;
4669
5037
  }
4670
- }
4671
-
4672
- /**
4673
- * Represents a `Mod` specific setting that is constrained to a range of integer values.
4674
- */
4675
- class IntegerModSetting extends NumberModSetting {
4676
- constructor(name, key, description, defaultValue, min = -2147483648, max = 2147483647) {
4677
- super(name, key, description, defaultValue, min, max, 1);
5038
+ applyToBeatmap(beatmap) {
5039
+ var _a;
5040
+ var _b;
5041
+ (_a = (_b = this.seed).value) !== null && _a !== void 0 ? _a : (_b.value = Math.floor(Math.random() * 2147483647));
5042
+ this.random = new Random(this.seed.value);
5043
+ const positionInfos = HitObjectGenerationUtils.generatePositionInfos(beatmap.hitObjects.objects);
5044
+ // Offsets the angles of all hit objects in a "section" by the same amount.
5045
+ let sectionOffset = 0;
5046
+ // Whether the angles are positive or negative (clockwise or counter-clockwise flow).
5047
+ let flowDirection = false;
5048
+ for (let i = 0; i < positionInfos.length; ++i) {
5049
+ const positionInfo = positionInfos[i];
5050
+ if (this.shouldStartNewSection(beatmap, positionInfos, i)) {
5051
+ sectionOffset = this.getRandomOffset(0.0008);
5052
+ flowDirection = !flowDirection;
5053
+ }
5054
+ if (positionInfo.hitObject instanceof Slider &&
5055
+ this.random.nextDouble() < 0.5) {
5056
+ HitObjectGenerationUtils.flipSliderInPlaceHorizontally(positionInfo.hitObject);
5057
+ }
5058
+ if (i === 0) {
5059
+ positionInfo.distanceFromPrevious =
5060
+ this.random.nextDouble() * Playfield.center.y;
5061
+ positionInfo.relativeAngle =
5062
+ this.random.nextDouble() * 2 * Math.PI - Math.PI;
5063
+ }
5064
+ else {
5065
+ // Offsets only the angle of the current hit object if a flow change occurs.
5066
+ let flowChangeOffset = 0;
5067
+ // Offsets only the angle of the current hit object.
5068
+ const oneTimeOffset = this.getRandomOffset(0.002);
5069
+ if (this.shouldApplyFlowChange(positionInfos, i)) {
5070
+ flowChangeOffset = this.getRandomOffset(0.002);
5071
+ flowDirection = !flowDirection;
5072
+ }
5073
+ const totalOffset =
5074
+ // sectionOffset and oneTimeOffset should mainly affect patterns with large spacing.
5075
+ (sectionOffset + oneTimeOffset) *
5076
+ positionInfo.distanceFromPrevious +
5077
+ // flowChangeOffset should mainly affect streams.
5078
+ flowChangeOffset *
5079
+ (ModRandom.playfieldDiagonal -
5080
+ positionInfo.distanceFromPrevious);
5081
+ positionInfo.relativeAngle = this.getRelativeTargetAngle(positionInfo.distanceFromPrevious, totalOffset, flowDirection);
5082
+ }
5083
+ }
5084
+ const repositionedHitObjects = HitObjectGenerationUtils.repositionHitObjects(positionInfos);
5085
+ for (let i = 0; i < repositionedHitObjects.length; ++i) {
5086
+ beatmap.hitObjects.objects[i] = repositionedHitObjects[i];
5087
+ }
5088
+ }
5089
+ getRandomOffset(stdDev) {
5090
+ // Range: [0.5, 2]
5091
+ // Higher angle sharpness -> lower multiplier
5092
+ const customMultiplier = (1.5 * this.angleSharpness.max - this.angleSharpness.value) /
5093
+ (1.5 * this.angleSharpness.max - this.angleSharpness.defaultValue);
5094
+ return HitObjectGenerationUtils.randomGaussian(this.random, 0, stdDev * customMultiplier);
5095
+ }
5096
+ /**
5097
+ * @param targetDistance The target distance between the previous and the current `HitObject`.
5098
+ * @param offset The angle (in radians) by which the target angle should be offset.
5099
+ * @param flowDirection Whether the relative angle should be positive (`false`) or negative (`true`).
5100
+ */
5101
+ getRelativeTargetAngle(targetDistance, offset, flowDirection) {
5102
+ // Range: [0.1, 1]
5103
+ const angleSharpness = this.angleSharpness.value / this.angleSharpness.max;
5104
+ // Range: [0, 0.9]
5105
+ const angleWideness = 1 - angleSharpness;
5106
+ // Range: [-60, 30]
5107
+ const customOffsetX = angleSharpness * 100 - 70;
5108
+ // Range: [-0.075, 0.15]
5109
+ const customOffsetY = angleWideness * 0.25 - 0.075;
5110
+ const angle = 2.16 /
5111
+ (1 +
5112
+ 200 *
5113
+ Math.exp(0.036 * (targetDistance + customOffsetX * 2 - 310))) +
5114
+ 0.5 +
5115
+ offset +
5116
+ customOffsetY;
5117
+ const relativeAngle = Math.PI - angle;
5118
+ return flowDirection ? -relativeAngle : relativeAngle;
5119
+ }
5120
+ /**
5121
+ * Determines whether a new section should be started at the current [HitObject].
5122
+ */
5123
+ shouldStartNewSection(beatmap, positionInfos, i) {
5124
+ if (i === 0) {
5125
+ return true;
5126
+ }
5127
+ // Exclude new-combo-spam and 1-2-combos.
5128
+ const previousObjectStartedCombo = positionInfos[Math.max(0, i - 2)].hitObject.indexInCurrentCombo >
5129
+ 1 && positionInfos[i - 1].hitObject.isNewCombo;
5130
+ const previousObjectWasOnDownBeat = HitObjectGenerationUtils.isHitObjectOnBeat(beatmap, positionInfos[i - 1].hitObject, true);
5131
+ const previousObjectWasOnBeat = HitObjectGenerationUtils.isHitObjectOnBeat(beatmap, positionInfos[i - 1].hitObject);
5132
+ return ((previousObjectStartedCombo && this.random.nextDouble() < 0.6) ||
5133
+ previousObjectWasOnDownBeat ||
5134
+ (previousObjectWasOnBeat && this.random.nextDouble() < 0.4));
5135
+ }
5136
+ shouldApplyFlowChange(positionInfos, i) {
5137
+ // Exclude new-combo-spam and 1-2-combos.
5138
+ const previousObjectStartedCombo = positionInfos[Math.max(0, i - 2)].hitObject.indexInCurrentCombo >
5139
+ 1 && positionInfos[i - 1].hitObject.isNewCombo;
5140
+ return previousObjectStartedCombo && this.random.nextDouble() < 0.6;
5141
+ }
5142
+ toString() {
5143
+ const settings = [];
5144
+ if (this.seed.value !== null) {
5145
+ settings.push(`seed: ${this.seed.value.toString()}`);
5146
+ }
5147
+ settings.push(`angle sharpness: ${this.angleSharpness.toDisplayString()}`);
5148
+ return `${super.toString()} (${settings.join(", ")})`;
4678
5149
  }
4679
5150
  }
5151
+ ModRandom.playfieldDiagonal = Playfield.baseSize.length;
4680
5152
 
4681
5153
  /**
4682
- * Represents the Muted mod.
5154
+ * Represents the Target Practice mod.
4683
5155
  */
4684
- class ModMuted extends Mod {
5156
+ class ModTargetPractice extends Mod {
4685
5157
  constructor() {
4686
- super();
4687
- this.name = "Muted";
4688
- this.acronym = "MU";
4689
- this.droidRanked = false;
4690
- this.isDroidRelevant = true;
4691
- this.droidScoreMultiplier = 1;
4692
- this.migrationDroidScoreMultiplier = 1;
4693
- this.osuRanked = true;
5158
+ super(...arguments);
5159
+ this.acronym = "TP";
5160
+ this.name = "Target Practice";
5161
+ this.osuRanked = false;
4694
5162
  this.isOsuRelevant = true;
4695
5163
  this.osuScoreMultiplier = 1;
4696
5164
  /**
4697
- * Increase volume as combo builds.
4698
- */
4699
- this.inverseMuting = new BooleanModSetting("Start muted", "inverseMuting", "Increase volume as combo builds.", false);
4700
- /**
4701
- * Add a metronome beat to help the player keep track of the rhythm.
4702
- */
4703
- this.enableMetronome = new BooleanModSetting("Enable metronome", "enableMetronome", "Add a metronome beat to help you keep track of the rhythm.", true);
4704
- /**
4705
- * The combo count at which point the track reaches its final volume.
5165
+ * Use a custom seed instead of a random one.
4706
5166
  */
4707
- this.muteComboCount = new IntegerModSetting("Final volume at combo", "muteComboCount", "The combo count at which point the track reaches its final volume.", 100, 0, 500);
5167
+ this.seed = new NullableIntegerModSetting("Seed", "seed", "Use a custom seed instead of a random one", null, 0, 2147483647);
4708
5168
  /**
4709
- * Hit sounds are also muted alongside the track.
5169
+ * Whether a metronome beat should play in the background.
4710
5170
  */
4711
- this.affectsHitSounds = new BooleanModSetting("Mute hit sounds", "affectsHitSounds", "Hit sounds are also muted alongside the track.", true);
4712
- this.inverseMuting.bindValueChanged((value) => {
4713
- this.muteComboCount.min = value.newValue ? 1 : 0;
4714
- }, true);
5171
+ this.metronome = new BooleanModSetting("Metronome ticks", "metronome", "Whether a metronome beat should play in the background", true);
5172
+ }
5173
+ isCompatibleWith(other) {
5174
+ return (!this.isInstanceOfAny(other, ModRandom, ModSpunOut, ModStrictTracking, ModSuddenDeath, ModDepth, ModDifficultyAdjust) && super.isCompatibleWith(other));
5175
+ }
5176
+ applyToDifficulty(_, difficulty) {
5177
+ // Decrease AR to increase preempt time.
5178
+ difficulty.ar *= 0.5;
5179
+ }
5180
+ applyToBeatmap(beatmap) {
5181
+ var _a;
5182
+ var _b;
5183
+ (_a = (_b = this.seed).value) !== null && _a !== void 0 ? _a : (_b.value = Math.floor(Math.random() * 2147483647));
5184
+ const random = new Random(this.seed.value);
5185
+ if (beatmap.hitObjects.objects.length === 0) {
5186
+ return;
5187
+ }
5188
+ const originalHitObjects = [...beatmap.hitObjects.objects].sort((a, b) => a.startTime - b.startTime);
5189
+ const beats = this.generateBeats(beatmap, originalHitObjects);
5190
+ const newComboBoundaries = this.determineNewComboBoundaries(beats, originalHitObjects);
5191
+ const hitObjects = beats.map((beat, i) => {
5192
+ const circle = new Circle({
5193
+ startTime: beat,
5194
+ position: new Vector2(0, 0),
5195
+ newCombo: newComboBoundaries[i],
5196
+ });
5197
+ circle.applyDefaults(beatmap.controlPoints, beatmap.difficulty, exports.Modes.Osu);
5198
+ return circle;
5199
+ });
5200
+ this.addHitSamples(hitObjects, originalHitObjects);
5201
+ let prev = null;
5202
+ for (const circle of hitObjects) {
5203
+ circle.updateComboInformation(prev);
5204
+ prev = circle;
5205
+ }
5206
+ this.randomizeCirclePos(hitObjects, random);
5207
+ beatmap.hitObjects.clear();
5208
+ beatmap.hitObjects.add(...hitObjects);
5209
+ }
5210
+ generateBeats(beatmap, originalHitObjects) {
5211
+ const startTime = originalHitObjects[0].startTime;
5212
+ const endTime = Math.max(...originalHitObjects.map((o) => o.endTime));
5213
+ let beats = [];
5214
+ for (const timingPoint of beatmap.controlPoints.timing.points) {
5215
+ if (this.definitelyBigger(timingPoint.time, endTime)) {
5216
+ continue;
5217
+ }
5218
+ beats = beats.concat(this.getBeatsForTimingPoint(beatmap, timingPoint, endTime));
5219
+ }
5220
+ beats = beats.filter((beat) => this.almostBigger(beat, startTime));
5221
+ beats = beats.filter((beat) => !this.isInsideBreakPeriod(originalHitObjects, beatmap.events.breaks, beat));
5222
+ for (let i = beats.length - 2; i >= 0; --i) {
5223
+ const beat = beats[i];
5224
+ const beatLength = beatmap.controlPoints.timing.controlPointAt(beat).msPerBeat;
5225
+ if (!this.definitelyBigger(beats[i + 1] - beat, beatLength / 2)) {
5226
+ beats.splice(i, 1);
5227
+ }
5228
+ }
5229
+ return beats;
5230
+ }
5231
+ getBeatsForTimingPoint(beatmap, timingPoint, mapEndTime) {
5232
+ const beats = [];
5233
+ let i = 0;
5234
+ let currentTime = timingPoint.time;
5235
+ while (!this.definitelyBigger(currentTime, mapEndTime) &&
5236
+ beatmap.controlPoints.timing.controlPointAt(currentTime) ===
5237
+ timingPoint) {
5238
+ beats.push(Math.floor(currentTime));
5239
+ ++i;
5240
+ currentTime = timingPoint.time + i * timingPoint.msPerBeat;
5241
+ }
5242
+ return beats;
5243
+ }
5244
+ isInsideBreakPeriod(originalHitObjects, breaks, time) {
5245
+ return breaks.some((breakPeriod) => {
5246
+ const firstObjAfterBreak = originalHitObjects.find((obj) => this.almostBigger(obj.startTime, breakPeriod.endTime));
5247
+ return (this.almostBigger(time, breakPeriod.startTime) &&
5248
+ (!firstObjAfterBreak ||
5249
+ this.definitelyBigger(firstObjAfterBreak.startTime, time)));
5250
+ });
5251
+ }
5252
+ determineNewComboBoundaries(beats, originalHitObjects) {
5253
+ let previousGroup = -1;
5254
+ return beats.map((beat) => {
5255
+ const group = this.getClosestPrecedingComboIndex(originalHitObjects, beat);
5256
+ const isNewCombo = group !== previousGroup;
5257
+ previousGroup = group;
5258
+ return isNewCombo;
5259
+ });
5260
+ }
5261
+ getClosestPrecedingComboIndex(hitObjects, time) {
5262
+ let result = 0;
5263
+ for (const obj of hitObjects) {
5264
+ if (this.almostBigger(time, obj.startTime)) {
5265
+ result = obj.comboIndex;
5266
+ }
5267
+ else {
5268
+ break;
5269
+ }
5270
+ }
5271
+ return result;
5272
+ }
5273
+ addHitSamples(hitObjects, originalHitObjects) {
5274
+ const additions = [
5275
+ BankHitSampleInfo.HIT_WHISTLE,
5276
+ BankHitSampleInfo.HIT_FINISH,
5277
+ BankHitSampleInfo.HIT_CLAP,
5278
+ ];
5279
+ const timedSamples = [];
5280
+ for (const obj of originalHitObjects) {
5281
+ if (obj instanceof Slider) {
5282
+ obj.nodeSamples.forEach((nodeSample, i) => {
5283
+ timedSamples.push({
5284
+ time: obj.startTime + i * obj.spanDuration,
5285
+ samples: nodeSample,
5286
+ });
5287
+ });
5288
+ }
5289
+ else {
5290
+ timedSamples.push({
5291
+ time: obj.startTime,
5292
+ samples: obj.samples,
5293
+ });
5294
+ }
5295
+ }
5296
+ for (const circle of hitObjects) {
5297
+ const exact = timedSamples.find((s) => this.almostEquals(circle.startTime, s.time));
5298
+ if (exact) {
5299
+ circle.samples = exact.samples;
5300
+ continue;
5301
+ }
5302
+ const closest = this.getClosestObject(originalHitObjects, circle.startTime);
5303
+ circle.samples = closest.samples.filter((s) => !(s instanceof BankHitSampleInfo &&
5304
+ additions.includes(s.name)));
5305
+ }
5306
+ }
5307
+ getClosestObject(hitObjects, time) {
5308
+ let precedingIndex = -1;
5309
+ for (let i = 0; i < hitObjects.length; ++i) {
5310
+ if (hitObjects[i].startTime < time) {
5311
+ precedingIndex = i;
5312
+ }
5313
+ else {
5314
+ break;
5315
+ }
5316
+ }
5317
+ if (precedingIndex === -1) {
5318
+ return hitObjects[0];
5319
+ }
5320
+ if (precedingIndex === hitObjects.length - 1) {
5321
+ return hitObjects[precedingIndex];
5322
+ }
5323
+ const preceding = hitObjects[precedingIndex];
5324
+ const succeeding = hitObjects[precedingIndex + 1];
5325
+ return succeeding.startTime - time < time - preceding.startTime
5326
+ ? succeeding
5327
+ : preceding;
5328
+ }
5329
+ randomizeCirclePos(hitObjects, random) {
5330
+ if (hitObjects.length === 0) {
5331
+ return;
5332
+ }
5333
+ const nextSingle = (max = 1) => random.nextDouble() * max;
5334
+ const twoPi = Math.PI * 2;
5335
+ let direction = twoPi * nextSingle();
5336
+ const maxComboIndex = hitObjects[hitObjects.length - 1].comboIndex;
5337
+ for (let i = 0; i < hitObjects.length; ++i) {
5338
+ const obj = hitObjects[i];
5339
+ const lastPos = i === 0
5340
+ ? Playfield.baseSize.scale(0.5)
5341
+ : hitObjects[i - 1].position;
5342
+ let distance = maxComboIndex === 0
5343
+ ? obj.radius
5344
+ : this.mapRange(obj.comboIndex, 0, maxComboIndex, obj.radius, ModTargetPractice.maxBaseDistance);
5345
+ if (obj.isNewCombo) {
5346
+ distance *= 1.5;
5347
+ }
5348
+ if (obj.kiai) {
5349
+ distance *= 1.2;
5350
+ }
5351
+ distance = Math.min(ModTargetPractice.distanceCap, distance);
5352
+ let tryCount = 0;
5353
+ const precedingObjects = hitObjects.slice(Math.max(0, i - ModTargetPractice.overlapCheckCount), i);
5354
+ do {
5355
+ if (tryCount > 0) {
5356
+ direction = twoPi * nextSingle();
5357
+ }
5358
+ let relativePos = new Vector2(distance * Math.cos(direction), distance * Math.sin(direction));
5359
+ relativePos = HitObjectGenerationUtils.rotateAwayFromEdge(lastPos, relativePos, ModTargetPractice.edgeRotationMultiplier);
5360
+ direction = Math.atan2(relativePos.y, relativePos.x);
5361
+ obj.position = lastPos.add(relativePos);
5362
+ this.clampToPlayfield(obj);
5363
+ ++tryCount;
5364
+ if (tryCount % 10 === 0) {
5365
+ distance *= 0.9;
5366
+ }
5367
+ } while (distance >= obj.radius * 2 &&
5368
+ this.checkForOverlap(precedingObjects, obj));
5369
+ if (obj.isLastInCombo) {
5370
+ direction = twoPi * nextSingle();
5371
+ }
5372
+ else {
5373
+ direction +=
5374
+ (distance / ModTargetPractice.distanceCap) *
5375
+ (nextSingle() * twoPi - Math.PI);
5376
+ }
5377
+ }
5378
+ }
5379
+ checkForOverlap(objects, target) {
5380
+ return objects.some((h) => h.position.getDistance(target.position) < target.radius * 2);
5381
+ }
5382
+ clampToPlayfield(obj) {
5383
+ const { radius } = obj;
5384
+ let { x, y } = obj.position;
5385
+ if (y < radius) {
5386
+ y = radius;
5387
+ }
5388
+ else if (y > Playfield.baseSize.y - radius) {
5389
+ y = Playfield.baseSize.y - radius;
5390
+ }
5391
+ if (x < radius) {
5392
+ x = radius;
5393
+ }
5394
+ else if (x > Playfield.baseSize.x - radius) {
5395
+ x = Playfield.baseSize.x - radius;
5396
+ }
5397
+ obj.position = new Vector2(x, y);
4715
5398
  }
4716
- /**
4717
- * Obtains the volume at a given combo.
4718
- *
4719
- * @param combo The combo.
4720
- * @return The volume at `combo`, where 0 is muted and 1 is full volume.
4721
- */
4722
- volumeAt(combo) {
4723
- const volume = MathUtils.clamp(combo / Math.max(1, this.muteComboCount.value), 0, 1);
4724
- return this.inverseMuting.value ? volume : 1 - volume;
5399
+ mapRange(value, fromLow, fromHigh, toLow, toHigh) {
5400
+ return (((value - fromLow) * (toHigh - toLow)) / (fromHigh - fromLow) +
5401
+ toLow);
5402
+ }
5403
+ almostBigger(value1, value2) {
5404
+ return value1 > value2 - ModTargetPractice.timingPrecision;
5405
+ }
5406
+ definitelyBigger(value1, value2) {
5407
+ return value1 > value2 + ModTargetPractice.timingPrecision;
5408
+ }
5409
+ almostEquals(value1, value2) {
5410
+ return Precision.almostEquals(value1, value2, ModTargetPractice.timingPrecision);
4725
5411
  }
4726
5412
  }
5413
+ /**
5414
+ * Jump distance for circles in the last combo.
5415
+ */
5416
+ ModTargetPractice.maxBaseDistance = 333;
5417
+ /**
5418
+ * The maximum allowed jump distance after multipliers are applied.
5419
+ */
5420
+ ModTargetPractice.distanceCap = 380;
5421
+ /**
5422
+ * The extent of rotation towards playfield centre when a circle is near the edge.
5423
+ */
5424
+ ModTargetPractice.edgeRotationMultiplier = 0.75;
5425
+ /**
5426
+ * Number of recent circles to check for overlap.
5427
+ */
5428
+ ModTargetPractice.overlapCheckCount = 5;
5429
+ /**
5430
+ * Acceptable difference for timing comparisons.
5431
+ */
5432
+ ModTargetPractice.timingPrecision = 1;
4727
5433
 
4728
5434
  /**
4729
- * Represents the SuddenDeath mod.
5435
+ * Represents the Strict Tracking mod.
4730
5436
  */
4731
- class ModSuddenDeath extends Mod {
5437
+ class ModStrictTracking extends Mod {
4732
5438
  constructor() {
4733
- super();
4734
- this.acronym = "SD";
4735
- this.name = "Sudden Death";
4736
- this.droidRanked = true;
4737
- this.isDroidRelevant = true;
4738
- this.droidScoreMultiplier = 1;
4739
- this.migrationDroidScoreMultiplier = 1;
5439
+ super(...arguments);
5440
+ this.acronym = "ST";
5441
+ this.name = "Strict Tracking";
4740
5442
  this.osuRanked = true;
4741
5443
  this.isOsuRelevant = true;
4742
5444
  this.osuScoreMultiplier = 1;
4743
- this.bitwise = 1 << 5;
4744
- this.incompatibleMods.add(ModNoFail).add(ModPerfect);
5445
+ }
5446
+ isCompatibleWith(other) {
5447
+ return (!this.isInstanceOfAny(other, ModClassic, ModTargetPractice) &&
5448
+ super.isCompatibleWith(other));
4745
5449
  }
4746
5450
  }
4747
5451
 
4748
5452
  /**
4749
- * Represents the Perfect mod.
5453
+ * Represents the Classic mod.
5454
+ *
5455
+ * Classic mods are not to be ranked yet due to compatibility and multiplier concerns. Right now
5456
+ * they are considered, for leaderboard purposes, to be equal to scores set on osu!stable, but
5457
+ * this is not the case (e.g. hit windows differ, sliders always give combo for the slider end
5458
+ * even on miss).
4750
5459
  */
4751
- class ModPerfect extends Mod {
5460
+ class ModClassic extends Mod {
4752
5461
  constructor() {
4753
- super();
4754
- this.acronym = "PF";
4755
- this.name = "Perfect";
4756
- this.droidRanked = true;
4757
- this.isDroidRelevant = true;
4758
- this.droidScoreMultiplier = 1;
4759
- this.migrationDroidScoreMultiplier = 1;
4760
- this.osuRanked = true;
5462
+ super(...arguments);
5463
+ this.acronym = "CL";
5464
+ this.name = "Classic";
5465
+ this.osuRanked = false;
4761
5466
  this.isOsuRelevant = true;
4762
5467
  this.osuScoreMultiplier = 1;
4763
- this.bitwise = 1 << 14;
4764
- this.incompatibleMods.add(ModNoFail).add(ModSuddenDeath);
5468
+ /**
5469
+ * Scores sliders proportionally to the number of ticks hit.
5470
+ */
5471
+ this.noSliderHeadAccuracy = new BooleanModSetting("No slider head accuracy requirement", "noSliderHeadAccuracy", "Scores sliders proportionally to the number of ticks hit.", true);
5472
+ /**
5473
+ * Applies note lock to the full hit window.
5474
+ */
5475
+ this.classicNoteLock = new BooleanModSetting("Apply classic note lock", "classicNoteLock", "Applies note lock to the full hit window.", true);
5476
+ /**
5477
+ * Always plays a slider's tail sample regardless of whether it was hit or not.
5478
+ */
5479
+ this.alwaysPlayTailSample = new BooleanModSetting("Always play a slider's tail sample", "alwaysPlayTailSample", "Always plays a slider's tail sample regardless of whether it was hit or not.", true);
5480
+ /**
5481
+ * Make hit circles fade out into a miss, rather than after it.
5482
+ */
5483
+ this.fadeHitCircleEarly = new BooleanModSetting("Fade out hit circles earlier", "fadeHitCircleEarly", "Make hit circles fade out into a miss, rather than after it.", true);
5484
+ /**
5485
+ * More closely resembles the original HP drain mechanics.
5486
+ */
5487
+ this.classicHealth = new BooleanModSetting("Classic health", "classicHealth", "More closely resembles the original HP drain mechanics.", true);
5488
+ }
5489
+ isCompatibleWith(other) {
5490
+ return (!this.isInstanceOfAny(other, ModStrictTracking) &&
5491
+ super.isCompatibleWith(other));
4765
5492
  }
4766
5493
  }
4767
5494
 
4768
5495
  /**
4769
- * Represents the NoFail mod.
5496
+ * Represents the NightCore mod.
4770
5497
  */
4771
- class ModNoFail extends Mod {
5498
+ class ModNightCore extends ModRateAdjust {
4772
5499
  constructor() {
4773
- super();
4774
- this.acronym = "NF";
4775
- this.name = "NoFail";
5500
+ super(...arguments);
5501
+ this.acronym = "NC";
5502
+ this.name = "Night Core";
4776
5503
  this.droidRanked = true;
4777
- this.isDroidRelevant = true;
4778
- this.droidScoreMultiplier = 0.5;
4779
- this.migrationDroidScoreMultiplier = 0.5;
4780
5504
  this.osuRanked = true;
4781
- this.isOsuRelevant = true;
4782
- this.osuScoreMultiplier = 0.5;
4783
- this.bitwise = 1 << 0;
4784
- this.incompatibleMods.add(ModPerfect).add(ModSuddenDeath);
5505
+ this.bitwise = 1 << 9;
5506
+ this.rate = 1.5;
5507
+ }
5508
+ isCompatibleWith(other) {
5509
+ return (!this.isInstanceOfAny(other, ModDoubleTime, ModHalfTime) &&
5510
+ super.isCompatibleWith(other));
5511
+ }
5512
+ get isDroidRelevant() {
5513
+ return this.isRelevant;
5514
+ }
5515
+ get isOsuRelevant() {
5516
+ return this.isRelevant;
4785
5517
  }
4786
5518
  }
4787
5519
 
4788
5520
  /**
4789
- * Represents the Precise mod.
5521
+ * Represents the HalfTime mod.
4790
5522
  */
4791
- class ModPrecise extends Mod {
5523
+ class ModHalfTime extends ModRateAdjust {
4792
5524
  constructor() {
4793
5525
  super(...arguments);
4794
- this.acronym = "PR";
4795
- this.name = "Precise";
5526
+ this.acronym = "HT";
5527
+ this.name = "Half Time";
4796
5528
  this.droidRanked = true;
4797
- this.isDroidRelevant = true;
4798
- this.droidScoreMultiplier = 1.06;
4799
- this.migrationDroidScoreMultiplier = 1.06;
4800
- }
4801
- applyToHitObject(mode, hitObject) {
4802
- var _a, _b;
4803
- if (mode !== exports.Modes.Droid || hitObject instanceof Spinner) {
4804
- return;
4805
- }
4806
- if (hitObject instanceof Slider) {
4807
- // For sliders, the hit window is enforced in the head - everything else is an instant hit or miss.
4808
- hitObject.head.hitWindow = new PreciseDroidHitWindow((_a = hitObject.head.hitWindow) === null || _a === void 0 ? void 0 : _a.overallDifficulty);
4809
- }
4810
- else {
4811
- hitObject.hitWindow = new PreciseDroidHitWindow((_b = hitObject.hitWindow) === null || _b === void 0 ? void 0 : _b.overallDifficulty);
4812
- }
4813
- }
4814
- }
4815
-
4816
- /**
4817
- * Some utilities, no biggie.
4818
- */
4819
- class Utils {
4820
- /**
4821
- * Returns a random element of an array.
4822
- *
4823
- * @param array The array to get the element from.
4824
- */
4825
- static getRandomArrayElement(array) {
4826
- return array[Math.floor(Math.random() * array.length)];
5529
+ this.osuRanked = true;
5530
+ this.bitwise = 1 << 8;
5531
+ this.rate = 0.75;
4827
5532
  }
4828
- /**
4829
- * Creates an array with specific length that's prefilled with an initial value.
4830
- *
4831
- * @param length The length of the array.
4832
- * @param initialValue The initial value of each element, or a function that returns the initial value of each element.
4833
- * @returns The array.
4834
- */
4835
- static initializeArray(length, initialValue) {
4836
- const array = new Array(length);
4837
- if (initialValue !== undefined) {
4838
- for (let i = 0; i < length; ++i) {
4839
- array[i] =
4840
- typeof initialValue === "function"
4841
- ? initialValue(i)
4842
- : initialValue;
4843
- }
4844
- }
4845
- return array;
5533
+ isCompatibleWith(other) {
5534
+ return (!this.isInstanceOfAny(other, ModDoubleTime, ModNightCore) &&
5535
+ super.isCompatibleWith(other));
4846
5536
  }
4847
- /**
4848
- * Performs a binary search on an array with a custom predicate function.
4849
- *
4850
- * The predicate function should return:
4851
- * - a negative number if the element is less than the target,
4852
- * - a positive number if the element is greater than the target, and
4853
- * - 0 if the element is equal to the target.
4854
- *
4855
- * @param array The array to search through. Must be sorted according to the predicate function.
4856
- * @param predicate The predicate function to determine the order of elements.
4857
- * @returns The result of the binary search.
4858
- */
4859
- static binarySearch(array, predicate) {
4860
- let left = 0;
4861
- let right = array.length - 1;
4862
- while (left <= right) {
4863
- const mid = left + ((right - left) >> 1);
4864
- const result = predicate(array[mid]);
4865
- if (result === 0) {
4866
- return { index: mid, found: true };
4867
- }
4868
- else if (result < 0) {
4869
- left = mid + 1;
4870
- }
4871
- else {
4872
- right = mid - 1;
4873
- }
4874
- }
4875
- return { index: left, found: false };
5537
+ get isDroidRelevant() {
5538
+ return this.isRelevant;
4876
5539
  }
4877
- /**
4878
- * Pauses the execution of a function for
4879
- * the specified duration.
4880
- *
4881
- * @param duration The duration to pause for, in seconds.
4882
- */
4883
- static sleep(duration) {
4884
- return new Promise((resolve) => setTimeout(resolve, duration * 1000));
5540
+ get isOsuRelevant() {
5541
+ return this.isRelevant;
4885
5542
  }
4886
5543
  }
4887
5544
 
4888
5545
  /**
4889
- * A pseudo-random number generator that shares the same implementation with
4890
- * {@link https://github.com/dotnet/runtime/blob/v9.0.4/src/libraries/System.Private.CoreLib/src/System/Random.Net5CompatImpl.cs .NET 5's `System.Random`}.
4891
- *
4892
- * Used in the Random mod to ensure that a seed generates the result that users expect.
5546
+ * Represents the DoubleTime mod.
4893
5547
  */
4894
- class Random {
4895
- /**
4896
- * Constructs a new instance of the `Random` class using the specified seed.
4897
- *
4898
- * @param seed The seed to use for the random number generator. This value is clamped to the range [-2147483648, 2147483647] and must be an integer.
4899
- */
4900
- constructor(seed) {
4901
- this.seedArray = Utils.initializeArray(56, 0);
4902
- this.iNext = 0;
4903
- this.iNextP = 21;
4904
- seed = Math.trunc(seed);
4905
- const subtraction = seed <= Random.MIN_VALUE ? Random.MAX_VALUE : Math.abs(seed);
4906
- // Magic number based on Phi (golden ratio).
4907
- let mj = 161803398 - subtraction;
4908
- this.seedArray[55] = mj;
4909
- let mk = 1;
4910
- let ii = 0;
4911
- for (let i = 1; i < 55; ++i) {
4912
- // The range [1..55] is special (Knuth) and so we're wasting the 0'th position.
4913
- ii = (21 * i) % 55;
4914
- this.seedArray[ii] = mk;
4915
- mk = mj - mk;
4916
- if (mk < 0) {
4917
- mk += Random.MAX_VALUE;
4918
- }
4919
- mj = this.seedArray[ii];
4920
- }
4921
- for (let k = 1; k < 5; ++k) {
4922
- for (let i = 1; i < 56; ++i) {
4923
- const n = (i + 30) % 55;
4924
- this.seedArray[i] -= this.seedArray[n + 1];
4925
- if (this.seedArray[i] < 0) {
4926
- this.seedArray[i] += Random.MAX_VALUE;
4927
- }
4928
- }
4929
- }
4930
- }
4931
- nextDouble() {
4932
- return this.sample();
5548
+ class ModDoubleTime extends ModRateAdjust {
5549
+ constructor() {
5550
+ super(...arguments);
5551
+ this.acronym = "DT";
5552
+ this.name = "Double Time";
5553
+ this.droidRanked = true;
5554
+ this.osuRanked = true;
5555
+ this.bitwise = 1 << 6;
5556
+ this.rate = 1.5;
4933
5557
  }
4934
- sample() {
4935
- return this.internalSample() / 2147483647;
5558
+ isCompatibleWith(other) {
5559
+ return (!this.isInstanceOfAny(other, ModHalfTime, ModNightCore) &&
5560
+ super.isCompatibleWith(other));
4936
5561
  }
4937
- internalSample() {
4938
- let locINext = this.iNext;
4939
- if (++locINext >= 56) {
4940
- locINext = 1;
4941
- }
4942
- let locINextP = this.iNextP;
4943
- if (++locINextP >= 56) {
4944
- locINextP = 1;
4945
- }
4946
- let retVal = this.seedArray[locINext] - this.seedArray[locINextP];
4947
- if (retVal === Random.MAX_VALUE) {
4948
- --retVal;
4949
- }
4950
- if (retVal < 0) {
4951
- retVal += Random.MAX_VALUE;
4952
- }
4953
- this.seedArray[locINext] = retVal;
4954
- this.iNext = locINext;
4955
- this.iNextP = locINextP;
4956
- return retVal;
5562
+ get isDroidRelevant() {
5563
+ return this.isRelevant;
5564
+ }
5565
+ get isOsuRelevant() {
5566
+ return this.isRelevant;
4957
5567
  }
4958
5568
  }
4959
- Random.MIN_VALUE = -2147483648;
4960
- Random.MAX_VALUE = 2147483647;
4961
5569
 
4962
5570
  /**
4963
- * Represents a `Mod` specific setting that is constrained to a number of values.
4964
- *
4965
- * The value can be `null`, which is treated as a special case.
5571
+ * Represents the Daycore mod.
4966
5572
  */
4967
- class NullableIntegerModSetting extends RangeConstrainedModSetting {
4968
- constructor(name, key, description, defaultValue, min = -2147483648, max = 2147483647) {
4969
- super(name, key, description, defaultValue, min, max, 1);
4970
- this.displayFormatter = (v) => { var _a; return (_a = v === null || v === void 0 ? void 0 : v.toString()) !== null && _a !== void 0 ? _a : "None"; };
4971
- if (min > max) {
4972
- throw new RangeError(`The minimum value (${min.toString()}) must be less than or equal to the maximum value (${max.toString()}).`);
4973
- }
4974
- if (defaultValue !== null &&
4975
- (defaultValue < min || defaultValue > max)) {
4976
- throw new RangeError(`The default value (${defaultValue.toString()}) must be between the minimum (${min.toString()}) and maximum (${max.toString()}) values.`);
4977
- }
5573
+ class ModDaycore extends ModRateAdjust {
5574
+ constructor() {
5575
+ super(...arguments);
5576
+ this.acronym = "DC";
5577
+ this.name = "Daycore";
5578
+ this.osuRanked = true;
5579
+ this.osuScoreMultiplier = 1;
5580
+ this.rate = 0.75;
4978
5581
  }
4979
- load(settings) {
4980
- if (this.key === null) {
4981
- return;
4982
- }
4983
- const stored = settings[this.key];
4984
- if (stored === null || stored === undefined) {
4985
- this.value = null;
4986
- }
4987
- else if (typeof stored === "number") {
4988
- this.value = stored;
4989
- }
5582
+ isCompatibleWith(other) {
5583
+ return (!this.isInstanceOfAny(other, ModDoubleTime, ModHalfTime, ModNightCore) && super.isCompatibleWith(other));
4990
5584
  }
4991
- save(settings) {
4992
- if (this.key !== null) {
4993
- settings[this.key] = this.value;
4994
- }
5585
+ get isOsuRelevant() {
5586
+ return this.isRelevant;
4995
5587
  }
4996
- processValue(value) {
4997
- if (value === null) {
4998
- return null;
4999
- }
5000
- return Math.trunc(MathUtils.clamp(value, this.min, this.max));
5588
+ }
5589
+
5590
+ /**
5591
+ * Represents a `Mod` that adjusts the size of `HitObject`s during their fade in animation.
5592
+ */
5593
+ class ModObjectScaleTween extends Mod {
5594
+ constructor() {
5595
+ super(...arguments);
5596
+ /**
5597
+ * The final size multiplier applied to all [HitObject]s.
5598
+ */
5599
+ this.endScale = 1;
5600
+ }
5601
+ isCompatibleWith(other) {
5602
+ return (!this.isInstanceOfAny(other, ModObjectScaleTween, ModTraceable) &&
5603
+ super.isCompatibleWith(other));
5001
5604
  }
5002
5605
  }
5003
5606
 
5004
5607
  /**
5005
- * Represents the Random mod.
5608
+ * Represents the Deflate mod.
5006
5609
  */
5007
- class ModRandom extends Mod {
5610
+ class ModDeflate extends ModObjectScaleTween {
5008
5611
  constructor() {
5009
5612
  super(...arguments);
5010
- this.name = "Random";
5011
- this.acronym = "RD";
5613
+ this.name = "Deflate";
5614
+ this.acronym = "DF";
5615
+ this.osuRanked = false;
5616
+ this.isOsuRelevant = true;
5617
+ this.startScale = new DecimalModSetting("Start scale", "startScale", "The initial size multiplier applied to all hit objects.", 2, 1, 25, 0.1, 1);
5618
+ }
5619
+ }
5620
+
5621
+ /**
5622
+ * Represents the Grow mod.
5623
+ */
5624
+ class ModGrow extends ModObjectScaleTween {
5625
+ constructor() {
5626
+ super(...arguments);
5627
+ this.name = "Grow";
5628
+ this.acronym = "GR";
5629
+ this.osuRanked = false;
5630
+ this.isOsuRelevant = true;
5631
+ this.startScale = new DecimalModSetting("Start scale", "startScale", "The initial size multiplier applied to all hit objects.", 0.5, 0, 0.99, 0.01, 2);
5632
+ }
5633
+ }
5634
+
5635
+ /**
5636
+ * Represents the Muted mod.
5637
+ */
5638
+ class ModMuted extends Mod {
5639
+ constructor() {
5640
+ super();
5641
+ this.name = "Muted";
5642
+ this.acronym = "MU";
5012
5643
  this.droidRanked = false;
5013
5644
  this.isDroidRelevant = true;
5014
- this.droidScoreMultiplier = 1;
5015
- this.migrationDroidScoreMultiplier = 1;
5016
- this.osuRanked = false;
5645
+ this.osuRanked = true;
5017
5646
  this.isOsuRelevant = true;
5018
- this.osuScoreMultiplier = 1;
5019
5647
  /**
5020
- * The seed to use.
5648
+ * Increase volume as combo builds.
5021
5649
  */
5022
- this.seed = new NullableIntegerModSetting("Seed", "seed", "Use a custom seed instead of a random one.", null, 0, 2147483647);
5650
+ this.inverseMuting = new BooleanModSetting("Start muted", "inverseMuting", "Increase volume as combo builds.", false);
5023
5651
  /**
5024
- * Defines how sharp the angles of `HitObject`s should be.
5652
+ * Add a metronome beat to help the player keep track of the rhythm.
5025
5653
  */
5026
- this.angleSharpness = new DecimalModSetting("Angle sharpness", "angleSharpness", "Defines how sharp the angles of hit objects should be.", 7, 1, 10, 0.1, 1);
5027
- this.random = null;
5028
- }
5029
- applyToBeatmap(beatmap) {
5030
- var _a;
5031
- var _b;
5032
- (_a = (_b = this.seed).value) !== null && _a !== void 0 ? _a : (_b.value = Math.floor(Math.random() * 2147483647));
5033
- this.random = new Random(this.seed.value);
5034
- const positionInfos = HitObjectGenerationUtils.generatePositionInfos(beatmap.hitObjects.objects);
5035
- // Offsets the angles of all hit objects in a "section" by the same amount.
5036
- let sectionOffset = 0;
5037
- // Whether the angles are positive or negative (clockwise or counter-clockwise flow).
5038
- let flowDirection = false;
5039
- for (let i = 0; i < positionInfos.length; ++i) {
5040
- const positionInfo = positionInfos[i];
5041
- if (this.shouldStartNewSection(beatmap, positionInfos, i)) {
5042
- sectionOffset = this.getRandomOffset(0.0008);
5043
- flowDirection = !flowDirection;
5044
- }
5045
- if (positionInfo.hitObject instanceof Slider &&
5046
- this.random.nextDouble() < 0.5) {
5047
- HitObjectGenerationUtils.flipSliderInPlaceHorizontally(positionInfo.hitObject);
5048
- }
5049
- if (i === 0) {
5050
- positionInfo.distanceFromPrevious =
5051
- this.random.nextDouble() * Playfield.center.y;
5052
- positionInfo.relativeAngle =
5053
- this.random.nextDouble() * 2 * Math.PI - Math.PI;
5054
- }
5055
- else {
5056
- // Offsets only the angle of the current hit object if a flow change occurs.
5057
- let flowChangeOffset = 0;
5058
- // Offsets only the angle of the current hit object.
5059
- const oneTimeOffset = this.getRandomOffset(0.002);
5060
- if (this.shouldApplyFlowChange(positionInfos, i)) {
5061
- flowChangeOffset = this.getRandomOffset(0.002);
5062
- flowDirection = !flowDirection;
5063
- }
5064
- const totalOffset =
5065
- // sectionOffset and oneTimeOffset should mainly affect patterns with large spacing.
5066
- (sectionOffset + oneTimeOffset) *
5067
- positionInfo.distanceFromPrevious +
5068
- // flowChangeOffset should mainly affect streams.
5069
- flowChangeOffset *
5070
- (ModRandom.playfieldDiagonal -
5071
- positionInfo.distanceFromPrevious);
5072
- positionInfo.relativeAngle = this.getRelativeTargetAngle(positionInfo.distanceFromPrevious, totalOffset, flowDirection);
5073
- }
5074
- }
5075
- const repositionedHitObjects = HitObjectGenerationUtils.repositionHitObjects(positionInfos);
5076
- for (let i = 0; i < repositionedHitObjects.length; ++i) {
5077
- beatmap.hitObjects.objects[i] = repositionedHitObjects[i];
5078
- }
5079
- }
5080
- getRandomOffset(stdDev) {
5081
- // Range: [0.5, 2]
5082
- // Higher angle sharpness -> lower multiplier
5083
- const customMultiplier = (1.5 * this.angleSharpness.max - this.angleSharpness.value) /
5084
- (1.5 * this.angleSharpness.max - this.angleSharpness.defaultValue);
5085
- return HitObjectGenerationUtils.randomGaussian(this.random, 0, stdDev * customMultiplier);
5086
- }
5087
- /**
5088
- * @param targetDistance The target distance between the previous and the current `HitObject`.
5089
- * @param offset The angle (in radians) by which the target angle should be offset.
5090
- * @param flowDirection Whether the relative angle should be positive (`false`) or negative (`true`).
5091
- */
5092
- getRelativeTargetAngle(targetDistance, offset, flowDirection) {
5093
- // Range: [0.1, 1]
5094
- const angleSharpness = this.angleSharpness.value / this.angleSharpness.max;
5095
- // Range: [0, 0.9]
5096
- const angleWideness = 1 - angleSharpness;
5097
- // Range: [-60, 30]
5098
- const customOffsetX = angleSharpness * 100 - 70;
5099
- // Range: [-0.075, 0.15]
5100
- const customOffsetY = angleWideness * 0.25 - 0.075;
5101
- const angle = 2.16 /
5102
- (1 +
5103
- 200 *
5104
- Math.exp(0.036 * (targetDistance + customOffsetX * 2 - 310))) +
5105
- 0.5 +
5106
- offset +
5107
- customOffsetY;
5108
- const relativeAngle = Math.PI - angle;
5109
- return flowDirection ? -relativeAngle : relativeAngle;
5654
+ this.enableMetronome = new BooleanModSetting("Enable metronome", "enableMetronome", "Add a metronome beat to help you keep track of the rhythm.", true);
5655
+ /**
5656
+ * The combo count at which point the track reaches its final volume.
5657
+ */
5658
+ this.muteComboCount = new IntegerModSetting("Final volume at combo", "muteComboCount", "The combo count at which point the track reaches its final volume.", 100, 0, 500);
5659
+ /**
5660
+ * Hit sounds are also muted alongside the track.
5661
+ */
5662
+ this.affectsHitSounds = new BooleanModSetting("Mute hit sounds", "affectsHitSounds", "Hit sounds are also muted alongside the track.", true);
5663
+ this.inverseMuting.bindValueChanged((value) => {
5664
+ this.muteComboCount.min = value.newValue ? 1 : 0;
5665
+ }, true);
5110
5666
  }
5111
5667
  /**
5112
- * Determines whether a new section should be started at the current [HitObject].
5668
+ * Obtains the volume at a given combo.
5669
+ *
5670
+ * @param combo The combo.
5671
+ * @return The volume at `combo`, where 0 is muted and 1 is full volume.
5113
5672
  */
5114
- shouldStartNewSection(beatmap, positionInfos, i) {
5115
- if (i === 0) {
5116
- return true;
5117
- }
5118
- // Exclude new-combo-spam and 1-2-combos.
5119
- const previousObjectStartedCombo = positionInfos[Math.max(0, i - 2)].hitObject.indexInCurrentCombo >
5120
- 1 && positionInfos[i - 1].hitObject.isNewCombo;
5121
- const previousObjectWasOnDownBeat = HitObjectGenerationUtils.isHitObjectOnBeat(beatmap, positionInfos[i - 1].hitObject, true);
5122
- const previousObjectWasOnBeat = HitObjectGenerationUtils.isHitObjectOnBeat(beatmap, positionInfos[i - 1].hitObject);
5123
- return ((previousObjectStartedCombo && this.random.nextDouble() < 0.6) ||
5124
- previousObjectWasOnDownBeat ||
5125
- (previousObjectWasOnBeat && this.random.nextDouble() < 0.4));
5673
+ volumeAt(combo) {
5674
+ const volume = MathUtils.clamp(combo / Math.max(1, this.muteComboCount.value), 0, 1);
5675
+ return this.inverseMuting.value ? volume : 1 - volume;
5126
5676
  }
5127
- shouldApplyFlowChange(positionInfos, i) {
5128
- // Exclude new-combo-spam and 1-2-combos.
5129
- const previousObjectStartedCombo = positionInfos[Math.max(0, i - 2)].hitObject.indexInCurrentCombo >
5130
- 1 && positionInfos[i - 1].hitObject.isNewCombo;
5131
- return previousObjectStartedCombo && this.random.nextDouble() < 0.6;
5677
+ }
5678
+
5679
+ /**
5680
+ * Represents the Precise mod.
5681
+ */
5682
+ class ModPrecise extends Mod {
5683
+ constructor() {
5684
+ super(...arguments);
5685
+ this.acronym = "PR";
5686
+ this.name = "Precise";
5687
+ this.droidRanked = true;
5688
+ this.isDroidRelevant = true;
5132
5689
  }
5133
- toString() {
5134
- const settings = [];
5135
- if (this.seed.value !== null) {
5136
- settings.push(`seed: ${this.seed.value.toString()}`);
5690
+ applyToHitObject(mode, hitObject) {
5691
+ var _a, _b;
5692
+ if (mode !== exports.Modes.Droid || hitObject instanceof Spinner) {
5693
+ return;
5694
+ }
5695
+ if (hitObject instanceof Slider) {
5696
+ // For sliders, the hit window is enforced in the head - everything else is an instant hit or miss.
5697
+ hitObject.head.hitWindow = new PreciseDroidHitWindow((_a = hitObject.head.hitWindow) === null || _a === void 0 ? void 0 : _a.overallDifficulty);
5698
+ }
5699
+ else {
5700
+ hitObject.hitWindow = new PreciseDroidHitWindow((_b = hitObject.hitWindow) === null || _b === void 0 ? void 0 : _b.overallDifficulty);
5137
5701
  }
5138
- settings.push(`angle sharpness: ${this.angleSharpness.toDisplayString()}`);
5139
- return `${super.toString()} (${settings.join(", ")})`;
5140
5702
  }
5141
5703
  }
5142
- ModRandom.playfieldDiagonal = Playfield.baseSize.length;
5143
5704
 
5144
5705
  /**
5145
5706
  * Represents the ScoreV2 mod.
@@ -5148,30 +5709,29 @@ class ModScoreV2 extends Mod {
5148
5709
  constructor() {
5149
5710
  super(...arguments);
5150
5711
  this.acronym = "V2";
5151
- this.name = "ScoreV2";
5712
+ this.name = "Score V2";
5152
5713
  this.droidRanked = false;
5153
5714
  this.isDroidRelevant = true;
5154
- this.droidScoreMultiplier = 1;
5155
- this.migrationDroidScoreMultiplier = 1;
5156
5715
  this.osuRanked = false;
5157
5716
  this.isOsuRelevant = true;
5158
- this.osuScoreMultiplier = 1;
5159
5717
  this.bitwise = 1 << 29;
5160
5718
  }
5161
5719
  }
5162
5720
 
5163
5721
  /**
5164
- * Represents the SpunOut mod.
5722
+ * Represents the Spin In mod.
5165
5723
  */
5166
- class ModSpunOut extends Mod {
5724
+ class ModSpinIn extends Mod {
5167
5725
  constructor() {
5168
5726
  super(...arguments);
5169
- this.acronym = "SO";
5170
- this.name = "SpunOut";
5171
- this.osuRanked = true;
5172
- this.bitwise = 1 << 12;
5727
+ this.acronym = "SI";
5728
+ this.name = "Spin In";
5729
+ this.osuRanked = false;
5173
5730
  this.isOsuRelevant = true;
5174
- this.osuScoreMultiplier = 0.9;
5731
+ this.osuScoreMultiplier = 1;
5732
+ }
5733
+ isCompatibleWith(other) {
5734
+ return (!this.isInstanceOfAny(other, ModObjectScaleTween, ModHidden, ModDepth) && super.isCompatibleWith(other));
5175
5735
  }
5176
5736
  }
5177
5737
 
@@ -5185,26 +5745,8 @@ class ModSynesthesia extends Mod {
5185
5745
  this.acronym = "SY";
5186
5746
  this.droidRanked = false;
5187
5747
  this.isDroidRelevant = true;
5188
- this.droidScoreMultiplier = 0.8;
5189
- this.migrationDroidScoreMultiplier = 0.8;
5190
5748
  this.osuRanked = false;
5191
5749
  this.isOsuRelevant = true;
5192
- this.osuScoreMultiplier = 0.8;
5193
- }
5194
- }
5195
-
5196
- /**
5197
- * Represents the TouchDevice mod.
5198
- */
5199
- class ModTouchDevice extends Mod {
5200
- constructor() {
5201
- super(...arguments);
5202
- this.acronym = "TD";
5203
- this.name = "TouchDevice";
5204
- this.osuRanked = true;
5205
- this.bitwise = 1 << 2;
5206
- this.isOsuRelevant = true;
5207
- this.osuScoreMultiplier = 1;
5208
5750
  }
5209
5751
  }
5210
5752
 
@@ -5387,6 +5929,11 @@ class Interpolation {
5387
5929
  * Represents a mod that gradually adjusts the track's playback rate over time.
5388
5930
  */
5389
5931
  class ModTimeRamp extends Mod {
5932
+ constructor() {
5933
+ super(...arguments);
5934
+ this.initialRateTime = 0;
5935
+ this.finalRateTime = 0;
5936
+ }
5390
5937
  /**
5391
5938
  * The generic osu!droid score multiplier of this `Mod`.
5392
5939
  */
@@ -5400,11 +5947,9 @@ class ModTimeRamp extends Mod {
5400
5947
  get migrationDroidScoreMultiplier() {
5401
5948
  return this.droidScoreMultiplier;
5402
5949
  }
5403
- constructor() {
5404
- super();
5405
- this.initialRateTime = 0;
5406
- this.finalRateTime = 0;
5407
- this.incompatibleMods.add(ModTimeRamp);
5950
+ isCompatibleWith(other) {
5951
+ return (!this.isInstanceOfAny(other, ModTimeRamp) &&
5952
+ super.isCompatibleWith(other));
5408
5953
  }
5409
5954
  applyToBeatmap(beatmap) {
5410
5955
  var _a, _b, _c, _d;
@@ -5433,12 +5978,6 @@ ModTimeRamp.finalRateProgress = 0.75;
5433
5978
  * Represents the Wind Down mod.
5434
5979
  */
5435
5980
  class ModWindDown extends ModTimeRamp {
5436
- get droidScoreMultiplier() {
5437
- return super.droidScoreMultiplier;
5438
- }
5439
- get migrationDroidScoreMultiplier() {
5440
- return super.migrationDroidScoreMultiplier;
5441
- }
5442
5981
  constructor() {
5443
5982
  super();
5444
5983
  this.name = "Wind Down";
@@ -5447,7 +5986,6 @@ class ModWindDown extends ModTimeRamp {
5447
5986
  this.isDroidRelevant = true;
5448
5987
  this.osuRanked = false;
5449
5988
  this.isOsuRelevant = true;
5450
- this.osuScoreMultiplier = 1;
5451
5989
  this.initialRate = new DecimalModSetting("Initial rate", "initialRate", "The starting speed of the track.", 1, 0.51, 2, 0.01, 2);
5452
5990
  this.finalRate = new DecimalModSetting("Final rate", "finalRate", "The final speed to ramp to.", 0.75, 0.5, 1.99, 0.01, 2);
5453
5991
  this.initialRate.bindValueChanged((value) => {
@@ -5467,12 +6005,6 @@ class ModWindDown extends ModTimeRamp {
5467
6005
  * Represents the Wind Up mod.
5468
6006
  */
5469
6007
  class ModWindUp extends ModTimeRamp {
5470
- get droidScoreMultiplier() {
5471
- return super.droidScoreMultiplier;
5472
- }
5473
- get migrationDroidScoreMultiplier() {
5474
- return super.migrationDroidScoreMultiplier;
5475
- }
5476
6008
  constructor() {
5477
6009
  super();
5478
6010
  this.name = "Wind Up";
@@ -5481,7 +6013,6 @@ class ModWindUp extends ModTimeRamp {
5481
6013
  this.isDroidRelevant = true;
5482
6014
  this.osuRanked = false;
5483
6015
  this.isOsuRelevant = true;
5484
- this.osuScoreMultiplier = 1;
5485
6016
  this.initialRate = new DecimalModSetting("Initial rate", "initialRate", "The starting speed of the track.", 1, 0.5, 1.99, 0.01, 2);
5486
6017
  this.finalRate = new DecimalModSetting("Final rate", "finalRate", "The final speed to ramp to.", 1.5, 0.51, 2, 0.01, 2);
5487
6018
  this.initialRate.bindValueChanged((value) => {
@@ -5520,69 +6051,6 @@ class ModUtil {
5520
6051
  }
5521
6052
  return map;
5522
6053
  }
5523
- /**
5524
- * Calculates the score multiplier of the given mods and game mode.
5525
- *
5526
- * @param mods The mods to calculate the score multiplier for.
5527
- * @param mode The game mode to calculate the score multiplier for.
5528
- * @param difficulty The `BeatmapDifficulty` to apply to the mods. Needed for some mods to have an effect on
5529
- * score multiplier (i.e., `ModDifficultyAdjust`).
5530
- * @returns The score multiplier.
5531
- */
5532
- static calculateScoreMultiplier(mods, mode, difficulty) {
5533
- return this.calculateScoreMultiplierInternal(mods, mode, (mod) => {
5534
- switch (mode) {
5535
- case exports.Modes.Droid:
5536
- return mod.isApplicableToDroid()
5537
- ? mod.droidScoreMultiplier
5538
- : 1;
5539
- case exports.Modes.Osu:
5540
- return mod.isApplicableToOsuStable()
5541
- ? mod.osuScoreMultiplier
5542
- : 1;
5543
- default:
5544
- return 1;
5545
- }
5546
- }, (helper) => helper.droidScoreMultiplier, difficulty);
5547
- }
5548
- /**
5549
- * Calculates the score multiplier for the selected `Mod`s using `Mod.migrationDroidScoreMultiplier` instead of
5550
- * `Mod.droidScoreMultiplier`. Use this when reverse-engineering raw scores from stored effective scores during migration.
5551
- *
5552
- * @param mods The selected `Mod`s.
5553
- * @return The migration score multiplier.
5554
- */
5555
- static calculateMigrationScoreMultiplier(mods) {
5556
- return this.calculateScoreMultiplierInternal(mods, exports.Modes.Droid, (mod) => mod.isApplicableToDroid()
5557
- ? mod.migrationDroidScoreMultiplier
5558
- : 1, (helper) => helper.migrationDroidScoreMultiplier);
5559
- }
5560
- static calculateScoreMultiplierInternal(mods, mode, modSelector, rateAdjustSelector, difficulty) {
5561
- // In osu!droid, rate-adjusting mods combine their track rate multipliers together, then bunched together.
5562
- let totalRateAdjustTrackRateMultiplier = 1;
5563
- let scoreMultiplier = 1;
5564
- for (const mod of mods) {
5565
- if (mod.requiresBeatmapDifficulty() && difficulty) {
5566
- mod.applyFromBeatmapDifficulty(difficulty);
5567
- }
5568
- if (mode === exports.Modes.Droid && mod instanceof ModRateAdjust) {
5569
- totalRateAdjustTrackRateMultiplier *= mod.rate;
5570
- }
5571
- else {
5572
- const multiplierValue = modSelector(mod);
5573
- scoreMultiplier =
5574
- mode === exports.Modes.Droid
5575
- ? Math.fround(scoreMultiplier * Math.fround(multiplierValue))
5576
- : scoreMultiplier * multiplierValue;
5577
- }
5578
- }
5579
- if (mode === exports.Modes.Droid) {
5580
- const rateAdjustHelper = new ModRateAdjustHelper(totalRateAdjustTrackRateMultiplier);
5581
- scoreMultiplier = Math.fround(scoreMultiplier *
5582
- Math.fround(rateAdjustSelector(rateAdjustHelper)));
5583
- }
5584
- return scoreMultiplier;
5585
- }
5586
6054
  /**
5587
6055
  * Serializes a list of `Mod`s.
5588
6056
  *
@@ -5772,6 +6240,7 @@ ModUtil.allMods = (() => {
5772
6240
  const mods = [
5773
6241
  // Janky order to keep the order on what players are used to
5774
6242
  ModAuto,
6243
+ ModCinema,
5775
6244
  ModRelax,
5776
6245
  ModAutopilot,
5777
6246
  ModEasy,
@@ -5783,6 +6252,7 @@ ModUtil.allMods = (() => {
5783
6252
  ModDoubleTime,
5784
6253
  ModNightCore,
5785
6254
  ModHalfTime,
6255
+ ModDaycore,
5786
6256
  ModCustomSpeed,
5787
6257
  ModWindDown,
5788
6258
  ModWindUp,
@@ -5806,6 +6276,21 @@ ModUtil.allMods = (() => {
5806
6276
  ModSmallCircle,
5807
6277
  ModSpunOut,
5808
6278
  ModTouchDevice,
6279
+ ModAccuracyChallenge,
6280
+ ModAlternate,
6281
+ ModSingleTap,
6282
+ ModStrictTracking,
6283
+ ModClassic,
6284
+ ModTargetPractice,
6285
+ ModNoScope,
6286
+ ModBarrelRoll,
6287
+ ModBloom,
6288
+ ModBubbles,
6289
+ ModDepth,
6290
+ ModRepel,
6291
+ ModSpinIn,
6292
+ ModTransform,
6293
+ ModWiggle,
5809
6294
  ];
5810
6295
  const map = new Map();
5811
6296
  for (const mod of mods) {
@@ -5857,9 +6342,10 @@ class ModMap extends Map {
5857
6342
  }
5858
6343
  const existing = this.get(key);
5859
6344
  // Check if there are any mods that are incompatible with the new mod.
5860
- // If so, remove them.
6345
+ // If so, remove them. Both directions are checked since `isCompatibleWith` is not
6346
+ // guaranteed to be symmetric between two `Mod`s.
5861
6347
  for (const mod of this.values()) {
5862
- if (!value.isCompatibleWith(mod)) {
6348
+ if (!value.isCompatibleWith(mod) || !mod.isCompatibleWith(value)) {
5863
6349
  this.delete(mod.constructor);
5864
6350
  }
5865
6351
  }
@@ -5906,6 +6392,268 @@ class ModMap extends Map {
5906
6392
  }
5907
6393
  }
5908
6394
 
6395
+ /**
6396
+ * Calculates the multiplier to be applied to score with a given combination of {@link Mod}s.
6397
+ */
6398
+ class ScoreMultiplierCalculator {
6399
+ constructor(
6400
+ /**
6401
+ * The {@link BeatmapDifficulty} for the beatmap that the multipliers are calculated for. This must be the
6402
+ * {@link BeatmapDifficulty} for the beatmap **before** any {@link Mod} application.
6403
+ */
6404
+ difficulty) {
6405
+ this.difficulty = difficulty;
6406
+ this.singleMultipliers = new Map();
6407
+ this.combinationMultipliers = [];
6408
+ this.groupMultipliers = [];
6409
+ }
6410
+ /**
6411
+ * Defines a score multiplier for the given {@link Mod}.
6412
+ *
6413
+ * @param modClass The class of the {@link Mod} to define a multiplier for.
6414
+ * @param multiplier The multiplier to apply when the {@link Mod} is present, or a function that returns the
6415
+ * multiplier based on the {@link Mod} instance.
6416
+ */
6417
+ single(modClass, multiplier) {
6418
+ this.singleMultipliers.set(modClass, typeof multiplier === "number"
6419
+ ? () => multiplier
6420
+ : multiplier);
6421
+ }
6422
+ /**
6423
+ * Defines a score multiplier specific to when two {@link Mod}s are present. In that case, the combination
6424
+ * multiplier will be used instead of the individual single multipliers, if any.
6425
+ *
6426
+ * @param modClass1 The class of the first {@link Mod} to define a combination multiplier for.
6427
+ * @param modClass2 The class of the second {@link Mod} to define a combination multiplier for.
6428
+ * @param multiplier The multiplier to apply when both {@link Mod}s are present, or a function that returns the
6429
+ * multiplier based on the two {@link Mod} instances.
6430
+ */
6431
+ combination(modClass1, modClass2, multiplier) {
6432
+ this.combinationMultipliers.push([
6433
+ [modClass1, modClass2],
6434
+ typeof multiplier === "number"
6435
+ ? () => multiplier
6436
+ : ([mod1, mod2]) => multiplier(mod1, mod2),
6437
+ ]);
6438
+ }
6439
+ /**
6440
+ * Defines a score multiplier for all {@link Mod}s that are instances of {@link TMod}, applied as a group. The multiplier
6441
+ * function receives the full list of matched {@link Mod}s, allowing their combined state to influence the result.
6442
+ * Group multipliers take precedence over single multipliers for the same {@link Mod}s.
6443
+ *
6444
+ * @param modClass The class of the {@link Mod} to define a group multiplier for.
6445
+ * @param multiplier The multiplier to apply when one or more {@link Mod}s of the specified class are present, or a function
6446
+ * that returns the multiplier based on the list of matched {@link Mod} instances.
6447
+ */
6448
+ group(modClass, multiplier) {
6449
+ this.groupMultipliers.push([
6450
+ modClass,
6451
+ typeof multiplier === "number"
6452
+ ? () => multiplier
6453
+ : (mods) => multiplier(mods),
6454
+ ]);
6455
+ }
6456
+ /**
6457
+ * Calculates the multiplier to be applied to score with the given {@link Mod}s.
6458
+ *
6459
+ * @param mods The list of {@link Mod}s to calculate the score multiplier for.
6460
+ * @returns The calculated score multiplier.
6461
+ */
6462
+ calculateFor(mods) {
6463
+ var _a;
6464
+ const remaining = new Set(mods);
6465
+ let result = 1;
6466
+ if (remaining.size > 1) {
6467
+ for (const [classes, multiplier] of this.combinationMultipliers) {
6468
+ const instances = classes.map((c) => Array.from(remaining).find((m) => m instanceof c));
6469
+ if (instances.every(Boolean)) {
6470
+ result = this.multiply(result, multiplier(instances));
6471
+ instances.forEach((m) => remaining.delete(m));
6472
+ }
6473
+ }
6474
+ }
6475
+ for (const [groupClass, multiplier] of this.groupMultipliers) {
6476
+ const matched = Array.from(remaining).filter((m) => m instanceof groupClass);
6477
+ if (matched.length > 0) {
6478
+ result = this.multiply(result, multiplier(matched));
6479
+ matched.forEach((m) => remaining.delete(m));
6480
+ }
6481
+ }
6482
+ for (const mod of remaining) {
6483
+ const multiplier = this.singleMultipliers.get(mod.constructor);
6484
+ result = this.multiply(result, (_a = multiplier === null || multiplier === void 0 ? void 0 : multiplier(mod)) !== null && _a !== void 0 ? _a : 1);
6485
+ }
6486
+ return result;
6487
+ }
6488
+ /**
6489
+ * Multiplies two numbers together. This method is provided to allow subclasses to override the multiplication behavior if needed.
6490
+ *
6491
+ * @param a The first number to multiply.
6492
+ * @param b The second number to multiply.
6493
+ * @returns The product of the two numbers.
6494
+ */
6495
+ multiply(a, b) {
6496
+ return a * b;
6497
+ }
6498
+ }
6499
+
6500
+ /**
6501
+ * Current osu!droid score multiplier calculator. This is used to calculate score after version 5 database migration.
6502
+ */
6503
+ class DroidScoreMultiplierCalculator extends ScoreMultiplierCalculator {
6504
+ constructor(difficulty) {
6505
+ super(difficulty);
6506
+ this.appliedDifficulty = null;
6507
+ //#region Difficulty Reduction
6508
+ this.single(ModEasy, 0.8);
6509
+ this.single(ModNoFail, 0.5);
6510
+ this.single(ModReallyEasy, 0.3);
6511
+ //#endregion
6512
+ //#region Difficulty Increase
6513
+ this.single(ModHardRock, 1.04);
6514
+ this.single(ModPrecise, () => this.preciseMultiplier());
6515
+ this.single(ModHidden, (hd) => this.hiddenMultiplier(hd));
6516
+ this.single(ModTraceable, 1.02);
6517
+ this.combination(ModFlashlight, ModFreezeFrame, (fl) => 1 + (this.flashlightMultiplier(fl) - 1) / 2);
6518
+ this.single(ModFlashlight, (fl) => this.flashlightMultiplier(fl));
6519
+ //#endregion
6520
+ //#region Conversion
6521
+ this.single(ModDifficultyAdjust, (da) => this.difficultyAdjustMultiplier(da));
6522
+ this.group(ModRateAdjust, (mods) => this.rateAdjustMultiplier(mods));
6523
+ //#endregion
6524
+ //#region Automation
6525
+ this.single(ModRelax, 1e-3);
6526
+ this.single(ModAutopilot, 1e-3);
6527
+ //#endregion
6528
+ //#region Fun
6529
+ this.single(ModRandom, 0.7);
6530
+ this.single(ModApproachDifferent, 0.7);
6531
+ this.single(ModWindUp, (wu) => this.timeRampMultiplier(wu));
6532
+ this.single(ModWindDown, (wd) => this.timeRampMultiplier(wd));
6533
+ //#endregion
6534
+ }
6535
+ calculateFor(mods) {
6536
+ // `mods` may be a one-shot iterator (e.g. `ModMap.values()`), which would be exhausted after the first
6537
+ // pass below. Materialize it once so it can be safely iterated again by `super.calculateFor`.
6538
+ const modList = [...mods];
6539
+ const { difficulty } = this;
6540
+ if (difficulty) {
6541
+ this.appliedDifficulty = new BeatmapDifficulty(difficulty);
6542
+ const modMap = new ModMap();
6543
+ for (const mod of modList) {
6544
+ modMap.set(mod);
6545
+ }
6546
+ ModUtil.applyModsToBeatmapDifficulty(this.appliedDifficulty, exports.Modes.Droid, modMap);
6547
+ }
6548
+ else {
6549
+ this.appliedDifficulty = null;
6550
+ }
6551
+ return super.calculateFor(modList);
6552
+ }
6553
+ difficultyAdjustMultiplier(mod) {
6554
+ const { difficulty } = this;
6555
+ // Graph: https://www.desmos.com/calculator/yrggkhrkzz
6556
+ let multiplier = 1;
6557
+ if (difficulty) {
6558
+ if (mod.cs.value !== null) {
6559
+ const diff = mod.cs.value - difficulty.cs;
6560
+ multiplier *=
6561
+ diff >= 0
6562
+ ? 1 + 0.0075 * Math.pow(diff, 1.5)
6563
+ : 2 / (1 + Math.exp(-0.5 * diff));
6564
+ }
6565
+ if (mod.od.value !== null) {
6566
+ const diff = mod.od.value - difficulty.od;
6567
+ multiplier *=
6568
+ diff >= 0
6569
+ ? 1 + 0.005 * Math.pow(diff, 1.3)
6570
+ : 2 / (1 + Math.exp(-0.25 * diff));
6571
+ }
6572
+ }
6573
+ return multiplier;
6574
+ }
6575
+ preciseMultiplier() {
6576
+ const { appliedDifficulty } = this;
6577
+ // Keep original multiplier if applied difficulty is not present.
6578
+ if (!appliedDifficulty) {
6579
+ return 1.06;
6580
+ }
6581
+ return 1.02 + 0.08 * Math.pow(appliedDifficulty.od / 10, 2);
6582
+ }
6583
+ hiddenMultiplier(mod) {
6584
+ let value = 1.06;
6585
+ if (mod.onlyFadeApproachCircles.value) {
6586
+ value -= 0.03;
6587
+ }
6588
+ return value;
6589
+ }
6590
+ flashlightMultiplier(mod) {
6591
+ // Multiplier of 1.2x, reduced by 0.02 per 0.1 increase in flashlight size.
6592
+ let value = MathUtils.clamp(1.2 - 0.2 * (mod.sizeMultiplier.value - 1), 1.02, 1.2);
6593
+ if (!mod.comboBasedSize.value) {
6594
+ value = 1 + (value - 1) / 5;
6595
+ }
6596
+ return value;
6597
+ }
6598
+ rateAdjustMultiplier(mods) {
6599
+ const multiplier = mods.reduce((acc, mod) => acc * mod.rate, 1);
6600
+ return this.rateMultiplier(multiplier);
6601
+ }
6602
+ rateMultiplier(rate) {
6603
+ return rate >= 1
6604
+ ? // Linear from 1.0 to 1.46.
6605
+ // Default DT (1.5x) = 1.23
6606
+ 1 + (rate - 1) * 0.46
6607
+ : // 0.25x at 0.5x speed, +0.075x per 0.05x speed increment.
6608
+ // Default HT (0.75x) = 0.625.
6609
+ Math.max(0.1, rate * 1.5 - 0.5);
6610
+ }
6611
+ timeRampMultiplier(mod) {
6612
+ const minSpeed = Math.min(mod.initialRate.value, mod.finalRate.value);
6613
+ const maxSpeed = Math.max(mod.initialRate.value, mod.finalRate.value);
6614
+ const minMultiplier = this.rateMultiplier(minSpeed);
6615
+ const maxMultiplier = this.rateMultiplier(maxSpeed);
6616
+ return 0.8 * minMultiplier + 0.2 * maxMultiplier;
6617
+ }
6618
+ }
6619
+
6620
+ /**
6621
+ * A score multiplier calculator for osu!stable.
6622
+ */
6623
+ class OsuLegacyScoreMultiplierCalculator extends ScoreMultiplierCalculator {
6624
+ constructor() {
6625
+ super(null);
6626
+ //#region Difficulty Reduction
6627
+ this.single(ModEasy, 0.5);
6628
+ this.single(ModNoFail, 0.5);
6629
+ this.single(ModHalfTime, 0.3);
6630
+ //#endregion
6631
+ //#region Difficulty Increase
6632
+ this.single(ModHardRock, 1.06);
6633
+ // Sudden Death
6634
+ // Perfect
6635
+ this.single(ModDoubleTime, 1.12);
6636
+ this.single(ModNightCore, 1.12);
6637
+ this.single(ModHidden, 1.06);
6638
+ this.single(ModFlashlight, 1.12);
6639
+ //#endregion
6640
+ //#region Special
6641
+ this.single(ModRelax, 0);
6642
+ this.single(ModAutopilot, 0);
6643
+ this.single(ModSpunOut, 0.9);
6644
+ // Autoplay
6645
+ // ScoreV2
6646
+ // Target Practice
6647
+ //#endregion
6648
+ //#region ScoreV2-specific
6649
+ this.combination(ModNoFail, ModScoreV2, 1);
6650
+ this.combination(ModHardRock, ModScoreV2, 1.1);
6651
+ this.combination(ModDoubleTime, ModScoreV2, 1.2);
6652
+ this.combination(ModNightCore, ModScoreV2, 1.2);
6653
+ //#endregion
6654
+ }
6655
+ }
6656
+
5909
6657
  /**
5910
6658
  * Contains information about hit objects of a beatmap.
5911
6659
  */
@@ -6354,6 +7102,9 @@ BeatmapProcessor.stackDistance = 3;
6354
7102
  * Represents a beatmap that is in a playable state for a specific game mode.
6355
7103
  */
6356
7104
  class PlayableBeatmap {
7105
+ get maxCombo() {
7106
+ return this.baseBeatmap.maxCombo;
7107
+ }
6357
7108
  /**
6358
7109
  * The `HitWindow` of this `PlayableBeatmap`.
6359
7110
  */
@@ -6368,6 +7119,7 @@ class PlayableBeatmap {
6368
7119
  * @param mods The `Mod`s that were applied to this `PlayableBeatmap`.
6369
7120
  */
6370
7121
  constructor(baseBeatmap, mods) {
7122
+ this.baseBeatmap = baseBeatmap;
6371
7123
  this._hitWindow = null;
6372
7124
  this.formatVersion = baseBeatmap.formatVersion;
6373
7125
  this.general = baseBeatmap.general;
@@ -6378,7 +7130,6 @@ class PlayableBeatmap {
6378
7130
  this.controlPoints = baseBeatmap.controlPoints;
6379
7131
  this.colors = baseBeatmap.colors;
6380
7132
  this.hitObjects = baseBeatmap.hitObjects;
6381
- this.maxCombo = baseBeatmap.maxCombo;
6382
7133
  this.mods = mods;
6383
7134
  this.speedMultiplier = ModUtil.calculateRateWithMods(this.mods.values(), Number.POSITIVE_INFINITY);
6384
7135
  }
@@ -7150,10 +7901,10 @@ class Beatmap {
7150
7901
  */
7151
7902
  maxDroidScore(mods) {
7152
7903
  const scoreMultiplier = mods
7153
- ? ModUtil.calculateScoreMultiplier(mods.values(), exports.Modes.Droid, this.difficulty)
7904
+ ? new DroidScoreMultiplierCalculator(this.difficulty).calculateFor(mods.values())
7154
7905
  : 1;
7155
7906
  if (mods === null || mods === void 0 ? void 0 : mods.has(ModScoreV2)) {
7156
- return Math.round(Math.fround(1e6 * scoreMultiplier));
7907
+ return Math.round(1e6 * scoreMultiplier);
7157
7908
  }
7158
7909
  const difficultyMultiplier = 1 +
7159
7910
  this.difficulty.od / 10 +
@@ -7193,7 +7944,7 @@ class Beatmap {
7193
7944
  score += Math.floor(300 + (300 * combo * difficultyMultiplier) / 25);
7194
7945
  ++combo;
7195
7946
  }
7196
- return Math.round(Math.fround(score * scoreMultiplier));
7947
+ return Math.round(score * scoreMultiplier);
7197
7948
  }
7198
7949
  /**
7199
7950
  * Calculates the osu!standard maximum score of the beatmap without taking spinner bonus into account.
@@ -7204,7 +7955,7 @@ class Beatmap {
7204
7955
  const accumulatedDiffPoints = this.difficulty.cs + this.difficulty.hp + this.difficulty.od;
7205
7956
  let difficultyMultiplier = 2;
7206
7957
  const scoreMultiplier = mods
7207
- ? ModUtil.calculateScoreMultiplier(mods.values(), exports.Modes.Osu, this.difficulty)
7958
+ ? new OsuLegacyScoreMultiplierCalculator().calculateFor(mods.values())
7208
7959
  : 1;
7209
7960
  if (mods === null || mods === void 0 ? void 0 : mods.has(ModScoreV2)) {
7210
7961
  return 1e6 * scoreMultiplier;
@@ -11840,11 +12591,27 @@ class ModOldNightCore extends ModNightCore {
11840
12591
  super(...arguments);
11841
12592
  this.rate = (44.1 * 1.5) / 48;
11842
12593
  }
11843
- get droidScoreMultiplier() {
11844
- return 1.12;
11845
- }
11846
- get migrationDroidScoreMultiplier() {
11847
- return this.droidScoreMultiplier;
12594
+ }
12595
+
12596
+ /**
12597
+ * Represents a transport-level failure of an API request (e.g., DNS failure, timeout,
12598
+ * connection refused) that persisted across every retry attempt.
12599
+ *
12600
+ * This is distinct from a received HTTP response with a non-2xx status code, which is
12601
+ * not an error at the transport level and is represented by a normal `RequestResponse`.
12602
+ */
12603
+ class APIRequestError extends Error {
12604
+ /**
12605
+ * @param message The error message.
12606
+ * @param url The URL that was requested.
12607
+ * @param attempts The amount of attempts that were made before giving up.
12608
+ * @param cause The underlying error that was thrown on the final attempt.
12609
+ */
12610
+ constructor(message, url, attempts, cause) {
12611
+ super(message, { cause });
12612
+ this.url = url;
12613
+ this.attempts = attempts;
12614
+ this.name = "APIRequestError";
11848
12615
  }
11849
12616
  }
11850
12617
 
@@ -11923,6 +12690,61 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
11923
12690
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
11924
12691
  };
11925
12692
 
12693
+ /**
12694
+ * Wraps the `fetch` response an API request obtained, pairing it with the pre-read
12695
+ * request body and the amount of attempts it took to obtain it.
12696
+ *
12697
+ * The body is read out once, eagerly, rather than lazily from the underlying `Response`
12698
+ * itself, since a `fetch` response body stream can only be consumed once - reading it
12699
+ * eagerly avoids that footgun and lets `data` be read as many times as needed.
12700
+ */
12701
+ class RequestResponse {
12702
+ /**
12703
+ * @param response The raw `fetch` response this result was obtained from.
12704
+ * @param data The result of the API request, already read out of `response`'s body.
12705
+ * @param attempts The amount of attempts it took to obtain this response.
12706
+ */
12707
+ constructor(response, data, attempts) {
12708
+ this.response = response;
12709
+ this.data = data;
12710
+ this.attempts = attempts;
12711
+ }
12712
+ /**
12713
+ * The status code of the API request.
12714
+ */
12715
+ get statusCode() {
12716
+ return this.response.status;
12717
+ }
12718
+ /**
12719
+ * The status text of the API request (e.g., "Too Many Requests" for status code 429).
12720
+ */
12721
+ get statusText() {
12722
+ return this.response.statusText;
12723
+ }
12724
+ /**
12725
+ * The final URL of the API request, after any redirects.
12726
+ */
12727
+ get url() {
12728
+ return this.response.url;
12729
+ }
12730
+ /**
12731
+ * The response headers of the API request.
12732
+ */
12733
+ get headers() {
12734
+ return this.response.headers;
12735
+ }
12736
+ /**
12737
+ * Formats the status code, status text, and (if present) `Retry-After` header of
12738
+ * this response into a human-readable diagnostic string, e.g.
12739
+ * `"429 Too Many Requests (Retry-After: 30)"`.
12740
+ */
12741
+ describeFailure() {
12742
+ const retryAfter = this.headers.get("retry-after");
12743
+ return (`${this.statusCode.toString()} ${this.statusText}` +
12744
+ (retryAfter ? ` (Retry-After: ${retryAfter})` : ""));
12745
+ }
12746
+ }
12747
+
11926
12748
  /**
11927
12749
  * The base of API request builders.
11928
12750
  */
@@ -11941,7 +12763,6 @@ class APIRequestBuilder {
11941
12763
  * The parameters of this builder.
11942
12764
  */
11943
12765
  this.params = new Map();
11944
- this.fetchAttempts = 0;
11945
12766
  }
11946
12767
  /**
11947
12768
  * The base URL of this builder.
@@ -11983,37 +12804,54 @@ class APIRequestBuilder {
11983
12804
  }
11984
12805
  return url;
11985
12806
  }
12807
+ static backoffDelay(attempt) {
12808
+ const base = 0.25;
12809
+ const exponential = base * Math.pow(2, (attempt - 1));
12810
+ const jitter = exponential * 0.25 * Math.random();
12811
+ return exponential + jitter;
12812
+ }
12813
+ /**
12814
+ * Redacts the API key value from a URL string so it does not leak into logs or thrown errors.
12815
+ */
12816
+ static redactURL(url) {
12817
+ return url.replace(/([?&](?:k|apiKey)=)[^&]*/g, "$1<redacted>");
12818
+ }
11986
12819
  /**
11987
12820
  * Sends a request to the API using built parameters.
11988
12821
  *
11989
- * If the request fails, it will be redone 5 times.
12822
+ * If the request fails (a 5xx response, or the request itself throwing), it will be
12823
+ * retried up to 5 times with exponential backoff between attempts.
12824
+ *
12825
+ * Resolves with the response for any HTTP response actually received, whatever its
12826
+ * status code. Only rejects with an `APIRequestError` if every attempt's request threw
12827
+ * (e.g., DNS failure, timeout, connection refused) rather than receiving a response.
11990
12828
  */
11991
12829
  sendRequest() {
11992
- return new Promise((resolve) => {
12830
+ return __awaiter(this, void 0, void 0, function* () {
11993
12831
  const url = this.buildURL();
11994
- fetch(url)
11995
- .then((res) => __awaiter(this, void 0, void 0, function* () {
11996
- ++this.fetchAttempts;
11997
- if (res.status >= 500 && this.fetchAttempts < 5) {
11998
- console.error(`Request to ${url} failed with the following error: ${yield res.text()}; ${this.fetchAttempts.toString()} attempts so far; retrying`);
11999
- resolve(this.sendRequest());
12000
- return;
12832
+ const maxAttempts = APIRequestBuilder.maxAttempts;
12833
+ let lastError;
12834
+ for (let attempt = 1; attempt <= maxAttempts; ++attempt) {
12835
+ try {
12836
+ const res = yield fetch(url);
12837
+ if (res.status >= 500 && attempt < maxAttempts) {
12838
+ const body = yield res.text();
12839
+ console.error(`Request to ${APIRequestBuilder.redactURL(url)} failed with status ${res.status.toString()}: ${body}; attempt ${attempt.toString()} of ${maxAttempts.toString()}; retrying`);
12840
+ yield Utils.sleep(APIRequestBuilder.backoffDelay(attempt));
12841
+ continue;
12842
+ }
12843
+ return new RequestResponse(res, Buffer.from(yield res.arrayBuffer()), attempt);
12001
12844
  }
12002
- this.fetchAttempts = 0;
12003
- resolve({
12004
- data: Buffer.from(yield res.arrayBuffer()),
12005
- statusCode: res.status,
12006
- });
12007
- }))
12008
- .catch((e) => {
12009
- console.error(`Request to ${url} failed with the following error: ${e.message}; ${this.fetchAttempts.toString()} attempts so far; aborting`);
12010
- this.fetchAttempts = 0;
12011
- resolve({
12012
- data: Buffer.from([]),
12013
- statusCode: 400,
12014
- });
12015
- return;
12016
- });
12845
+ catch (e) {
12846
+ lastError = e;
12847
+ if (attempt < maxAttempts) {
12848
+ console.error(`Request to ${APIRequestBuilder.redactURL(url)} failed with error: ${e.message}; attempt ${attempt.toString()} of ${maxAttempts.toString()}; retrying`);
12849
+ yield Utils.sleep(APIRequestBuilder.backoffDelay(attempt));
12850
+ }
12851
+ }
12852
+ }
12853
+ const redactedURL = APIRequestBuilder.redactURL(url);
12854
+ throw new APIRequestError(`Request to ${redactedURL} failed after ${maxAttempts.toString()} attempts`, redactedURL, maxAttempts, lastError);
12017
12855
  });
12018
12856
  }
12019
12857
  /**
@@ -12036,6 +12874,10 @@ class APIRequestBuilder {
12036
12874
  return this;
12037
12875
  }
12038
12876
  }
12877
+ /**
12878
+ * The maximum amount of attempts `sendRequest` will make before giving up.
12879
+ */
12880
+ APIRequestBuilder.maxAttempts = 5;
12039
12881
 
12040
12882
  /**
12041
12883
  * An API request builder for osu!droid.
@@ -12297,7 +13139,7 @@ class MapInfo {
12297
13139
  .addParameter(typeof beatmapIdOrHash === "string" ? "h" : "b", beatmapIdOrHash);
12298
13140
  const result = yield apiRequestBuilder.sendRequest();
12299
13141
  if (result.statusCode !== 200) {
12300
- throw new Error("osu! API error");
13142
+ throw new Error(`osu! API error: ${result.describeFailure()}`);
12301
13143
  }
12302
13144
  const mapinfo = JSON.parse(result.data.toString("utf-8")).at(0);
12303
13145
  if (!mapinfo) {
@@ -12482,96 +13324,427 @@ class MapInfo {
12482
13324
  }
12483
13325
  }
12484
13326
 
13327
+ /**
13328
+ * osu!droid legacy score multiplier calculator. This is used to calculate score during version 4 to 5 database migration
13329
+ * by separating the total score with mod multipliers from the multiplier itself. This allows future mod score multiplier
13330
+ * changes to be applied without database migrations.
13331
+ */
13332
+ class DroidLegacyScoreMultiplierCalculator extends ScoreMultiplierCalculator {
13333
+ constructor(difficulty) {
13334
+ super(difficulty);
13335
+ //#region Difficulty Reduction
13336
+ this.single(ModEasy, 0.5);
13337
+ this.single(ModNoFail, 0.5);
13338
+ this.single(ModReallyEasy, 0.5);
13339
+ //#endregion
13340
+ //#region Difficulty Increase
13341
+ this.single(ModHardRock, 1.06);
13342
+ this.single(ModPrecise, 1.06);
13343
+ this.single(ModHidden, (h) => (h.usesDefaultSettings ? 1.06 : 1));
13344
+ this.single(ModTraceable, 1.06);
13345
+ this.single(ModFlashlight, (f) => (f.usesDefaultSettings ? 1.12 : 1));
13346
+ //#endregion
13347
+ //#region Conversion
13348
+ this.single(ModDifficultyAdjust, (da) => this.difficultyAdjustMultiplier(da));
13349
+ this.group(ModRateAdjust, (mods) => this.rateAdjustMultiplier(mods));
13350
+ //#endregion
13351
+ //#region Automation
13352
+ this.single(ModRelax, 1e-3);
13353
+ this.single(ModAutopilot, 1e-3);
13354
+ //#endregion
13355
+ //#region Fun
13356
+ this.single(ModWindUp, (wu) => this.timeRampMultiplier(wu));
13357
+ this.single(ModWindDown, (wd) => this.timeRampMultiplier(wd));
13358
+ //#endregion
13359
+ }
13360
+ difficultyAdjustMultiplier(mod) {
13361
+ const { difficulty } = this;
13362
+ if (!difficulty) {
13363
+ return 1;
13364
+ }
13365
+ // Graph: https://www.desmos.com/calculator/yrggkhrkzz
13366
+ let multiplier = 1;
13367
+ if (mod.cs.value !== null) {
13368
+ const diff = mod.cs.value - difficulty.cs;
13369
+ multiplier *=
13370
+ diff >= 0
13371
+ ? 1 + 0.0075 * Math.pow(diff, 1.5)
13372
+ : 2 / (1 + Math.exp(-0.5 * diff));
13373
+ }
13374
+ if (mod.od.value !== null) {
13375
+ const diff = mod.od.value - difficulty.od;
13376
+ multiplier *=
13377
+ diff >= 0
13378
+ ? 1 + 0.005 * Math.pow(diff, 1.3)
13379
+ : 2 / (1 + Math.exp(-0.25 * diff));
13380
+ }
13381
+ return multiplier;
13382
+ }
13383
+ rateAdjustMultiplier(mods) {
13384
+ const multiplier = mods.reduce((acc, mod) => acc * mod.rate, 1);
13385
+ return this.rateMultiplier(multiplier);
13386
+ }
13387
+ rateMultiplier(rate) {
13388
+ return rate >= 1
13389
+ ? 1 + (rate - 1) * 0.24
13390
+ : Math.pow(0.3, (1 - rate) * 4);
13391
+ }
13392
+ timeRampMultiplier(mod) {
13393
+ return Interpolation.lerp(this.rateMultiplier(mod.initialRate.value), this.rateMultiplier(mod.finalRate.value), ModTimeRamp.finalRateProgress);
13394
+ }
13395
+ multiply(a, b) {
13396
+ return Math.fround(a * Math.fround(b));
13397
+ }
13398
+ }
13399
+
13400
+ /**
13401
+ * A score multiplier calculator for osu!standard.
13402
+ *
13403
+ * Used before osu!lazer version 2026.621.0.
13404
+ */
13405
+ class OsuScoreMultiplierCalculatorV1 extends ScoreMultiplierCalculator {
13406
+ constructor() {
13407
+ super(null);
13408
+ //#region Difficulty Reduction
13409
+ this.single(ModEasy, 0.5);
13410
+ this.single(ModNoFail, 0.5);
13411
+ this.single(ModHalfTime, (ht) => this.rateAdjustMultiplier(ht.rate));
13412
+ this.single(ModDaycore, (dc) => this.rateAdjustMultiplier(dc.rate));
13413
+ //#endregion
13414
+ //#region Difficulty Increase
13415
+ this.single(ModHardRock, (hr) => (hr.usesDefaultSettings ? 1.06 : 1));
13416
+ this.single(ModDoubleTime, (dt) => this.rateAdjustMultiplier(dt.rate));
13417
+ this.single(ModHidden, (hd) => (hd.usesDefaultSettings ? 1.06 : 1));
13418
+ this.single(ModFlashlight, (fl) => (fl.usesDefaultSettings ? 1.12 : 1));
13419
+ this.single(ModBlinds, (bl) => (bl.usesDefaultSettings ? 1.12 : 1));
13420
+ // Strict Tracking
13421
+ // Accuracy Challenge
13422
+ //#endregion
13423
+ //#region Conversion
13424
+ this.single(ModTargetPractice, 0.1);
13425
+ this.single(ModDifficultyAdjust, 0.5);
13426
+ this.single(ModClassic, 0.96);
13427
+ // Random
13428
+ // Mirror
13429
+ // Alternate
13430
+ // Single Tap
13431
+ //#endregion
13432
+ //#region Automation
13433
+ // Cinema
13434
+ this.single(ModRelax, 0.1);
13435
+ this.single(ModAutopilot, 0.1);
13436
+ this.single(ModSpunOut, 0.9);
13437
+ //#endregion
13438
+ //#region Fun
13439
+ // Transform
13440
+ // Wiggle
13441
+ // Spin In
13442
+ // Grow
13443
+ // Deflate
13444
+ this.single(ModWindUp, 0.5);
13445
+ this.single(ModWindDown, 0.5);
13446
+ // Barrel Roll
13447
+ // Approach Different
13448
+ // Muted
13449
+ // No Scope
13450
+ // Repel
13451
+ // Freeze Frame
13452
+ // Bubbles
13453
+ this.single(ModSynesthesia, 0.8);
13454
+ // Depth
13455
+ // Bloom
13456
+ //#endregion
13457
+ }
13458
+ rateAdjustMultiplier(rate) {
13459
+ // Round to the nearest multiple of 0.1.
13460
+ let value = Math.trunc(rate * 10) / 10;
13461
+ // Offset back to 0.
13462
+ value -= 1;
13463
+ return rate >= 1 ? 1 + value / 5 : 0.6 + value;
13464
+ }
13465
+ }
13466
+
13467
+ /**
13468
+ * A score multiplier calculator for osu!standard.
13469
+ *
13470
+ * Used for osu!lazer version 2026.621.0 and onwards.
13471
+ */
13472
+ class OsuScoreMultiplierCalculatorV2 extends ScoreMultiplierCalculator {
13473
+ constructor(difficulty) {
13474
+ super(difficulty);
13475
+ //#region Difficulty Reduction
13476
+ this.single(ModEasy, (ez) => this.easyMultiplier(ez));
13477
+ this.single(ModNoFail, 0.5);
13478
+ this.single(ModHalfTime, (ht) => this.halfTimeMultiplier(ht.rate));
13479
+ this.single(ModDaycore, (dc) => this.halfTimeMultiplier(dc.rate));
13480
+ //#endregion
13481
+ //#region Difficulty Increase
13482
+ this.single(ModHardRock, 1.09);
13483
+ this.single(ModDoubleTime, (dt) => this.doubleTimeMultiplier(dt.rate));
13484
+ this.single(ModNightCore, (nc) => this.doubleTimeMultiplier(nc.rate));
13485
+ const blindsMultiplier = 1.24;
13486
+ this.combination(ModHidden, ModBlinds, blindsMultiplier);
13487
+ this.combination(ModHidden, ModWiggle, (hd) => this.hiddenMultiplier(hd, true));
13488
+ this.combination(ModHidden, ModGrow, (hd) => this.hiddenMultiplier(hd, true));
13489
+ this.combination(ModHidden, ModDeflate, (hd) => this.hiddenMultiplier(hd, true));
13490
+ this.combination(ModHidden, ModRepel, (hd) => this.hiddenMultiplier(hd, true));
13491
+ this.combination(ModHidden, ModDepth, (hd) => this.hiddenMultiplier(hd, true));
13492
+ this.single(ModHidden, (hd) => this.hiddenMultiplier(hd, false));
13493
+ this.combination(ModTraceable, ModBlinds, blindsMultiplier);
13494
+ this.single(ModTraceable, 1.02);
13495
+ this.combination(ModFlashlight, ModFreezeFrame, (fl) => 1 + (this.flashlightMultiplier(fl) - 1) / 2);
13496
+ this.single(ModFlashlight, (fl) => this.flashlightMultiplier(fl));
13497
+ this.single(ModBlinds, blindsMultiplier);
13498
+ // Strict Tracking
13499
+ // Accuracy Challenge
13500
+ //#endregion
13501
+ //#region Conversion
13502
+ this.single(ModTargetPractice, 0.01);
13503
+ this.single(ModDifficultyAdjust, (da) => this.difficultyAdjustMultiplier(da));
13504
+ this.single(ModClassic, (cl) => cl.classicNoteLock.value ? 0.985 : 0.96);
13505
+ this.single(ModRandom, 0.7);
13506
+ // Mirror
13507
+ // Alternate
13508
+ // Single Tap
13509
+ //#endregion
13510
+ //#region Automation
13511
+ // Cinema
13512
+ this.single(ModRelax, 0.1);
13513
+ this.single(ModAutopilot, 0.1);
13514
+ this.single(ModSpunOut, 0.95);
13515
+ //#endregion
13516
+ //#region Fun
13517
+ // Transform
13518
+ // Wiggle
13519
+ // Spin In
13520
+ // Grow
13521
+ this.single(ModDeflate, (df) => this.deflateMultiplier(df));
13522
+ this.single(ModWindUp, (wu) => this.timeRampMultiplier(wu));
13523
+ this.single(ModWindDown, (wd) => this.timeRampMultiplier(wd));
13524
+ // Barrel Roll
13525
+ this.single(ModApproachDifferent, 0.7);
13526
+ // Muted
13527
+ // No Scope
13528
+ this.single(ModMagnetised, (mg) => 0.7 - mg.attractionStrength.value * 0.6);
13529
+ // Repel
13530
+ // Adaptive Speed
13531
+ // Freeze Frame
13532
+ // Bubbles
13533
+ this.single(ModSynesthesia, 0.99);
13534
+ // Depth
13535
+ // Bloom
13536
+ //#endregion
13537
+ }
13538
+ easyMultiplier(mod) {
13539
+ // 0.8x base multiplier
13540
+ // Reduce by 0.1x per extra life
13541
+ const value = 0.8 -
13542
+ Math.max(0, 0.1 * (mod.retries.value - mod.retries.defaultValue));
13543
+ return Math.max(0.4, value);
13544
+ }
13545
+ halfTimeMultiplier(rate) {
13546
+ // 0.2x at 0.5x speed, +0.07x per 0.05x speed increment.
13547
+ // Default HT (0.75x) = 0.55
13548
+ return (Math.trunc(rate * 20) / 20) * 1.4 - 0.5;
13549
+ }
13550
+ doubleTimeMultiplier(rate) {
13551
+ // Floor to the nearest multiple of 0.1.
13552
+ const value = Math.trunc(rate * 10) / 10;
13553
+ // 0.01 penalty for non-default rates.
13554
+ const penalty = value != 1.5 && value != 1 ? 0.01 : 0;
13555
+ // Linear from 1.0 to 1.46, minus the penalty.
13556
+ // Default DT (1.5x) = 1.23
13557
+ return (value - 1) * 0.46 + 1 - penalty;
13558
+ }
13559
+ hiddenMultiplier(mod, otherModsProvideTimingInfo) {
13560
+ let value = 1.04;
13561
+ if (mod.onlyFadeApproachCircles.value) {
13562
+ value -= 0.02;
13563
+ }
13564
+ if (otherModsProvideTimingInfo) {
13565
+ value -= 0.02;
13566
+ }
13567
+ return value;
13568
+ }
13569
+ flashlightMultiplier(mod) {
13570
+ // Multiplier of 1.2x, reduced by 0.02 per 0.1 increase in flashlight size.
13571
+ let value = MathUtils.clamp(1.2 - 0.2 * (mod.sizeMultiplier.value - 1), 1.02, 1.2);
13572
+ if (!mod.comboBasedSize.value) {
13573
+ value = 1 + (value - 1) / 5;
13574
+ }
13575
+ return value;
13576
+ }
13577
+ difficultyAdjustMultiplier(mod) {
13578
+ var _a, _b, _c, _d;
13579
+ const { difficulty } = this;
13580
+ const { cs, ar, od, hp } = mod;
13581
+ if (!difficulty) {
13582
+ return 1;
13583
+ }
13584
+ const selectedCircleSize = (_a = cs.value) !== null && _a !== void 0 ? _a : difficulty.cs;
13585
+ const selectedApproachRate = (_b = ar.value) !== null && _b !== void 0 ? _b : difficulty.ar;
13586
+ const selectedOverallDifficulty = (_c = od.value) !== null && _c !== void 0 ? _c : difficulty.od;
13587
+ const selectedHealthDrain = (_d = hp.value) !== null && _d !== void 0 ? _d : difficulty.hp;
13588
+ const csDifference = Math.abs(selectedCircleSize - difficulty.cs);
13589
+ const arDifference = Math.abs(selectedApproachRate - difficulty.ar);
13590
+ const odDifference = Math.abs(selectedOverallDifficulty - difficulty.od);
13591
+ const hpDifference = Math.abs(selectedHealthDrain - difficulty.hp);
13592
+ // Per parameter, reduce multiplier by 0.05x per 0.1 change.
13593
+ const csMultiplier = Math.max(0.1, 1 - csDifference * 0.5);
13594
+ const arMultiplier = Math.max(0.1, 1 - arDifference * 0.5);
13595
+ const odMultiplier = Math.max(0.1, 1 - odDifference * 0.5);
13596
+ const hpMultiplier = Math.max(0.1, 1 - hpDifference * 0.5);
13597
+ return Math.max(0.1, csMultiplier * arMultiplier * odMultiplier * hpMultiplier);
13598
+ }
13599
+ timeRampMultiplier(mod) {
13600
+ const minSpeed = Math.min(mod.initialRate.value, mod.finalRate.value);
13601
+ const maxSpeed = Math.max(mod.initialRate.value, mod.finalRate.value);
13602
+ const minMultiplier = minSpeed < 1
13603
+ ? this.halfTimeMultiplier(minSpeed)
13604
+ : this.doubleTimeMultiplier(minSpeed);
13605
+ const maxMultiplier = maxSpeed < 1
13606
+ ? this.halfTimeMultiplier(maxSpeed)
13607
+ : this.doubleTimeMultiplier(maxSpeed);
13608
+ return 0.8 * minMultiplier + 0.2 * maxMultiplier;
13609
+ }
13610
+ deflateMultiplier(mod) {
13611
+ return (1 -
13612
+ Math.max(0, 0.02 * (mod.startScale.value - mod.startScale.defaultValue)));
13613
+ }
13614
+ }
13615
+
12485
13616
  /**
12486
13617
  * An accuracy calculator that calculates accuracy based on given parameters.
12487
13618
  */
12488
13619
  class Accuracy {
12489
13620
  /**
12490
- * Calculates accuracy based on given parameters.
13621
+ * Whether {@link n300} holds an actual hit count.
13622
+ *
13623
+ * `false` if it was left unspecified and this instance was not constructed via
13624
+ * {@link Accuracy.fromHitCounts} or {@link Accuracy.fromPercent} to derive it.
13625
+ */
13626
+ get isN300Resolved() {
13627
+ return this.n300 !== Accuracy.unresolvedN300;
13628
+ }
13629
+ /**
13630
+ * Constructs an {@link Accuracy} from exact hit counts.
12491
13631
  *
12492
- * If `percent` and `nobjects` are specified, `n300`, `n100`, and `n50` will
12493
- * be automatically calculated to be the closest to the given
12494
- * acc percent.
13632
+ * Unlike {@link Accuracy.fromHitCounts}, this does not derive or clamp anything
13633
+ * against the amount of objects in a beatmap - the given counts are taken as-is.
12495
13634
  *
12496
- * @param values Function parameters.
13635
+ * @param values The hit counts to construct this instance with.
12497
13636
  */
12498
13637
  constructor(values) {
12499
13638
  var _a, _b, _c, _d;
12500
- this.nmiss = (_a = values.nmiss) !== null && _a !== void 0 ? _a : 0;
12501
- this.n300 = (_b = values.n300) !== null && _b !== void 0 ? _b : -1;
12502
- this.n100 = (_c = values.n100) !== null && _c !== void 0 ? _c : 0;
12503
- this.n50 = (_d = values.n50) !== null && _d !== void 0 ? _d : 0;
12504
- let nobjects;
12505
- if (values.nobjects) {
12506
- let n300 = this.n300;
12507
- nobjects = values.nobjects;
12508
- let hitcount;
12509
- if (n300 < 0) {
12510
- n300 = Math.max(0, nobjects - this.n100 - this.n50 - this.nmiss);
12511
- }
12512
- hitcount = n300 + this.n100 + this.n50 + this.nmiss;
12513
- if (hitcount > nobjects) {
12514
- n300 -= Math.min(n300, hitcount - nobjects);
12515
- }
12516
- hitcount = n300 + this.n100 + this.n50 + this.nmiss;
12517
- if (hitcount > nobjects) {
12518
- this.n100 -= Math.min(this.n100, hitcount - nobjects);
12519
- }
12520
- hitcount = n300 + this.n100 + this.n50 + this.nmiss;
12521
- if (hitcount > nobjects) {
12522
- this.n50 -= Math.min(this.n50, hitcount - nobjects);
12523
- }
12524
- hitcount = n300 + this.n100 + this.n50 + this.nmiss;
12525
- if (hitcount > nobjects) {
12526
- this.nmiss -= Math.min(this.nmiss, hitcount - nobjects);
12527
- }
12528
- this.n300 = nobjects - this.n100 - this.n50 - this.nmiss;
12529
- }
12530
- if (values.percent) {
12531
- if (!values.nobjects) {
12532
- throw new TypeError("nobjects is required when specifying percent");
12533
- }
12534
- nobjects = values.nobjects;
12535
- const max300 = nobjects - this.nmiss;
12536
- const maxacc = new Accuracy({
12537
- n300: max300,
12538
- n100: 0,
12539
- n50: 0,
12540
- nmiss: this.nmiss,
12541
- }).value() * 100;
12542
- let acc_percent = values.percent;
12543
- acc_percent = Math.max(0, Math.min(maxacc, acc_percent));
12544
- // just some black magic maths from wolfram alpha
12545
- this.n100 = Math.round(-3 * ((acc_percent * 0.01 - 1) * nobjects + this.nmiss) * 0.5);
12546
- if (this.n100 > max300) {
12547
- // acc lower than all 100s, use 50s
12548
- this.n100 = 0;
12549
- this.n50 = Math.round(-6 *
12550
- ((acc_percent * 0.01 - 1) * nobjects + this.nmiss) *
12551
- 0.5);
12552
- this.n50 = Math.min(max300, this.n50);
12553
- }
12554
- this.n300 = nobjects - this.n100 - this.n50 - this.nmiss;
12555
- }
12556
- }
12557
- /**
12558
- * Calculates the accuracy value (0.0 - 1.0).
12559
- *
12560
- * @param nobjects The amount of objects in the beatmap. If `n300` was not specified in the constructor, this is required.
12561
- */
12562
- value(nobjects) {
12563
- let n300 = this.n300;
12564
- if (n300 < 0) {
12565
- if (!nobjects) {
12566
- throw new TypeError("Either n300 or nobjects must be specified");
12567
- }
12568
- n300 = nobjects - this.n100 - this.n50 - this.nmiss;
13639
+ this.nmiss = (_a = values === null || values === void 0 ? void 0 : values.nmiss) !== null && _a !== void 0 ? _a : 0;
13640
+ this.n300 = (_b = values === null || values === void 0 ? void 0 : values.n300) !== null && _b !== void 0 ? _b : Accuracy.unresolvedN300;
13641
+ this.n100 = (_c = values === null || values === void 0 ? void 0 : values.n100) !== null && _c !== void 0 ? _c : 0;
13642
+ this.n50 = (_d = values === null || values === void 0 ? void 0 : values.n50) !== null && _d !== void 0 ? _d : 0;
13643
+ }
13644
+ /**
13645
+ * Constructs an {@link Accuracy} from hit counts, deriving `n300` from `nobjects`
13646
+ * if it was not specified.
13647
+ *
13648
+ * `n300`, `n100`, `n50`, and `nmiss` are clamped so that they do not add up to
13649
+ * more than `nobjects`.
13650
+ *
13651
+ * @param values The hit counts to construct this instance with.
13652
+ * @param nobjects The amount of objects in the beatmap.
13653
+ */
13654
+ static fromHitCounts(values, nobjects) {
13655
+ const accuracy = new Accuracy(values);
13656
+ accuracy.resolveFromHitCounts(nobjects);
13657
+ return accuracy;
13658
+ }
13659
+ /**
13660
+ * Constructs an {@link Accuracy} by reverse-solving `n300`, `n100`, and `n50`
13661
+ * so that the resulting accuracy is the closest to the given accuracy percentage.
13662
+ *
13663
+ * @param percent The accuracy percentage to reverse-solve for.
13664
+ * @param nobjects The amount of objects in the beatmap.
13665
+ * @param nmiss The amount of misses achieved. Defaults to 0.
13666
+ */
13667
+ static fromPercent(percent, nobjects, nmiss = 0) {
13668
+ const accuracy = new Accuracy({ nmiss });
13669
+ accuracy.resolveFromPercent(percent, nobjects);
13670
+ return accuracy;
13671
+ }
13672
+ /**
13673
+ * Derives `n300` (if unspecified) from `nobjects`, then clamps `n300`,
13674
+ * `n100`, `n50`, and `nmiss` so that they do not add up to more than
13675
+ * `nobjects`.
13676
+ *
13677
+ * @param nobjects The amount of objects in the beatmap.
13678
+ */
13679
+ resolveFromHitCounts(nobjects) {
13680
+ let n300 = this.isN300Resolved
13681
+ ? this.n300
13682
+ : Math.max(0, nobjects - this.n100 - this.n50 - this.nmiss);
13683
+ let hitcount = n300 + this.n100 + this.n50 + this.nmiss;
13684
+ if (hitcount > nobjects) {
13685
+ n300 -= Math.min(n300, hitcount - nobjects);
12569
13686
  }
12570
- else {
12571
- nobjects !== null && nobjects !== void 0 ? nobjects : (nobjects = n300 + this.n100 + this.n50 + this.nmiss);
13687
+ hitcount = n300 + this.n100 + this.n50 + this.nmiss;
13688
+ if (hitcount > nobjects) {
13689
+ this.n100 -= Math.min(this.n100, hitcount - nobjects);
13690
+ }
13691
+ hitcount = n300 + this.n100 + this.n50 + this.nmiss;
13692
+ if (hitcount > nobjects) {
13693
+ this.n50 -= Math.min(this.n50, hitcount - nobjects);
12572
13694
  }
12573
- const res = (n300 * 6 + this.n100 * 2 + this.n50) / (nobjects * 6);
12574
- return MathUtils.clamp(res, 0, 1);
13695
+ hitcount = n300 + this.n100 + this.n50 + this.nmiss;
13696
+ if (hitcount > nobjects) {
13697
+ this.nmiss -= Math.min(this.nmiss, hitcount - nobjects);
13698
+ }
13699
+ this.n300 = nobjects - this.n100 - this.n50 - this.nmiss;
13700
+ }
13701
+ /**
13702
+ * Reverse-solves `n100` and `n50` (and therefore `n300`) so that the
13703
+ * resulting accuracy is the closest to the given accuracy percentage.
13704
+ *
13705
+ * @param percent The accuracy percentage to reverse-solve for.
13706
+ * @param nobjects The amount of objects in the beatmap.
13707
+ */
13708
+ resolveFromPercent(percent, nobjects) {
13709
+ // Guard against a miss count that exceeds the amount of objects.
13710
+ this.nmiss = Math.min(this.nmiss, nobjects);
13711
+ const max300 = nobjects - this.nmiss;
13712
+ const maxacc = new Accuracy({
13713
+ n300: max300,
13714
+ n100: 0,
13715
+ n50: 0,
13716
+ nmiss: this.nmiss,
13717
+ }).value * 100;
13718
+ const acc_percent = MathUtils.clamp(percent, 0, maxacc);
13719
+ // just some black magic maths from wolfram alpha
13720
+ this.n100 = Math.max(0, Math.round(-3 * ((acc_percent * 0.01 - 1) * nobjects + this.nmiss) * 0.5));
13721
+ if (this.n100 > max300) {
13722
+ // acc lower than all 100s, use 50s
13723
+ this.n100 = 0;
13724
+ this.n50 = Math.max(0, Math.round(-6 *
13725
+ ((acc_percent * 0.01 - 1) * nobjects + this.nmiss) *
13726
+ 0.5));
13727
+ this.n50 = Math.min(max300, this.n50);
13728
+ }
13729
+ this.n300 = nobjects - this.n100 - this.n50 - this.nmiss;
13730
+ }
13731
+ /**
13732
+ * The accuracy value (0.0 - 1.0).
13733
+ *
13734
+ * `n300` must be resolved for this to be computable - either specify it directly
13735
+ * in the constructor, or construct this instance via {@link Accuracy.fromHitCounts}
13736
+ * or {@link Accuracy.fromPercent}. Otherwise, accessing this throws.
13737
+ */
13738
+ get value() {
13739
+ if (!this.isN300Resolved) {
13740
+ throw new TypeError("n300 could not be resolved; specify n300 directly, or construct " +
13741
+ "this instance via Accuracy.fromHitCounts or Accuracy.fromPercent");
13742
+ }
13743
+ const nobjects = this.n300 + this.n100 + this.n50 + this.nmiss;
13744
+ if (nobjects === 0) {
13745
+ return 0;
13746
+ }
13747
+ return MathUtils.clamp((this.n300 * 6 + this.n100 * 2 + this.n50) / (nobjects * 6), 0, 1);
12575
13748
  }
12576
13749
  /**
12577
13750
  * Determines whether this accuracy instance is equal to another instance.
@@ -12586,7 +13759,13 @@ class Accuracy {
12586
13759
  this.nmiss === other.nmiss);
12587
13760
  }
12588
13761
  }
13762
+ /**
13763
+ * The value {@link n300} holds when it was not specified and has not
13764
+ * been derived via {@link Accuracy.fromHitCounts} or {@link Accuracy.fromPercent}.
13765
+ */
13766
+ Accuracy.unresolvedN300 = -1;
12589
13767
 
13768
+ exports.APIRequestError = APIRequestError;
12590
13769
  exports.Accuracy = Accuracy;
12591
13770
  exports.BankHitSampleInfo = BankHitSampleInfo;
12592
13771
  exports.Beatmap = Beatmap;
@@ -12625,10 +13804,13 @@ exports.DifficultyControlPointManager = DifficultyControlPointManager;
12625
13804
  exports.DroidAPIRequestBuilder = DroidAPIRequestBuilder;
12626
13805
  exports.DroidHitWindow = DroidHitWindow;
12627
13806
  exports.DroidLegacyModConverter = DroidLegacyModConverter;
13807
+ exports.DroidLegacyScoreMultiplierCalculator = DroidLegacyScoreMultiplierCalculator;
12628
13808
  exports.DroidPlayableBeatmap = DroidPlayableBeatmap;
13809
+ exports.DroidScoreMultiplierCalculator = DroidScoreMultiplierCalculator;
12629
13810
  exports.EffectControlPoint = EffectControlPoint;
12630
13811
  exports.EffectControlPointManager = EffectControlPointManager;
12631
13812
  exports.EmptyHitWindow = EmptyHitWindow;
13813
+ exports.EnumModSetting = EnumModSetting;
12632
13814
  exports.ErrorFunction = ErrorFunction;
12633
13815
  exports.FileHitSampleInfo = FileHitSampleInfo;
12634
13816
  exports.HitObject = HitObject;
@@ -12641,12 +13823,21 @@ exports.IterativePoissonBinomial = IterativePoissonBinomial;
12641
13823
  exports.MapInfo = MapInfo;
12642
13824
  exports.MathUtils = MathUtils;
12643
13825
  exports.Mod = Mod;
13826
+ exports.ModAccuracyChallenge = ModAccuracyChallenge;
13827
+ exports.ModAlternate = ModAlternate;
12644
13828
  exports.ModApproachDifferent = ModApproachDifferent;
12645
13829
  exports.ModAuto = ModAuto;
12646
13830
  exports.ModAutopilot = ModAutopilot;
13831
+ exports.ModBarrelRoll = ModBarrelRoll;
12647
13832
  exports.ModBlinds = ModBlinds;
13833
+ exports.ModBloom = ModBloom;
13834
+ exports.ModBubbles = ModBubbles;
13835
+ exports.ModCinema = ModCinema;
13836
+ exports.ModClassic = ModClassic;
12648
13837
  exports.ModCustomSpeed = ModCustomSpeed;
13838
+ exports.ModDaycore = ModDaycore;
12649
13839
  exports.ModDeflate = ModDeflate;
13840
+ exports.ModDepth = ModDepth;
12650
13841
  exports.ModDifficultyAdjust = ModDifficultyAdjust;
12651
13842
  exports.ModDoubleTime = ModDoubleTime;
12652
13843
  exports.ModEasy = ModEasy;
@@ -12662,26 +13853,33 @@ exports.ModMirror = ModMirror;
12662
13853
  exports.ModMuted = ModMuted;
12663
13854
  exports.ModNightCore = ModNightCore;
12664
13855
  exports.ModNoFail = ModNoFail;
13856
+ exports.ModNoScope = ModNoScope;
12665
13857
  exports.ModObjectScaleTween = ModObjectScaleTween;
12666
13858
  exports.ModOldNightCore = ModOldNightCore;
12667
13859
  exports.ModPerfect = ModPerfect;
12668
13860
  exports.ModPrecise = ModPrecise;
12669
13861
  exports.ModRandom = ModRandom;
12670
13862
  exports.ModRateAdjust = ModRateAdjust;
12671
- exports.ModRateAdjustHelper = ModRateAdjustHelper;
12672
13863
  exports.ModReallyEasy = ModReallyEasy;
12673
13864
  exports.ModRelax = ModRelax;
13865
+ exports.ModRepel = ModRepel;
12674
13866
  exports.ModReplayV6 = ModReplayV6;
12675
13867
  exports.ModScoreV2 = ModScoreV2;
12676
13868
  exports.ModSetting = ModSetting;
13869
+ exports.ModSingleTap = ModSingleTap;
12677
13870
  exports.ModSmallCircle = ModSmallCircle;
13871
+ exports.ModSpinIn = ModSpinIn;
12678
13872
  exports.ModSpunOut = ModSpunOut;
13873
+ exports.ModStrictTracking = ModStrictTracking;
12679
13874
  exports.ModSuddenDeath = ModSuddenDeath;
12680
13875
  exports.ModSynesthesia = ModSynesthesia;
13876
+ exports.ModTargetPractice = ModTargetPractice;
12681
13877
  exports.ModTimeRamp = ModTimeRamp;
12682
13878
  exports.ModTouchDevice = ModTouchDevice;
12683
13879
  exports.ModTraceable = ModTraceable;
13880
+ exports.ModTransform = ModTransform;
12684
13881
  exports.ModUtil = ModUtil;
13882
+ exports.ModWiggle = ModWiggle;
12685
13883
  exports.ModWindDown = ModWindDown;
12686
13884
  exports.ModWindUp = ModWindUp;
12687
13885
  exports.NormalDistribution = NormalDistribution;
@@ -12690,7 +13888,10 @@ exports.NullableIntegerModSetting = NullableIntegerModSetting;
12690
13888
  exports.NumberModSetting = NumberModSetting;
12691
13889
  exports.OsuAPIRequestBuilder = OsuAPIRequestBuilder;
12692
13890
  exports.OsuHitWindow = OsuHitWindow;
13891
+ exports.OsuLegacyScoreMultiplierCalculator = OsuLegacyScoreMultiplierCalculator;
12693
13892
  exports.OsuPlayableBeatmap = OsuPlayableBeatmap;
13893
+ exports.OsuScoreMultiplierCalculatorV1 = OsuScoreMultiplierCalculatorV1;
13894
+ exports.OsuScoreMultiplierCalculatorV2 = OsuScoreMultiplierCalculatorV2;
12694
13895
  exports.PathApproximator = PathApproximator;
12695
13896
  exports.PlayableBeatmap = PlayableBeatmap;
12696
13897
  exports.Playfield = Playfield;
@@ -12701,9 +13902,11 @@ exports.Precision = Precision;
12701
13902
  exports.RGBColor = RGBColor;
12702
13903
  exports.Random = Random;
12703
13904
  exports.RangeConstrainedModSetting = RangeConstrainedModSetting;
13905
+ exports.RequestResponse = RequestResponse;
12704
13906
  exports.SampleBankInfo = SampleBankInfo;
12705
13907
  exports.SampleControlPoint = SampleControlPoint;
12706
13908
  exports.SampleControlPointManager = SampleControlPointManager;
13909
+ exports.ScoreMultiplierCalculator = ScoreMultiplierCalculator;
12707
13910
  exports.SequenceHitSampleInfo = SequenceHitSampleInfo;
12708
13911
  exports.Slider = Slider;
12709
13912
  exports.SliderHead = SliderHead;