@rian8337/osu-droid-replay-analyzer 4.0.0-beta.56 → 4.0.0-beta.58

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
@@ -349,8 +349,8 @@ class RebalanceThreeFingerChecker {
349
349
  this.beatmap = beatmap;
350
350
  this.data = data;
351
351
  this.difficultyAttributes = difficultyAttributes;
352
- this.isHardRock = difficultyAttributes.mods.some((m) => m instanceof osuBase.ModHardRock);
353
- this.hitWindow = difficultyAttributes.mods.some((m) => m instanceof osuBase.ModPrecise)
352
+ this.isHardRock = difficultyAttributes.mods.has(osuBase.ModHardRock);
353
+ this.hitWindow = difficultyAttributes.mods.has(osuBase.ModPrecise)
354
354
  ? new osuBase.PreciseDroidHitWindow(beatmap.difficulty.od)
355
355
  : new osuBase.DroidHitWindow(beatmap.difficulty.od);
356
356
  }
@@ -757,10 +757,10 @@ class SliderCheeseChecker {
757
757
  this.beatmap = beatmap;
758
758
  this.data = data;
759
759
  this.difficultyAttributes = difficultyAttributes;
760
- this.hitWindow50 = difficultyAttributes.mods.some((m) => m instanceof osuBase.ModPrecise)
760
+ this.hitWindow50 = difficultyAttributes.mods.has(osuBase.ModPrecise)
761
761
  ? new osuBase.PreciseDroidHitWindow(beatmap.difficulty.od).mehWindow
762
762
  : new osuBase.DroidHitWindow(beatmap.difficulty.od).mehWindow;
763
- this.isHardRock = difficultyAttributes.mods.some((m) => m instanceof osuBase.ModHardRock);
763
+ this.isHardRock = difficultyAttributes.mods.has(osuBase.ModHardRock);
764
764
  }
765
765
  /**
766
766
  * Checks if relevant sliders in the given beatmap was cheesed.
@@ -999,8 +999,8 @@ class ThreeFingerChecker {
999
999
  this.beatmap = beatmap;
1000
1000
  this.data = data;
1001
1001
  this.difficultyAttributes = difficultyAttributes;
1002
- this.isHardRock = difficultyAttributes.mods.some((m) => m instanceof osuBase.ModHardRock);
1003
- this.hitWindow = difficultyAttributes.mods.some((m) => m instanceof osuBase.ModPrecise)
1002
+ this.isHardRock = difficultyAttributes.mods.has(osuBase.ModHardRock);
1003
+ this.hitWindow = difficultyAttributes.mods.has(osuBase.ModPrecise)
1004
1004
  ? new osuBase.PreciseDroidHitWindow(beatmap.difficulty.od)
1005
1005
  : new osuBase.DroidHitWindow(beatmap.difficulty.od);
1006
1006
  }
@@ -1409,10 +1409,10 @@ class TwoHandChecker {
1409
1409
  this.data = data;
1410
1410
  const greatWindow = new osuBase.OsuHitWindow(attributes.overallDifficulty).greatWindow *
1411
1411
  attributes.clockRate;
1412
- this.hitWindow = attributes.mods.some((m) => m instanceof osuBase.ModPrecise)
1412
+ this.hitWindow = attributes.mods.has(osuBase.ModPrecise)
1413
1413
  ? new osuBase.PreciseDroidHitWindow(osuBase.PreciseDroidHitWindow.greatWindowToOD(greatWindow))
1414
1414
  : new osuBase.DroidHitWindow(osuBase.DroidHitWindow.greatWindowToOD(greatWindow));
1415
- this.isHardRock = attributes.mods.some((m) => m instanceof osuBase.ModHardRock);
1415
+ this.isHardRock = attributes.mods.has(osuBase.ModHardRock);
1416
1416
  // this.csvString = `Mods,${
1417
1417
  // data.convertedMods.reduce((a, m) => a + m.acronym, "") || "NM"
1418
1418
  // }\nCombo,${data.maxCombo}\nAccuracy,"${(
@@ -2147,10 +2147,10 @@ class ReplayAnalyzer {
2147
2147
  const { objects } = this.beatmap.hitObjects;
2148
2148
  const mods = this.data.isReplayV3()
2149
2149
  ? this.data.convertedMods
2150
- : (_b = (_a = this.difficultyAttributes) === null || _a === void 0 ? void 0 : _a.mods.filter((m) => m.isApplicableToDroid())) !== null && _b !== void 0 ? _b : [];
2150
+ : (_b = (_a = this.difficultyAttributes) === null || _a === void 0 ? void 0 : _a.mods) !== null && _b !== void 0 ? _b : new osuBase.ModMap();
2151
2151
  const adjustedDifficulty = new osuBase.BeatmapDifficulty(this.beatmap.difficulty);
2152
2152
  osuBase.ModUtil.applyModsToBeatmapDifficulty(adjustedDifficulty, osuBase.Modes.droid, mods);
2153
- const mehWindow = mods.some((m) => m instanceof osuBase.ModPrecise)
2153
+ const mehWindow = mods.has(osuBase.ModPrecise)
2154
2154
  ? new osuBase.PreciseDroidHitWindow(adjustedDifficulty.od).mehWindow
2155
2155
  : new osuBase.DroidHitWindow(adjustedDifficulty.od).mehWindow;
2156
2156
  const accuracies = [];
@@ -2305,7 +2305,7 @@ class ReplayAnalyzer {
2305
2305
  hitObjectData: [],
2306
2306
  accuracy: new osuBase.Accuracy({ n300: 0 }),
2307
2307
  rank: "D",
2308
- convertedMods: [],
2308
+ convertedMods: new osuBase.ModMap(),
2309
2309
  hit100k: 0,
2310
2310
  hit300k: 0,
2311
2311
  isFullCombo: false,
@@ -2381,42 +2381,42 @@ class ReplayAnalyzer {
2381
2381
  */
2382
2382
  convertDroidMods(replayVersion, replayMods) {
2383
2383
  const replayModsConstants = {
2384
- MOD_AUTO: new osuBase.ModAuto(),
2385
- MOD_AUTOPILOT: new osuBase.ModAutopilot(),
2386
- MOD_NOFAIL: new osuBase.ModNoFail(),
2387
- MOD_EASY: new osuBase.ModEasy(),
2388
- MOD_HIDDEN: new osuBase.ModHidden(),
2389
- MOD_TRACEABLE: new osuBase.ModTraceable(),
2390
- MOD_HARDROCK: new osuBase.ModHardRock(),
2391
- MOD_DOUBLETIME: new osuBase.ModDoubleTime(),
2392
- MOD_HALFTIME: new osuBase.ModHalfTime(),
2393
- MOD_NIGHTCORE: new osuBase.ModNightCore(),
2394
- MOD_PRECISE: new osuBase.ModPrecise(),
2395
- MOD_SMALLCIRCLE: new osuBase.ModSmallCircle(),
2396
- MOD_REALLYEASY: new osuBase.ModReallyEasy(),
2397
- MOD_RELAX: new osuBase.ModRelax(),
2398
- MOD_PERFECT: new osuBase.ModPerfect(),
2399
- MOD_SUDDENDEATH: new osuBase.ModSuddenDeath(),
2400
- MOD_SCOREV2: new osuBase.ModScoreV2(),
2401
- MOD_FLASHLIGHT: new osuBase.ModFlashlight(),
2384
+ MOD_AUTO: osuBase.ModAuto,
2385
+ MOD_AUTOPILOT: osuBase.ModAutopilot,
2386
+ MOD_NOFAIL: osuBase.ModNoFail,
2387
+ MOD_EASY: osuBase.ModEasy,
2388
+ MOD_HIDDEN: osuBase.ModHidden,
2389
+ MOD_TRACEABLE: osuBase.ModTraceable,
2390
+ MOD_HARDROCK: osuBase.ModHardRock,
2391
+ MOD_DOUBLETIME: osuBase.ModDoubleTime,
2392
+ MOD_HALFTIME: osuBase.ModHalfTime,
2393
+ MOD_NIGHTCORE: osuBase.ModNightCore,
2394
+ MOD_PRECISE: osuBase.ModPrecise,
2395
+ MOD_SMALLCIRCLE: osuBase.ModSmallCircle,
2396
+ MOD_REALLYEASY: osuBase.ModReallyEasy,
2397
+ MOD_RELAX: osuBase.ModRelax,
2398
+ MOD_PERFECT: osuBase.ModPerfect,
2399
+ MOD_SUDDENDEATH: osuBase.ModSuddenDeath,
2400
+ MOD_SCOREV2: osuBase.ModScoreV2,
2401
+ MOD_FLASHLIGHT: osuBase.ModFlashlight,
2402
2402
  };
2403
- const mods = [];
2403
+ const map = new osuBase.ModMap();
2404
2404
  for (const mod of replayMods) {
2405
- for (const property in replayModsConstants) {
2405
+ for (const property in Object(replayModsConstants)) {
2406
2406
  if (!mod.includes(property)) {
2407
2407
  continue;
2408
2408
  }
2409
2409
  if (replayVersion <= 3 && mod === "MOD_NIGHTCORE") {
2410
2410
  // In replay v3, the NightCore mod is bugged. See ModOldNightCore's description.
2411
- mods.push(new osuBase.ModOldNightCore());
2411
+ map.set(new osuBase.ModOldNightCore());
2412
2412
  }
2413
2413
  else {
2414
- mods.push(replayModsConstants[property]);
2414
+ map.set(replayModsConstants[property]);
2415
2415
  }
2416
2416
  break;
2417
2417
  }
2418
2418
  }
2419
- return mods;
2419
+ return map;
2420
2420
  }
2421
2421
  parseMovementData(resultObject, replayDataBuffer) {
2422
2422
  resultObject.cursorMovement.length = 0;
@@ -2532,12 +2532,13 @@ class ReplayAnalyzer {
2532
2532
  resultObject.rank = this.calculateRank(resultObject);
2533
2533
  }
2534
2534
  calculateRank(resultObject) {
2535
- var _a, _b;
2535
+ var _a, _b, _c;
2536
2536
  const totalHits = resultObject.accuracy.n300 +
2537
2537
  resultObject.accuracy.n100 +
2538
2538
  resultObject.accuracy.n50 +
2539
2539
  resultObject.accuracy.nmiss;
2540
- const isHidden = (_b = (_a = resultObject.convertedMods) === null || _a === void 0 ? void 0 : _a.some((m) => m instanceof osuBase.ModHidden || m instanceof osuBase.ModFlashlight)) !== null && _b !== void 0 ? _b : false;
2540
+ const isHidden = (_c = (((_a = resultObject.convertedMods) === null || _a === void 0 ? void 0 : _a.has(osuBase.ModHidden)) ||
2541
+ ((_b = resultObject.convertedMods) === null || _b === void 0 ? void 0 : _b.has(osuBase.ModFlashlight)))) !== null && _c !== void 0 ? _c : false;
2541
2542
  const hit300Ratio = resultObject.accuracy.n300 / totalHits;
2542
2543
  switch (true) {
2543
2544
  case resultObject.accuracy.value() === 1:
@@ -2559,7 +2560,7 @@ class ReplayAnalyzer {
2559
2560
  }
2560
2561
  }
2561
2562
  constructPlayableBeatmap() {
2562
- var _a, _b;
2563
+ var _a;
2563
2564
  if (this.beatmap instanceof osuBase.DroidPlayableBeatmap) {
2564
2565
  return this.beatmap;
2565
2566
  }
@@ -2568,7 +2569,7 @@ class ReplayAnalyzer {
2568
2569
  }
2569
2570
  const mods = this.data.isReplayV3()
2570
2571
  ? this.data.convertedMods
2571
- : (_b = (_a = this.difficultyAttributes) === null || _a === void 0 ? void 0 : _a.mods) !== null && _b !== void 0 ? _b : [];
2572
+ : (_a = this.difficultyAttributes) === null || _a === void 0 ? void 0 : _a.mods;
2572
2573
  return this.beatmap.createDroidPlayableBeatmap(mods);
2573
2574
  }
2574
2575
  readByte(buffer) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rian8337/osu-droid-replay-analyzer",
3
- "version": "4.0.0-beta.56",
3
+ "version": "4.0.0-beta.58",
4
4
  "description": "A replay analyzer for analyzing osu!droid replay files.",
5
5
  "keywords": [
6
6
  "osu",
@@ -34,9 +34,9 @@
34
34
  "url": "https://github.com/Rian8337/osu-droid-module/issues"
35
35
  },
36
36
  "dependencies": {
37
- "@rian8337/osu-base": "^4.0.0-beta.56",
38
- "@rian8337/osu-difficulty-calculator": "^4.0.0-beta.56",
39
- "@rian8337/osu-rebalance-difficulty-calculator": "^4.0.0-beta.56",
37
+ "@rian8337/osu-base": "^4.0.0-beta.58",
38
+ "@rian8337/osu-difficulty-calculator": "^4.0.0-beta.58",
39
+ "@rian8337/osu-rebalance-difficulty-calculator": "^4.0.0-beta.58",
40
40
  "java-deserialization": "^0.1.0",
41
41
  "unzipper": "^0.10.11"
42
42
  },
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "330ca82968253d60fd3cb8ed0d769718028a8688"
49
+ "gitHead": "4a5f36a02a668f15fa22b558eeeeb13237105212"
50
50
  }
@@ -1,4 +1,4 @@
1
- import { Vector2, Accuracy, ScoreRank, Mod, IModApplicableToDroid, DroidPlayableBeatmap, Beatmap } from '@rian8337/osu-base';
1
+ import { Vector2, Accuracy, ScoreRank, ModMap, DroidPlayableBeatmap, Beatmap } from '@rian8337/osu-base';
2
2
  import { IExtendedDroidDifficultyAttributes as IExtendedDroidDifficultyAttributes$1 } from '@rian8337/osu-difficulty-calculator';
3
3
  import { IExtendedDroidDifficultyAttributes } from '@rian8337/osu-rebalance-difficulty-calculator';
4
4
 
@@ -453,7 +453,7 @@ interface ReplayInformation {
453
453
  *
454
454
  * Only available in replay v3 or later.
455
455
  */
456
- convertedMods: (Mod & IModApplicableToDroid)[];
456
+ convertedMods: ModMap;
457
457
  /**
458
458
  * The cursor movement data of the replay.
459
459
  */
@@ -495,7 +495,7 @@ declare class ReplayV3Data extends ReplayData {
495
495
  /**
496
496
  * Enabled modifications during the play that have been converted to their respective `Mod` instances.
497
497
  */
498
- readonly convertedMods: (Mod & IModApplicableToDroid)[];
498
+ readonly convertedMods: ModMap;
499
499
  constructor(values: ReplayInformation);
500
500
  }
501
501