@rian8337/osu-rebalance-difficulty-calculator 1.0.1 → 1.1.0

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.
@@ -73,18 +73,16 @@ class DroidPerformanceCalculator extends PerformanceCalculator_1.PerformanceCalc
73
73
  // Combo scaling
74
74
  this.aim *= this.comboPenalty;
75
75
  // We want to give more reward for lower AR when it comes to aim and HD. This nerfs high AR and buffs lower AR.
76
- let hiddenBonus = 1;
77
76
  if (this.stars.mods.some((m) => m instanceof osu_base_1.ModHidden)) {
78
77
  // The bonus starts decreasing twice as fast
79
78
  // beyond AR10 and reaches 1 at AR11.
80
79
  if (calculatedAR > 10) {
81
- hiddenBonus += Math.max(0, 0.08 * (11 - calculatedAR));
80
+ this.aim *= 1 + Math.max(0, 0.08 * (11 - calculatedAR));
82
81
  }
83
82
  else {
84
- hiddenBonus += 0.04 * (12 - calculatedAR);
83
+ this.aim *= 1 + 0.04 * (12 - calculatedAR);
85
84
  }
86
85
  }
87
- this.aim *= hiddenBonus;
88
86
  // AR scaling
89
87
  let arFactor = 0;
90
88
  if (calculatedAR > 10.33) {
@@ -121,7 +119,7 @@ class DroidPerformanceCalculator extends PerformanceCalculator_1.PerformanceCalc
121
119
  // Penalize misses by assessing # of misses relative to the total # of objects. Default a 3% reduction for any # of misses.
122
120
  this.tap *=
123
121
  0.97 *
124
- Math.pow(1 - Math.pow(this.effectiveMissCount / objectCount, 0.775), this.effectiveMissCount);
122
+ Math.pow(1 - Math.pow(this.effectiveMissCount / objectCount, 0.775), Math.pow(this.effectiveMissCount, 0.875));
125
123
  }
126
124
  // Combo scaling
127
125
  this.tap *= this.comboPenalty;
@@ -6,6 +6,7 @@ const DroidAim_1 = require("./skills/DroidAim");
6
6
  const DroidTap_1 = require("./skills/DroidTap");
7
7
  const StarRating_1 = require("./base/StarRating");
8
8
  const DroidFlashlight_1 = require("./skills/DroidFlashlight");
9
+ const DroidRhythm_1 = require("./skills/DroidRhythm");
9
10
  /**
10
11
  * Difficulty calculator for osu!droid gamemode.
11
12
  */
@@ -20,6 +21,10 @@ class DroidStarRating extends StarRating_1.StarRating {
20
21
  * The tap star rating of the beatmap.
21
22
  */
22
23
  this.tap = 0;
24
+ /**
25
+ * The rhythm star rating of the beatmap.
26
+ */
27
+ this.rhythm = 0;
23
28
  /**
24
29
  * The flashlight star rating of the beatmap.
25
30
  */
@@ -80,6 +85,14 @@ class DroidStarRating extends StarRating_1.StarRating {
80
85
  this.attributes.speedNoteCount = objectStrains.reduce((total, next) => total + 1 / (1 + Math.exp(-((next / maxStrain) * 12 - 6))), 0);
81
86
  }
82
87
  }
88
+ /**
89
+ * Calculates the rhythm star rating of the beatmap and stores it in this instance.
90
+ */
91
+ calculateRhythm() {
92
+ const rhythmSkill = new DroidRhythm_1.DroidRhythm(this.mods, this.stats.od);
93
+ this.calculateSkills(rhythmSkill);
94
+ this.rhythm = this.starValue(rhythmSkill.difficultyValue());
95
+ }
83
96
  /**
84
97
  * Calculates the flashlight star rating of the beatmap and stores it in this instance.
85
98
  */
@@ -110,17 +123,19 @@ class DroidStarRating extends StarRating_1.StarRating {
110
123
  const skills = this.createSkills();
111
124
  const isRelax = this.mods.some((m) => m instanceof osu_base_1.ModRelax);
112
125
  if (isRelax) {
113
- // Remove speed skill to prevent overhead
114
- skills.splice(2, 1);
126
+ // Remove tap and rhythm skill to prevent overhead. These values will be 0 anyways.
127
+ skills.splice(2, 2);
115
128
  }
116
129
  this.calculateSkills(...skills);
117
130
  const aimSkill = skills[0];
118
- const aimSkillWithoutSliders = (skills[1]);
131
+ const aimSkillWithoutSliders = skills[1];
119
132
  let tapSkill;
133
+ let rhythmSkill;
120
134
  let flashlightSkill;
121
135
  if (!isRelax) {
122
- tapSkill = skills[2];
123
- flashlightSkill = skills[3];
136
+ rhythmSkill = skills[2];
137
+ tapSkill = skills[3];
138
+ flashlightSkill = skills[4];
124
139
  }
125
140
  else {
126
141
  flashlightSkill = skills[2];
@@ -143,6 +158,10 @@ class DroidStarRating extends StarRating_1.StarRating {
143
158
  1 / (1 + Math.exp(-((next / maxStrain) * 12 - 6))), 0);
144
159
  }
145
160
  }
161
+ if (rhythmSkill) {
162
+ this.calculateSkills(rhythmSkill);
163
+ this.rhythm = this.starValue(rhythmSkill.difficultyValue());
164
+ }
146
165
  this.strainPeaks.flashlight = flashlightSkill.strainPeaks;
147
166
  this.flashlight = this.starValue(flashlightSkill.difficultyValue());
148
167
  this.calculateTotal();
@@ -157,6 +176,8 @@ class DroidStarRating extends StarRating_1.StarRating {
157
176
  " aim, " +
158
177
  this.tap.toFixed(2) +
159
178
  " tap, " +
179
+ this.rhythm.toFixed(2) +
180
+ " rhythm, " +
160
181
  this.flashlight.toFixed(2) +
161
182
  " flashlight)");
162
183
  }
@@ -167,6 +188,8 @@ class DroidStarRating extends StarRating_1.StarRating {
167
188
  return [
168
189
  new DroidAim_1.DroidAim(this.mods, true),
169
190
  new DroidAim_1.DroidAim(this.mods, false),
191
+ // Tap skill depends on rhythm skill, so we put it first
192
+ new DroidRhythm_1.DroidRhythm(this.mods, this.stats.od),
170
193
  new DroidTap_1.DroidTap(this.mods, this.stats.od),
171
194
  new DroidFlashlight_1.DroidFlashlight(this.mods),
172
195
  ];
@@ -77,11 +77,9 @@ class OsuPerformanceCalculator extends PerformanceCalculator_1.PerformanceCalcul
77
77
  // Buff for longer maps with high AR.
78
78
  this.aim *= 1 + arFactor * lengthBonus;
79
79
  // We want to give more reward for lower AR when it comes to aim and HD. This nerfs high AR and buffs lower AR.
80
- let hiddenBonus = 1;
81
80
  if (this.stars.mods.some((m) => m instanceof osu_base_1.ModHidden)) {
82
- hiddenBonus += 0.04 * (12 - calculatedAR);
81
+ this.aim *= 1 + 0.04 * (12 - calculatedAR);
83
82
  }
84
- this.aim *= hiddenBonus;
85
83
  // Scale the aim value with slider factor to nerf very likely dropped sliderends.
86
84
  this.aim *= this.sliderNerfFactor;
87
85
  // Scale the aim value with accuracy.
@@ -93,7 +93,7 @@ class OsuStarRating extends StarRating_1.StarRating {
93
93
  }
94
94
  this.calculateSkills(...skills);
95
95
  const aimSkill = skills[0];
96
- const aimSkillWithoutSliders = (skills[1]);
96
+ const aimSkillWithoutSliders = skills[1];
97
97
  let speedSkill;
98
98
  let flashlightSkill;
99
99
  if (isRelax) {
@@ -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,22 +72,24 @@ 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,
82
85
  mods: mod,
83
86
  });
84
- // We assume 15% of sliders in a beatmap are difficult since there's no way to tell from the performance calculator.
85
- const estimateDifficultSliders = this.stars.map.sliders * 0.15;
86
- const estimateSliderEndsDropped = osu_base_1.MathUtils.clamp(Math.min(this.computedAccuracy.n300 +
87
- this.computedAccuracy.n50 +
88
- this.computedAccuracy.nmiss, maxCombo - combo), 0, estimateDifficultSliders);
89
87
  if (this.stars.map.sliders > 0) {
88
+ // We assume 15% of sliders in a beatmap are difficult since there's no way to tell from the performance calculator.
89
+ const estimateDifficultSliders = this.stars.map.sliders * 0.15;
90
+ const estimateSliderEndsDropped = osu_base_1.MathUtils.clamp(Math.min(this.computedAccuracy.n300 +
91
+ this.computedAccuracy.n50 +
92
+ this.computedAccuracy.nmiss, maxCombo - combo), 0, estimateDifficultSliders);
90
93
  this.sliderNerfFactor =
91
94
  (1 - this.stars.attributes.sliderFactor) *
92
95
  Math.pow(1 -
@@ -119,7 +122,7 @@ class PerformanceCalculator {
119
122
  comboBasedMissCount = Math.min(fullComboThreshold / Math.max(1, combo), this.stars.objects.length);
120
123
  }
121
124
  }
122
- return Math.max(this.computedAccuracy.nmiss, Math.floor(comboBasedMissCount));
125
+ return Math.max(this.computedAccuracy.nmiss, comboBasedMissCount);
123
126
  }
124
127
  }
125
128
  exports.PerformanceCalculator = PerformanceCalculator;
package/dist/index.js CHANGED
@@ -15,6 +15,7 @@ __exportStar(require("./preprocessing/DifficultyHitObjectCreator"), exports);
15
15
  __exportStar(require("./skills/DroidAim"), exports);
16
16
  __exportStar(require("./skills/DroidFlashlight"), exports);
17
17
  __exportStar(require("./DroidPerformanceCalculator"), exports);
18
+ __exportStar(require("./skills/DroidRhythm"), exports);
18
19
  __exportStar(require("./DroidStarRating"), exports);
19
20
  __exportStar(require("./skills/DroidTap"), exports);
20
21
  __exportStar(require("./MapStars"), exports);
@@ -19,6 +19,8 @@ class DifficultyHitObject {
19
19
  this.aimStrainWithoutSliders = 0;
20
20
  /**
21
21
  * The tap strain generated by the hitobject.
22
+ *
23
+ * This is also used for osu!standard as opposed to "speed strain".
22
24
  */
23
25
  this.tapStrain = 0;
24
26
  /**
@@ -27,9 +29,13 @@ class DifficultyHitObject {
27
29
  */
28
30
  this.originalTapStrain = 0;
29
31
  /**
30
- * The rhythm multiplier generated by the hitobject.
32
+ * The rhythm multiplier generated by the hitobject. This is used to alter tap strain.
31
33
  */
32
34
  this.rhythmMultiplier = 0;
35
+ /**
36
+ * The rhythm strain generated by the hitobject.
37
+ */
38
+ this.rhythmStrain = 0;
33
39
  /**
34
40
  * The flashlight strain generated by the hitobject.
35
41
  */
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DroidRhythm = void 0;
4
+ const osu_base_1 = require("@rian8337/osu-base");
5
+ const DroidSkill_1 = require("./DroidSkill");
6
+ /**
7
+ * Represents the skill required to properly follow a beatmap's rhythm.
8
+ */
9
+ class DroidRhythm extends DroidSkill_1.DroidSkill {
10
+ constructor(mods, overallDifficulty) {
11
+ super(mods);
12
+ this.historyLength = 32;
13
+ this.skillMultiplier = 1;
14
+ this.reducedSectionCount = 5;
15
+ this.reducedSectionBaseline = 0.75;
16
+ this.strainDecayBase = 0.3;
17
+ this.starsPerDouble = 2;
18
+ this.rhythmMultiplier = 0.75;
19
+ this.historyTimeMax = 5000; // 5 seconds of calculateRhythmBonus max.
20
+ this.currentRhythm = 1;
21
+ this.hitWindow = new osu_base_1.OsuHitWindow(overallDifficulty);
22
+ }
23
+ /**
24
+ * Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current object.
25
+ */
26
+ calculateRhythmBonus(current) {
27
+ if (current.object instanceof osu_base_1.Spinner) {
28
+ return 0;
29
+ }
30
+ let previousIslandSize = 0;
31
+ let rhythmComplexitySum = 0;
32
+ let islandSize = 1;
33
+ // Store the ratio of the current start of an island to buff for tighter rhythms.
34
+ let startRatio = 0;
35
+ let firstDeltaSwitch = false;
36
+ let rhythmStart = 0;
37
+ while (rhythmStart < this.previous.length - 2 &&
38
+ current.startTime - this.previous[rhythmStart].startTime <
39
+ this.historyTimeMax) {
40
+ ++rhythmStart;
41
+ }
42
+ for (let i = rhythmStart; i > 0; --i) {
43
+ // Scale note 0 to 1 from history to now.
44
+ let currentHistoricalDecay = (this.historyTimeMax -
45
+ (current.startTime - this.previous[i - 1].startTime)) /
46
+ this.historyTimeMax;
47
+ // Either we're limited by time or limited by object count.
48
+ currentHistoricalDecay = Math.min(currentHistoricalDecay, (this.previous.length - i) / this.previous.length);
49
+ const currentDelta = this.previous[i - 1].strainTime;
50
+ const prevDelta = this.previous[i].strainTime;
51
+ const lastDelta = this.previous[i + 1].strainTime;
52
+ const currentRatio = 1 +
53
+ 6 *
54
+ Math.min(0.5, Math.pow(Math.sin(Math.PI /
55
+ (Math.min(prevDelta, currentDelta) /
56
+ Math.max(prevDelta, currentDelta))), 2));
57
+ const windowPenalty = Math.min(1, Math.max(0, Math.abs(prevDelta - currentDelta) -
58
+ this.hitWindow.hitWindowFor300() * 0.6) /
59
+ (this.hitWindow.hitWindowFor300() * 0.6));
60
+ let effectiveRatio = windowPenalty * currentRatio;
61
+ if (firstDeltaSwitch) {
62
+ if (prevDelta <= 1.25 * currentDelta &&
63
+ prevDelta * 1.25 >= currentDelta) {
64
+ // Island is still progressing, count size.
65
+ if (islandSize < 7) {
66
+ ++islandSize;
67
+ }
68
+ }
69
+ else {
70
+ if (this.previous[i - 1].object instanceof osu_base_1.Slider) {
71
+ // BPM change is into slider, this is easy acc window.
72
+ effectiveRatio /= 8;
73
+ }
74
+ if (this.previous[i].object instanceof osu_base_1.Slider) {
75
+ // BPM change was from a slider, this is typically easier than circle -> circle.
76
+ effectiveRatio /= 4;
77
+ }
78
+ if (previousIslandSize === islandSize) {
79
+ // Repeated island size (ex: triplet -> triplet).
80
+ effectiveRatio /= 4;
81
+ }
82
+ if (previousIslandSize % 2 === islandSize % 2) {
83
+ // Repeated island polarity (2 -> 4, 3 -> 5).
84
+ effectiveRatio /= 2;
85
+ }
86
+ if (lastDelta > prevDelta + 10 &&
87
+ prevDelta > currentDelta + 10) {
88
+ // Previous increase happened a note ago.
89
+ // Albeit this is a 1/1 -> 1/2-1/4 type of transition, we don't want to buff this.
90
+ effectiveRatio /= 8;
91
+ }
92
+ rhythmComplexitySum +=
93
+ (((Math.sqrt(effectiveRatio * startRatio) *
94
+ currentHistoricalDecay *
95
+ Math.sqrt(4 + islandSize)) /
96
+ 2) *
97
+ Math.sqrt(4 + previousIslandSize)) /
98
+ 2;
99
+ startRatio = effectiveRatio;
100
+ previousIslandSize = islandSize;
101
+ if (prevDelta * 1.25 < currentDelta) {
102
+ // We're slowing down, stop counting.
103
+ // If we're speeding up, this stays as is and we keep counting island size.
104
+ firstDeltaSwitch = false;
105
+ }
106
+ islandSize = 1;
107
+ }
108
+ }
109
+ else if (prevDelta > 1.25 * currentDelta) {
110
+ // We want to be speeding up.
111
+ // Begin counting island until we change speed again.
112
+ firstDeltaSwitch = true;
113
+ startRatio = effectiveRatio;
114
+ islandSize = 1;
115
+ }
116
+ }
117
+ return Math.sqrt(4 + rhythmComplexitySum * this.rhythmMultiplier) / 2;
118
+ }
119
+ strainValueAt(current) {
120
+ this.currentRhythm = this.calculateRhythmBonus(current);
121
+ this.currentStrain *= this.strainDecay(current.deltaTime);
122
+ this.currentStrain += this.currentRhythm - 1;
123
+ return this.currentStrain;
124
+ }
125
+ saveToHitObject(current) {
126
+ current.rhythmStrain = this.currentStrain;
127
+ current.rhythmMultiplier = this.currentRhythm;
128
+ }
129
+ }
130
+ exports.DroidRhythm = DroidRhythm;
@@ -19,11 +19,7 @@ class DroidTap extends DroidSkill_1.DroidSkill {
19
19
  this.minSpeedBonus = 75;
20
20
  this.currentTapStrain = 0;
21
21
  this.currentOriginalTapStrain = 0;
22
- this.rhythmMultiplier = 0.75;
23
- this.historyTimeMax = 5000; // 5 seconds of calculateRhythmBonus max.
24
- this.currentRhythm = 1;
25
- this.overallDifficulty = overallDifficulty;
26
- this.hitWindow = new osu_base_1.OsuHitWindow(this.overallDifficulty);
22
+ this.hitWindow = new osu_base_1.OsuHitWindow(overallDifficulty);
27
23
  }
28
24
  /**
29
25
  * @param current The hitobject to calculate.
@@ -55,7 +51,6 @@ class DroidTap extends DroidSkill_1.DroidSkill {
55
51
  Math.pow((this.minSpeedBonus - current.strainTime) / 40, 2);
56
52
  }
57
53
  const decay = this.strainDecay(current.deltaTime);
58
- this.currentRhythm = this.calculateRhythmBonus(current);
59
54
  this.currentTapStrain *= decay;
60
55
  this.currentTapStrain +=
61
56
  this.tapStrainOf(speedBonus, strainTime) * this.skillMultiplier;
@@ -63,103 +58,7 @@ class DroidTap extends DroidSkill_1.DroidSkill {
63
58
  this.currentOriginalTapStrain +=
64
59
  this.tapStrainOf(originalSpeedBonus, current.strainTime) *
65
60
  this.skillMultiplier;
66
- return this.currentTapStrain * this.currentRhythm;
67
- }
68
- /**
69
- * Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current object.
70
- */
71
- calculateRhythmBonus(current) {
72
- if (current.object instanceof osu_base_1.Spinner) {
73
- return 0;
74
- }
75
- let previousIslandSize = 0;
76
- let rhythmComplexitySum = 0;
77
- let islandSize = 1;
78
- // Store the ratio of the current start of an island to buff for tighter rhythms.
79
- let startRatio = 0;
80
- let firstDeltaSwitch = false;
81
- let rhythmStart = 0;
82
- while (rhythmStart < this.previous.length - 2 &&
83
- current.startTime - this.previous[rhythmStart].startTime <
84
- this.historyTimeMax) {
85
- ++rhythmStart;
86
- }
87
- for (let i = rhythmStart; i > 0; --i) {
88
- // Scale note 0 to 1 from history to now.
89
- let currentHistoricalDecay = (this.historyTimeMax -
90
- (current.startTime - this.previous[i - 1].startTime)) /
91
- this.historyTimeMax;
92
- // Either we're limited by time or limited by object count.
93
- currentHistoricalDecay = Math.min(currentHistoricalDecay, (this.previous.length - i) / this.previous.length);
94
- const currentDelta = this.previous[i - 1].strainTime;
95
- const prevDelta = this.previous[i].strainTime;
96
- const lastDelta = this.previous[i + 1].strainTime;
97
- const currentRatio = 1 +
98
- 6 *
99
- Math.min(0.5, Math.pow(Math.sin(Math.PI /
100
- (Math.min(prevDelta, currentDelta) /
101
- Math.max(prevDelta, currentDelta))), 2));
102
- const windowPenalty = Math.min(1, Math.max(0, Math.abs(prevDelta - currentDelta) -
103
- this.hitWindow.hitWindowFor300() * 0.6) /
104
- (this.hitWindow.hitWindowFor300() * 0.6));
105
- let effectiveRatio = windowPenalty * currentRatio;
106
- if (firstDeltaSwitch) {
107
- if (prevDelta <= 1.25 * currentDelta &&
108
- prevDelta * 1.25 >= currentDelta) {
109
- // Island is still progressing, count size.
110
- if (islandSize < 7) {
111
- ++islandSize;
112
- }
113
- }
114
- else {
115
- if (this.previous[i - 1].object instanceof osu_base_1.Slider) {
116
- // BPM change is into slider, this is easy acc window.
117
- effectiveRatio /= 8;
118
- }
119
- if (this.previous[i].object instanceof osu_base_1.Slider) {
120
- // BPM change was from a slider, this is typically easier than circle -> circle.
121
- effectiveRatio /= 4;
122
- }
123
- if (previousIslandSize === islandSize) {
124
- // Repeated island size (ex: triplet -> triplet).
125
- effectiveRatio /= 4;
126
- }
127
- if (previousIslandSize % 2 === islandSize % 2) {
128
- // Repeated island polarity (2 -> 4, 3 -> 5).
129
- effectiveRatio /= 2;
130
- }
131
- if (lastDelta > prevDelta + 10 &&
132
- prevDelta > currentDelta + 10) {
133
- // Previous increase happened a note ago.
134
- // Albeit this is a 1/1 -> 1/2-1/4 type of transition, we don't want to buff this.
135
- effectiveRatio /= 8;
136
- }
137
- rhythmComplexitySum +=
138
- (((Math.sqrt(effectiveRatio * startRatio) *
139
- currentHistoricalDecay *
140
- Math.sqrt(4 + islandSize)) /
141
- 2) *
142
- Math.sqrt(4 + previousIslandSize)) /
143
- 2;
144
- startRatio = effectiveRatio;
145
- previousIslandSize = islandSize;
146
- if (prevDelta * 1.25 < currentDelta) {
147
- // We're slowing down, stop counting.
148
- // If we're speeding up, this stays as is and we keep counting island size.
149
- firstDeltaSwitch = false;
150
- }
151
- islandSize = 1;
152
- }
153
- }
154
- else if (prevDelta > 1.25 * currentDelta) {
155
- // We want to be speeding up.
156
- // Begin counting island until we change speed again.
157
- firstDeltaSwitch = true;
158
- startRatio = effectiveRatio;
159
- islandSize = 1;
160
- }
161
- }
162
- return Math.sqrt(4 + rhythmComplexitySum * this.rhythmMultiplier) / 2;
61
+ return this.currentTapStrain * current.rhythmMultiplier;
163
62
  }
164
63
  /**
165
64
  * Calculates the tap strain of a hitobject given a specific speed bonus and strain time.
@@ -178,9 +77,8 @@ class DroidTap extends DroidSkill_1.DroidSkill {
178
77
  */
179
78
  saveToHitObject(current) {
180
79
  current.tapStrain = this.currentStrain;
181
- current.rhythmMultiplier = this.currentRhythm;
182
80
  current.originalTapStrain =
183
- this.currentOriginalTapStrain * this.currentRhythm;
81
+ this.currentOriginalTapStrain * current.rhythmMultiplier;
184
82
  }
185
83
  }
186
84
  exports.DroidTap = DroidTap;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rian8337/osu-rebalance-difficulty-calculator",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
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",
@@ -21,6 +21,8 @@
21
21
  },
22
22
  "scripts": {
23
23
  "build": "tsc",
24
+ "generate-docs": "typedoc src/index.ts",
25
+ "lint": "eslint --ext ts",
24
26
  "prepare": "npm run build",
25
27
  "test": "jest -i"
26
28
  },
@@ -28,10 +30,10 @@
28
30
  "url": "https://github.com/Rian8337/osu-droid-module/issues"
29
31
  },
30
32
  "dependencies": {
31
- "@rian8337/osu-base": "^1.0.1"
33
+ "@rian8337/osu-base": "^1.0.5"
32
34
  },
33
35
  "publishConfig": {
34
36
  "access": "public"
35
37
  },
36
- "gitHead": "8406e60764d46fc30483b95f56a097f2c0245417"
38
+ "gitHead": "409e4106e7d7297924a55c625d4214fb0ba79a18"
37
39
  }
@@ -1,5 +1,15 @@
1
1
  declare module "@rian8337/osu-rebalance-difficulty-calculator" {
2
- import { Accuracy, Beatmap, HitObject, MapStats, Mod, modes, OsuHitWindow, Slider, Vector2 } from "@rian8337/osu-base";
2
+ import {
3
+ Accuracy,
4
+ Beatmap,
5
+ HitObject,
6
+ MapStats,
7
+ Mod,
8
+ modes,
9
+ OsuHitWindow,
10
+ Slider,
11
+ Vector2,
12
+ } from "@rian8337/osu-base";
3
13
 
4
14
  //#region Classes
5
15
 
@@ -21,6 +31,8 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
21
31
  aimStrainWithoutSliders: number;
22
32
  /**
23
33
  * The tap strain generated by the hitobject.
34
+ *
35
+ * This is also used for osu!standard as opposed to "speed strain".
24
36
  */
25
37
  tapStrain: number;
26
38
  /**
@@ -29,16 +41,20 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
29
41
  */
30
42
  originalTapStrain: number;
31
43
  /**
32
- * The rhythm multiplier generated by the hitobject.
44
+ * The rhythm multiplier generated by the hitobject. This is used to alter tap strain.
33
45
  */
34
46
  rhythmMultiplier: number;
47
+ /**
48
+ * The rhythm strain generated by the hitobject.
49
+ */
50
+ rhythmStrain: number;
35
51
  /**
36
52
  * The flashlight strain generated by the hitobject.
37
53
  */
38
54
  flashlightStrain: number;
39
55
  /**
40
56
  * The normalized distance from the "lazy" end position of the previous hitobject to the start position of this hitobject.
41
- *
57
+ *
42
58
  * The "lazy" end position is the position at which the cursor ends up if the previous hitobject is followed with as minimal movement as possible (i.e. on the edge of slider follow circles).
43
59
  */
44
60
  lazyJumpDistance: number;
@@ -268,6 +284,29 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
268
284
  override toString(): string;
269
285
  }
270
286
 
287
+ /**
288
+ * Represents the skill required to properly follow a beatmap's rhythm.
289
+ */
290
+ export class DroidRhythm extends DroidSkill {
291
+ protected override readonly historyLength: number;
292
+ protected override readonly skillMultiplier: number;
293
+ protected override readonly reducedSectionCount: number;
294
+ protected override readonly reducedSectionBaseline: number;
295
+ protected override readonly strainDecayBase: number;
296
+ protected override readonly starsPerDouble: number;
297
+ private readonly rhythmMultiplier: number;
298
+ private readonly historyTimeMax: number;
299
+ private currentRhythm: number;
300
+ private readonly hitWindow: OsuHitWindow;
301
+ constructor(mods: Mod[], overallDifficulty: number);
302
+ /**
303
+ * Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current object.
304
+ */
305
+ private calculateRhythmBonus(current: DifficultyHitObject): number;
306
+ protected override strainValueAt(current: DifficultyHitObject): number;
307
+ protected override saveToHitObject(current: DifficultyHitObject): void;
308
+ }
309
+
271
310
  /**
272
311
  * Difficulty calculator for osu!droid gamemode.
273
312
  */
@@ -280,6 +319,10 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
280
319
  * The tap star rating of the beatmap.
281
320
  */
282
321
  tap: number;
322
+ /**
323
+ * The rhythm star rating of the beatmap.
324
+ */
325
+ rhythm: number;
283
326
  /**
284
327
  * The flashlight star rating of the beatmap.
285
328
  */
@@ -325,6 +368,10 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
325
368
  * Calculates the tap star rating of the beatmap and stores it in this instance.
326
369
  */
327
370
  calculateTap(): void;
371
+ /**
372
+ * Calculates the rhythm star rating of the beatmap and stores it in this instance.
373
+ */
374
+ calculateRhythm(): void;
328
375
  /**
329
376
  * Calculates the flashlight star rating of the beatmap and stores it in this instance.
330
377
  */
@@ -370,10 +417,6 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
370
417
  private readonly minSpeedBonus: number;
371
418
  private currentTapStrain: number;
372
419
  private currentOriginalTapStrain: number;
373
- private readonly rhythmMultiplier: number;
374
- private readonly historyTimeMax: number;
375
- private currentRhythm: number;
376
- private readonly overallDifficulty: number;
377
420
  private readonly hitWindow: OsuHitWindow;
378
421
  constructor(mods: Mod[], overallDifficulty: number);
379
422
  /**
@@ -854,7 +897,10 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
854
897
  /**
855
898
  * Calculates the amount of misses + sliderbreaks from combo.
856
899
  */
857
- private calculateEffectiveMissCount(combo: number, maxCombo: number): number;
900
+ private calculateEffectiveMissCount(
901
+ combo: number,
902
+ maxCombo: number
903
+ ): number;
858
904
  }
859
905
 
860
906
  /**