@rian8337/osu-rebalance-difficulty-calculator 4.0.0-beta.51 → 4.0.0-beta.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -287,10 +287,10 @@ class DifficultyHitObject {
287
287
  * Calculates the opacity of the hitobject at a given time.
288
288
  *
289
289
  * @param time The time to calculate the hitobject's opacity at.
290
- * @param isHidden Whether Hidden mod is used.
290
+ * @param mods The mods used.
291
291
  * @returns The opacity of the hitobject at the given time.
292
292
  */
293
- opacityAt(time, isHidden) {
293
+ opacityAt(time, mods) {
294
294
  if (time > this.object.startTime) {
295
295
  // Consider a hitobject as being invisible when its start time is passed.
296
296
  // In reality the hitobject will be visible beyond its start time up until its hittable window has passed,
@@ -299,7 +299,7 @@ class DifficultyHitObject {
299
299
  }
300
300
  const fadeInStartTime = this.object.startTime - this.object.timePreempt;
301
301
  const fadeInDuration = this.object.timeFadeIn;
302
- if (isHidden) {
302
+ if (mods.some((m) => m instanceof osuBase.ModHidden)) {
303
303
  const fadeOutStartTime = fadeInStartTime + fadeInDuration;
304
304
  const fadeOutDuration = this.object.timePreempt * osuBase.ModHidden.fadeOutDurationMultiplier;
305
305
  return Math.min(osuBase.MathUtils.clamp((time - fadeInStartTime) / fadeInDuration, 0, 1), 1 -
@@ -582,6 +582,14 @@ class DroidDifficultyHitObject extends DifficultyHitObject {
582
582
  super.computeProperties(clockRate, hitObjects);
583
583
  this.setVisuals(clockRate, hitObjects);
584
584
  }
585
+ opacityAt(time, mods) {
586
+ // Traceable hides the primary piece of a hit circle (that is, its body), so consider it as fully invisible.
587
+ if (this.object instanceof osuBase.Circle &&
588
+ mods.some((m) => m instanceof osuBase.ModTraceable)) {
589
+ return 0;
590
+ }
591
+ return super.opacityAt(time, mods);
592
+ }
585
593
  /**
586
594
  * Determines whether this hitobject is considered overlapping with the hitobject before it.
587
595
  *
@@ -1218,10 +1226,10 @@ class DroidFlashlightEvaluator {
1218
1226
  * - and whether Hidden mod is enabled.
1219
1227
  *
1220
1228
  * @param current The current object.
1221
- * @param isHiddenMod Whether the Hidden mod is enabled.
1229
+ * @param mods The mods used.
1222
1230
  * @param withSliders Whether to take slider difficulty into account.
1223
1231
  */
1224
- static evaluateDifficultyOf(current, isHiddenMod, withSliders) {
1232
+ static evaluateDifficultyOf(current, mods, withSliders) {
1225
1233
  if (current.object instanceof osuBase.Spinner ||
1226
1234
  // Exclude overlapping objects that can be tapped at once.
1227
1235
  current.isOverlapping(true)) {
@@ -1252,7 +1260,7 @@ class DroidFlashlightEvaluator {
1252
1260
  const opacityBonus = 1 +
1253
1261
  this.maxOpacityBonus *
1254
1262
  (1 -
1255
- current.opacityAt(currentObject.object.startTime, isHiddenMod));
1263
+ current.opacityAt(currentObject.object.startTime, mods));
1256
1264
  result +=
1257
1265
  (stackNerf * opacityBonus * scalingFactor * jumpDistance) /
1258
1266
  cumulativeStrainTime;
@@ -1267,9 +1275,20 @@ class DroidFlashlightEvaluator {
1267
1275
  }
1268
1276
  result = Math.pow(smallDistNerf * result, 2);
1269
1277
  // Additional bonus for Hidden due to there being no approach circles.
1270
- if (isHiddenMod) {
1278
+ if (mods.some((m) => m instanceof osuBase.ModHidden)) {
1271
1279
  result *= 1 + this.hiddenBonus;
1272
1280
  }
1281
+ else if (mods.some((m) => m instanceof osuBase.ModTraceable)) {
1282
+ // Additional bonus for Traceable due to there being no primary or secondary object pieces.
1283
+ if (current.object instanceof osuBase.Circle) {
1284
+ // Additional bonus for hit circles due to there being no circle piece, which is the primary piece.
1285
+ result *= 1 + this.traceableCircleBonus;
1286
+ }
1287
+ else {
1288
+ // The rest of the objects only hide secondary pieces.
1289
+ result *= 1 + this.traceableObjectBonus;
1290
+ }
1291
+ }
1273
1292
  // Nerf patterns with repeated angles.
1274
1293
  result *=
1275
1294
  this.minAngleMultiplier +
@@ -1292,6 +1311,8 @@ class DroidFlashlightEvaluator {
1292
1311
  }
1293
1312
  DroidFlashlightEvaluator.maxOpacityBonus = 0.4;
1294
1313
  DroidFlashlightEvaluator.hiddenBonus = 0.2;
1314
+ DroidFlashlightEvaluator.traceableCircleBonus = 0.15;
1315
+ DroidFlashlightEvaluator.traceableObjectBonus = 0.1;
1295
1316
  DroidFlashlightEvaluator.minVelocity = 0.5;
1296
1317
  DroidFlashlightEvaluator.sliderMultiplier = 1.3;
1297
1318
  DroidFlashlightEvaluator.minAngleMultiplier = 0.2;
@@ -1308,13 +1329,12 @@ class DroidFlashlight extends DroidSkill {
1308
1329
  this.starsPerDouble = 1.06;
1309
1330
  this.skillMultiplier = 0.02;
1310
1331
  this.currentFlashlightStrain = 0;
1311
- this.isHidden = mods.some((m) => m instanceof osuBase.ModHidden);
1312
1332
  this.withSliders = withSliders;
1313
1333
  }
1314
1334
  strainValueAt(current) {
1315
1335
  this.currentFlashlightStrain *= this.strainDecay(current.deltaTime);
1316
1336
  this.currentFlashlightStrain +=
1317
- DroidFlashlightEvaluator.evaluateDifficultyOf(current, this.isHidden, this.withSliders) * this.skillMultiplier;
1337
+ DroidFlashlightEvaluator.evaluateDifficultyOf(current, this.mods, this.withSliders) * this.skillMultiplier;
1318
1338
  return this.currentFlashlightStrain;
1319
1339
  }
1320
1340
  calculateInitialStrain(time, current) {
@@ -1581,10 +1601,10 @@ class DroidVisualEvaluator {
1581
1601
  * - and whether the Hidden mod is enabled.
1582
1602
  *
1583
1603
  * @param current The current object.
1584
- * @param isHiddenMod Whether the Hidden mod is enabled.
1604
+ * @param mods The mods used.
1585
1605
  * @param withSliders Whether to take slider difficulty into account.
1586
1606
  */
1587
- static evaluateDifficultyOf(current, isHiddenMod, withSliders) {
1607
+ static evaluateDifficultyOf(current, mods, withSliders) {
1588
1608
  if (current.object instanceof osuBase.Spinner ||
1589
1609
  // Exclude overlapping objects that can be tapped at once.
1590
1610
  current.isOverlapping(true) ||
@@ -1594,9 +1614,18 @@ class DroidVisualEvaluator {
1594
1614
  // Start with base density and give global bonus for Hidden.
1595
1615
  // Add density caps for sanity.
1596
1616
  let strain;
1597
- if (isHiddenMod) {
1617
+ if (mods.some((m) => m instanceof osuBase.ModHidden)) {
1598
1618
  strain = Math.min(30, Math.pow(current.noteDensity, 3));
1599
1619
  }
1620
+ else if (mods.some((m) => m instanceof osuBase.ModTraceable)) {
1621
+ // Give more bonus for hit circles due to there being no circle piece.
1622
+ if (current.object instanceof osuBase.Circle) {
1623
+ strain = Math.min(25, Math.pow(current.noteDensity, 2.5));
1624
+ }
1625
+ else {
1626
+ strain = Math.min(22.5, Math.pow(current.noteDensity, 2.25));
1627
+ }
1628
+ }
1600
1629
  else {
1601
1630
  strain = Math.min(20, Math.pow(current.noteDensity, 2));
1602
1631
  }
@@ -1614,9 +1643,7 @@ class DroidVisualEvaluator {
1614
1643
  break;
1615
1644
  }
1616
1645
  strain +=
1617
- (1 -
1618
- current.opacityAt(previous.object.startTime, isHiddenMod)) /
1619
- 4;
1646
+ (1 - current.opacityAt(previous.object.startTime, mods)) / 4;
1620
1647
  }
1621
1648
  if (current.timePreempt < 400) {
1622
1649
  // Give bonus for AR higher than 10.33.
@@ -1676,13 +1703,12 @@ class DroidVisual extends DroidSkill {
1676
1703
  this.currentVisualStrain = 0;
1677
1704
  this.currentRhythmMultiplier = 1;
1678
1705
  this.skillMultiplier = 10;
1679
- this.isHidden = mods.some((m) => m instanceof osuBase.ModHidden);
1680
1706
  this.withSliders = withSliders;
1681
1707
  }
1682
1708
  strainValueAt(current) {
1683
1709
  this.currentVisualStrain *= this.strainDecay(current.deltaTime);
1684
1710
  this.currentVisualStrain +=
1685
- DroidVisualEvaluator.evaluateDifficultyOf(current, this.isHidden, this.withSliders) * this.skillMultiplier;
1711
+ DroidVisualEvaluator.evaluateDifficultyOf(current, this.mods, this.withSliders) * this.skillMultiplier;
1686
1712
  this.currentRhythmMultiplier = current.rhythmMultiplier;
1687
1713
  return this.currentVisualStrain * this.currentRhythmMultiplier;
1688
1714
  }
@@ -3360,9 +3386,9 @@ class OsuFlashlightEvaluator {
3360
3386
  * - and whether Hidden mod is enabled.
3361
3387
  *
3362
3388
  * @param current The current object.
3363
- * @param isHiddenMod Whether the Hidden mod is enabled.
3389
+ * @param mods The mods used.
3364
3390
  */
3365
- static evaluateDifficultyOf(current, isHiddenMod) {
3391
+ static evaluateDifficultyOf(current, mods) {
3366
3392
  if (current.object instanceof osuBase.Spinner) {
3367
3393
  return 0;
3368
3394
  }
@@ -3389,7 +3415,7 @@ class OsuFlashlightEvaluator {
3389
3415
  const opacityBonus = 1 +
3390
3416
  this.maxOpacityBonus *
3391
3417
  (1 -
3392
- current.opacityAt(currentObject.object.startTime, isHiddenMod));
3418
+ current.opacityAt(currentObject.object.startTime, mods));
3393
3419
  result +=
3394
3420
  (stackNerf * opacityBonus * scalingFactor * jumpDistance) /
3395
3421
  cumulativeStrainTime;
@@ -3404,7 +3430,7 @@ class OsuFlashlightEvaluator {
3404
3430
  }
3405
3431
  result = Math.pow(smallDistNerf * result, 2);
3406
3432
  // Additional bonus for Hidden due to there being no approach circles.
3407
- if (isHiddenMod) {
3433
+ if (mods.some((m) => m instanceof osuBase.ModHidden)) {
3408
3434
  result *= 1 + this.hiddenBonus;
3409
3435
  }
3410
3436
  // Nerf patterns with repeated angles.
@@ -3437,15 +3463,14 @@ OsuFlashlightEvaluator.minAngleMultiplier = 0.2;
3437
3463
  * Represents the skill required to memorize and hit every object in a beatmap with the Flashlight mod enabled.
3438
3464
  */
3439
3465
  class OsuFlashlight extends OsuSkill {
3440
- constructor(mods) {
3441
- super(mods);
3466
+ constructor() {
3467
+ super(...arguments);
3442
3468
  this.strainDecayBase = 0.15;
3443
3469
  this.reducedSectionCount = 0;
3444
3470
  this.reducedSectionBaseline = 1;
3445
3471
  this.decayWeight = 1;
3446
3472
  this.currentFlashlightStrain = 0;
3447
3473
  this.skillMultiplier = 0.05512;
3448
- this.isHidden = mods.some((m) => m instanceof osuBase.ModHidden);
3449
3474
  }
3450
3475
  difficultyValue() {
3451
3476
  return this.strainPeaks.reduce((a, b) => a + b, 0);
@@ -3453,7 +3478,8 @@ class OsuFlashlight extends OsuSkill {
3453
3478
  strainValueAt(current) {
3454
3479
  this.currentFlashlightStrain *= this.strainDecay(current.deltaTime);
3455
3480
  this.currentFlashlightStrain +=
3456
- OsuFlashlightEvaluator.evaluateDifficultyOf(current, this.isHidden) * this.skillMultiplier;
3481
+ OsuFlashlightEvaluator.evaluateDifficultyOf(current, this.mods) *
3482
+ this.skillMultiplier;
3457
3483
  return this.currentFlashlightStrain;
3458
3484
  }
3459
3485
  calculateInitialStrain(time, current) {
@@ -3788,7 +3814,7 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
3788
3814
  aimValue *= 1 + arFactor * lengthBonus;
3789
3815
  }
3790
3816
  // We want to give more reward for lower AR when it comes to aim and HD. This nerfs high AR and buffs lower AR.
3791
- if (this.mods.some((m) => m instanceof osuBase.ModHidden)) {
3817
+ if (this.mods.some((m) => m instanceof osuBase.ModHidden || m instanceof osuBase.ModTraceable)) {
3792
3818
  aimValue *= 1 + 0.04 * (12 - calculatedAR);
3793
3819
  }
3794
3820
  // Scale the aim value with slider factor to nerf very likely dropped sliderends.
@@ -3823,7 +3849,7 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
3823
3849
  // Buff for longer maps with high AR.
3824
3850
  speedValue *= 1 + 0.3 * (calculatedAR - 10.33) * lengthBonus;
3825
3851
  }
3826
- if (this.mods.some((m) => m instanceof osuBase.ModHidden)) {
3852
+ if (this.mods.some((m) => m instanceof osuBase.ModHidden || m instanceof osuBase.ModTraceable)) {
3827
3853
  speedValue *= 1 + 0.04 * (12 - calculatedAR);
3828
3854
  }
3829
3855
  // Calculate accuracy assuming the worst case scenario.
@@ -3873,7 +3899,7 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
3873
3899
  2.83;
3874
3900
  // Bonus for many hitcircles - it's harder to keep good accuracy up for longer
3875
3901
  accuracyValue *= Math.min(1.15, Math.pow(ncircles / 1000, 0.3));
3876
- if (this.mods.some((m) => m instanceof osuBase.ModHidden)) {
3902
+ if (this.mods.some((m) => m instanceof osuBase.ModHidden || m instanceof osuBase.ModTraceable)) {
3877
3903
  accuracyValue *= 1.08;
3878
3904
  }
3879
3905
  if (this.mods.some((m) => m instanceof osuBase.ModFlashlight)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rian8337/osu-rebalance-difficulty-calculator",
3
- "version": "4.0.0-beta.51",
3
+ "version": "4.0.0-beta.52",
4
4
  "description": "A module for calculating osu!standard beatmap difficulty and performance value with respect to the latest osu!lazer difficulty and performance algorithm.",
5
5
  "keywords": [
6
6
  "osu",
@@ -33,10 +33,10 @@
33
33
  "url": "https://github.com/Rian8337/osu-droid-module/issues"
34
34
  },
35
35
  "dependencies": {
36
- "@rian8337/osu-base": "^4.0.0-beta.51"
36
+ "@rian8337/osu-base": "^4.0.0-beta.52"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "gitHead": "6527e0c37f4d439e68fbecffa453fe1ff79a96f6"
41
+ "gitHead": "c7cd2019227c891e7897245ee61d1e24d7a5fb9c"
42
42
  }
@@ -242,10 +242,10 @@ declare abstract class DifficultyHitObject {
242
242
  * Calculates the opacity of the hitobject at a given time.
243
243
  *
244
244
  * @param time The time to calculate the hitobject's opacity at.
245
- * @param isHidden Whether Hidden mod is used.
245
+ * @param mods The mods used.
246
246
  * @returns The opacity of the hitobject at the given time.
247
247
  */
248
- opacityAt(time: number, isHidden: boolean): number;
248
+ opacityAt(time: number, mods: Mod[]): number;
249
249
  /**
250
250
  * How possible is it to doubletap this object together with the next one and get perfect
251
251
  * judgement in range from 0 to 1.
@@ -609,6 +609,7 @@ declare class DroidDifficultyHitObject extends DifficultyHitObject {
609
609
  */
610
610
  constructor(object: PlaceableHitObject, lastObject: PlaceableHitObject | null, lastLastObject: PlaceableHitObject | null, difficultyHitObjects: readonly DifficultyHitObject[], clockRate: number);
611
611
  computeProperties(clockRate: number, hitObjects: readonly PlaceableHitObject[]): void;
612
+ opacityAt(time: number, mods: Mod[]): number;
612
613
  /**
613
614
  * Determines whether this hitobject is considered overlapping with the hitobject before it.
614
615
  *
@@ -912,7 +913,6 @@ declare class DroidFlashlight extends DroidSkill {
912
913
  protected readonly reducedSectionBaseline = 1;
913
914
  protected readonly starsPerDouble = 1.06;
914
915
  private readonly skillMultiplier;
915
- private readonly isHidden;
916
916
  private currentFlashlightStrain;
917
917
  readonly withSliders: boolean;
918
918
  constructor(mods: Mod[], withSliders: boolean);
@@ -929,6 +929,8 @@ declare class DroidFlashlight extends DroidSkill {
929
929
  declare abstract class DroidFlashlightEvaluator {
930
930
  private static readonly maxOpacityBonus;
931
931
  private static readonly hiddenBonus;
932
+ private static readonly traceableCircleBonus;
933
+ private static readonly traceableObjectBonus;
932
934
  private static readonly minVelocity;
933
935
  private static readonly sliderMultiplier;
934
936
  private static readonly minAngleMultiplier;
@@ -942,10 +944,10 @@ declare abstract class DroidFlashlightEvaluator {
942
944
  * - and whether Hidden mod is enabled.
943
945
  *
944
946
  * @param current The current object.
945
- * @param isHiddenMod Whether the Hidden mod is enabled.
947
+ * @param mods The mods used.
946
948
  * @param withSliders Whether to take slider difficulty into account.
947
949
  */
948
- static evaluateDifficultyOf(current: DroidDifficultyHitObject, isHiddenMod: boolean, withSliders: boolean): number;
950
+ static evaluateDifficultyOf(current: DroidDifficultyHitObject, mods: Mod[], withSliders: boolean): number;
949
951
  }
950
952
 
951
953
  /**
@@ -1345,7 +1347,6 @@ declare class DroidVisual extends DroidSkill {
1345
1347
  protected readonly reducedSectionCount = 10;
1346
1348
  protected readonly reducedSectionBaseline = 0.75;
1347
1349
  protected readonly strainDecayBase = 0.1;
1348
- private readonly isHidden;
1349
1350
  private currentVisualStrain;
1350
1351
  private currentRhythmMultiplier;
1351
1352
  private readonly skillMultiplier;
@@ -1373,10 +1374,10 @@ declare abstract class DroidVisualEvaluator {
1373
1374
  * - and whether the Hidden mod is enabled.
1374
1375
  *
1375
1376
  * @param current The current object.
1376
- * @param isHiddenMod Whether the Hidden mod is enabled.
1377
+ * @param mods The mods used.
1377
1378
  * @param withSliders Whether to take slider difficulty into account.
1378
1379
  */
1379
- static evaluateDifficultyOf(current: DroidDifficultyHitObject, isHiddenMod: boolean, withSliders: boolean): number;
1380
+ static evaluateDifficultyOf(current: DroidDifficultyHitObject, mods: Mod[], withSliders: boolean): number;
1380
1381
  }
1381
1382
 
1382
1383
  /**
@@ -1547,8 +1548,6 @@ declare class OsuFlashlight extends OsuSkill {
1547
1548
  protected readonly decayWeight = 1;
1548
1549
  private currentFlashlightStrain;
1549
1550
  private readonly skillMultiplier;
1550
- private readonly isHidden;
1551
- constructor(mods: Mod[]);
1552
1551
  difficultyValue(): number;
1553
1552
  protected strainValueAt(current: OsuDifficultyHitObject): number;
1554
1553
  protected calculateInitialStrain(time: number, current: OsuDifficultyHitObject): number;
@@ -1574,9 +1573,9 @@ declare abstract class OsuFlashlightEvaluator {
1574
1573
  * - and whether Hidden mod is enabled.
1575
1574
  *
1576
1575
  * @param current The current object.
1577
- * @param isHiddenMod Whether the Hidden mod is enabled.
1576
+ * @param mods The mods used.
1578
1577
  */
1579
- static evaluateDifficultyOf(current: OsuDifficultyHitObject, isHiddenMod: boolean): number;
1578
+ static evaluateDifficultyOf(current: OsuDifficultyHitObject, mods: Mod[]): number;
1580
1579
  }
1581
1580
 
1582
1581
  /**