@rian8337/osu-difficulty-calculator 1.2.1 → 1.2.3

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.
@@ -115,7 +115,9 @@ class DroidStarRating extends StarRating_1.StarRating {
115
115
  if (!isRelax) {
116
116
  this.postCalculateTap(tapSkill);
117
117
  }
118
- this.calculateSpeedNoteCount();
118
+ else {
119
+ this.calculateSpeedNoteCount();
120
+ }
119
121
  if (!isRelax) {
120
122
  this.postCalculateRhythm(rhythmSkill);
121
123
  }
@@ -35,15 +35,8 @@ class OsuStarRating extends StarRating_1.StarRating {
35
35
  calculateAim() {
36
36
  const aimSkill = new OsuAim_1.OsuAim(this.mods, true);
37
37
  const aimSkillWithoutSliders = new OsuAim_1.OsuAim(this.mods, false);
38
- this.calculateSkills(aimSkill);
39
- this.strainPeaks.aimWithSliders = aimSkill.strainPeaks;
40
- this.strainPeaks.aimWithoutSliders = aimSkillWithoutSliders.strainPeaks;
41
- this.aim = this.starValue(aimSkill.difficultyValue());
42
- if (this.aim) {
43
- this.attributes.sliderFactor =
44
- this.starValue(aimSkillWithoutSliders.difficultyValue()) /
45
- this.aim;
46
- }
38
+ this.calculateSkills(aimSkill, aimSkillWithoutSliders);
39
+ this.postCalculateAim(aimSkill, aimSkillWithoutSliders);
47
40
  }
48
41
  /**
49
42
  * Calculates the speed star rating of the beatmap and stores it in this instance.
@@ -54,8 +47,7 @@ class OsuStarRating extends StarRating_1.StarRating {
54
47
  }
55
48
  const speedSkill = new OsuSpeed_1.OsuSpeed(this.mods, new osu_base_1.OsuHitWindow(this.stats.od).hitWindowFor300());
56
49
  this.calculateSkills(speedSkill);
57
- this.strainPeaks.speed = speedSkill.strainPeaks;
58
- this.speed = this.starValue(speedSkill.difficultyValue());
50
+ this.postCalculateSpeed(speedSkill);
59
51
  }
60
52
  /**
61
53
  * Calculates the flashlight star rating of the beatmap and stores it in this instance.
@@ -63,8 +55,7 @@ class OsuStarRating extends StarRating_1.StarRating {
63
55
  calculateFlashlight() {
64
56
  const flashlightSkill = new OsuFlashlight_1.OsuFlashlight(this.mods);
65
57
  this.calculateSkills(flashlightSkill);
66
- this.strainPeaks.flashlight = flashlightSkill.strainPeaks;
67
- this.flashlight = this.starValue(flashlightSkill.difficultyValue());
58
+ this.postCalculateFlashlight(flashlightSkill);
68
59
  }
69
60
  calculateTotal() {
70
61
  const aimPerformanceValue = this.basePerformanceValue(this.aim);
@@ -87,10 +78,6 @@ class OsuStarRating extends StarRating_1.StarRating {
87
78
  calculateAll() {
88
79
  const skills = this.createSkills();
89
80
  const isRelax = this.mods.some((m) => m instanceof osu_base_1.ModRelax);
90
- if (isRelax) {
91
- // Remove speed skill to prevent overhead
92
- skills.splice(2, 1);
93
- }
94
81
  this.calculateSkills(...skills);
95
82
  const aimSkill = skills[0];
96
83
  const aimSkillWithoutSliders = skills[1];
@@ -103,20 +90,11 @@ class OsuStarRating extends StarRating_1.StarRating {
103
90
  speedSkill = skills[2];
104
91
  flashlightSkill = skills[3];
105
92
  }
106
- this.strainPeaks.aimWithSliders = aimSkill.strainPeaks;
107
- this.strainPeaks.aimWithoutSliders = aimSkillWithoutSliders.strainPeaks;
108
- this.aim = this.starValue(aimSkill.difficultyValue());
109
- if (this.aim) {
110
- this.attributes.sliderFactor =
111
- this.starValue(aimSkillWithoutSliders.difficultyValue()) /
112
- this.aim;
113
- }
93
+ this.postCalculateAim(aimSkill, aimSkillWithoutSliders);
114
94
  if (speedSkill) {
115
- this.strainPeaks.speed = speedSkill.strainPeaks;
116
- this.speed = this.starValue(speedSkill.difficultyValue());
95
+ this.postCalculateSpeed(speedSkill);
117
96
  }
118
- this.strainPeaks.flashlight = flashlightSkill.strainPeaks;
119
- this.flashlight = this.starValue(flashlightSkill.difficultyValue());
97
+ this.postCalculateFlashlight(flashlightSkill);
120
98
  this.calculateTotal();
121
99
  }
122
100
  /**
@@ -143,5 +121,39 @@ class OsuStarRating extends StarRating_1.StarRating {
143
121
  new OsuFlashlight_1.OsuFlashlight(this.mods),
144
122
  ];
145
123
  }
124
+ /**
125
+ * Called after aim skill calculation.
126
+ *
127
+ * @param aimSkill The aim skill that considers sliders.
128
+ * @param aimSkillWithoutSliders The aim skill that doesn't consider sliders.
129
+ */
130
+ postCalculateAim(aimSkill, aimSkillWithoutSliders) {
131
+ this.strainPeaks.aimWithSliders = aimSkill.strainPeaks;
132
+ this.strainPeaks.aimWithoutSliders = aimSkillWithoutSliders.strainPeaks;
133
+ this.aim = this.starValue(aimSkill.difficultyValue());
134
+ if (this.aim) {
135
+ this.attributes.sliderFactor =
136
+ this.starValue(aimSkillWithoutSliders.difficultyValue()) /
137
+ this.aim;
138
+ }
139
+ }
140
+ /**
141
+ * Called after speed skill calculation.
142
+ *
143
+ * @param speedSkill The speed skill.
144
+ */
145
+ postCalculateSpeed(speedSkill) {
146
+ this.strainPeaks.speed = speedSkill.strainPeaks;
147
+ this.speed = this.starValue(speedSkill.difficultyValue());
148
+ }
149
+ /**
150
+ * Called after flashlight skill calculation.
151
+ *
152
+ * @param flashlightSkill The flashlight skill.
153
+ */
154
+ postCalculateFlashlight(flashlightSkill) {
155
+ this.strainPeaks.flashlight = flashlightSkill.strainPeaks;
156
+ this.flashlight = this.starValue(flashlightSkill.difficultyValue());
157
+ }
146
158
  }
147
159
  exports.OsuStarRating = OsuStarRating;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rian8337/osu-difficulty-calculator",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "A module for calculating osu!standard beatmap difficulty and performance value with respect to the current difficulty and performance algorithm.",
5
5
  "keywords": [
6
6
  "osu",
@@ -35,5 +35,5 @@
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
- "gitHead": "8c08cf8f2c3af4b9a306f9fe9ffedfe339b9b046"
38
+ "gitHead": "e2d1f9bef01c9b12954a78683c3b8dcddabc7b1d"
39
39
  }
@@ -414,16 +414,6 @@ declare module "@rian8337/osu-difficulty-calculator" {
414
414
  * @param flashlightSkill The flashlight skill.
415
415
  */
416
416
  private postCalculateFlashlight(flashlightSkill: DroidFlashlight): void;
417
- /**
418
- * Calculates the base rating value of a difficulty.
419
- */
420
- private baseRatingValue(difficulty: number): number;
421
- /**
422
- * Calculates the base performance value of a difficulty rating.
423
- *
424
- * @param rating The difficulty rating.
425
- */
426
- private basePerformanceValue(rating: number): number;
427
417
  }
428
418
 
429
419
  /**
@@ -716,17 +706,27 @@ declare module "@rian8337/osu-difficulty-calculator" {
716
706
  */
717
707
  protected override createSkills(): OsuSkill[];
718
708
  /**
719
- * Calculates the base performance value of a difficulty rating.
709
+ * Called after aim skill calculation.
720
710
  *
721
- * @param rating The difficulty rating.
711
+ * @param aimSkill The aim skill that considers sliders.
712
+ * @param aimSkillWithoutSliders The aim skill that doesn't consider sliders.
722
713
  */
723
- private basePerformanceValue(rating: number): number;
714
+ private postCalculateAim(
715
+ aimSkill: OsuAim,
716
+ aimSkillWithoutSliders: OsuAim
717
+ ): void;
724
718
  /**
725
- * Calculates the star rating value of a difficulty.
719
+ * Called after speed skill calculation.
726
720
  *
727
- * @param difficulty The difficulty to calculate.
721
+ * @param speedSkill The speed skill.
728
722
  */
729
- private starValue(difficulty: number): number;
723
+ private postCalculateSpeed(speedSkill: OsuSpeed): void;
724
+ /**
725
+ * Called after flashlight skill calculation.
726
+ *
727
+ * @param flashlightSkill The flashlight skill.
728
+ */
729
+ private postCalculateFlashlight(flashlightSkill: OsuFlashlight): void;
730
730
  }
731
731
 
732
732
  //#endregion
@@ -1061,6 +1061,18 @@ declare module "@rian8337/osu-difficulty-calculator" {
1061
1061
  * Creates skills to be calculated.
1062
1062
  */
1063
1063
  protected abstract createSkills(): Skill[];
1064
+ /**
1065
+ * Calculates the star rating value of a difficulty.
1066
+ *
1067
+ * @param difficulty The difficulty to calculate.
1068
+ */
1069
+ protected starValue(difficulty: number): number;
1070
+ /**
1071
+ * Calculates the base performance value of a difficulty rating.
1072
+ *
1073
+ * @param rating The difficulty rating.
1074
+ */
1075
+ protected basePerformanceValue(rating: number): number;
1064
1076
  }
1065
1077
 
1066
1078
  /**