@rian8337/osu-difficulty-calculator 1.1.0 → 1.1.1

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.
@@ -72,9 +72,6 @@ class DroidStarRating extends StarRating_1.StarRating {
72
72
  * Calculates the speed star rating of the beatmap and stores it in this instance.
73
73
  */
74
74
  calculateTap() {
75
- if (this.mods.some((m) => m instanceof osu_base_1.ModRelax)) {
76
- return;
77
- }
78
75
  const tapSkill = new DroidTap_1.DroidTap(this.mods, this.stats.od);
79
76
  this.calculateSkills(tapSkill);
80
77
  this.strainPeaks.speed = tapSkill.strainPeaks;
@@ -122,24 +119,12 @@ class DroidStarRating extends StarRating_1.StarRating {
122
119
  calculateAll() {
123
120
  const skills = this.createSkills();
124
121
  const isRelax = this.mods.some((m) => m instanceof osu_base_1.ModRelax);
125
- if (isRelax) {
126
- // Remove tap and rhythm skill to prevent overhead. These values will be 0 anyways.
127
- skills.splice(2, 2);
128
- }
129
122
  this.calculateSkills(...skills);
130
123
  const aimSkill = skills[0];
131
124
  const aimSkillWithoutSliders = skills[1];
132
- let tapSkill;
133
- let rhythmSkill;
134
- let flashlightSkill;
135
- if (!isRelax) {
136
- rhythmSkill = skills[2];
137
- tapSkill = skills[3];
138
- flashlightSkill = skills[4];
139
- }
140
- else {
141
- flashlightSkill = skills[2];
142
- }
125
+ const rhythmSkill = skills[2];
126
+ const tapSkill = skills[3];
127
+ const flashlightSkill = skills[4];
143
128
  this.strainPeaks.aimWithSliders = aimSkill.strainPeaks;
144
129
  this.strainPeaks.aimWithoutSliders = aimSkillWithoutSliders.strainPeaks;
145
130
  this.aim = this.starValue(aimSkill.difficultyValue());
@@ -148,18 +133,16 @@ class DroidStarRating extends StarRating_1.StarRating {
148
133
  this.starValue(aimSkillWithoutSliders.difficultyValue()) /
149
134
  this.aim;
150
135
  }
151
- if (tapSkill) {
136
+ if (!isRelax) {
152
137
  this.strainPeaks.speed = tapSkill.strainPeaks;
153
138
  this.tap = this.starValue(tapSkill.difficultyValue());
154
- const objectStrains = this.objects.map((v) => v.tapStrain);
155
- const maxStrain = Math.max(...objectStrains);
156
- if (maxStrain) {
157
- this.attributes.speedNoteCount = objectStrains.reduce((total, next) => total +
158
- 1 / (1 + Math.exp(-((next / maxStrain) * 12 - 6))), 0);
159
- }
160
139
  }
161
- if (rhythmSkill) {
162
- this.calculateSkills(rhythmSkill);
140
+ const objectStrains = this.objects.map((v) => v.tapStrain);
141
+ const maxStrain = Math.max(...objectStrains);
142
+ if (maxStrain) {
143
+ this.attributes.speedNoteCount = objectStrains.reduce((total, next) => total + 1 / (1 + Math.exp(-((next / maxStrain) * 12 - 6))), 0);
144
+ }
145
+ if (!isRelax) {
163
146
  this.rhythm = this.starValue(rhythmSkill.difficultyValue());
164
147
  }
165
148
  this.strainPeaks.flashlight = flashlightSkill.strainPeaks;
@@ -62,8 +62,9 @@ class PerformanceCalculator {
62
62
  nmiss: params.miss || 0,
63
63
  });
64
64
  }
65
+ this.effectiveMissCount = this.calculateEffectiveMissCount(combo, maxCombo);
65
66
  if (this.stars.mods.some((m) => m instanceof osu_base_1.ModNoFail)) {
66
- this.finalMultiplier *= Math.max(0.9, 1 - 0.02 * this.computedAccuracy.nmiss);
67
+ this.finalMultiplier *= Math.max(0.9, 1 - 0.02 * this.effectiveMissCount);
67
68
  }
68
69
  if (this.stars.mods.some((m) => m instanceof osu_base_1.ModSpunOut)) {
69
70
  this.finalMultiplier *=
@@ -71,11 +72,13 @@ class PerformanceCalculator {
71
72
  Math.pow(this.stars.map.spinners / this.stars.objects.length, 0.85);
72
73
  }
73
74
  if (this.stars.mods.some((m) => m instanceof osu_base_1.ModRelax)) {
74
- this.computedAccuracy.nmiss +=
75
- this.computedAccuracy.n100 + this.computedAccuracy.n50;
75
+ // As we're adding 100s and 50s to an approximated number of combo breaks, the result can be higher
76
+ // than total hits in specific scenarios (which breaks some calculations), so we need to clamp it.
77
+ this.effectiveMissCount = Math.min(this.effectiveMissCount +
78
+ this.computedAccuracy.n100 +
79
+ this.computedAccuracy.n50, this.stars.objects.length);
76
80
  this.finalMultiplier *= 0.6;
77
81
  }
78
- this.effectiveMissCount = this.calculateEffectiveMissCount(combo, maxCombo);
79
82
  this.mapStatistics = new osu_base_1.MapStats({
80
83
  ar: baseAR,
81
84
  od: baseOD,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rian8337/osu-difficulty-calculator",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
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": "409e4106e7d7297924a55c625d4214fb0ba79a18"
38
+ "gitHead": "595c6aac626f4346807f6da868c86324fed52422"
39
39
  }