@rian8337/osu-rebalance-difficulty-calculator 1.0.4 → 1.2.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.
- package/dist/DroidStarRating.js +29 -23
- package/dist/index.js +1 -0
- package/dist/preprocessing/DifficultyHitObject.js +7 -1
- package/dist/skills/DroidRhythm.js +130 -0
- package/dist/skills/DroidTap.js +4 -106
- package/package.json +3 -3
- package/typings/index.d.ts +38 -5
package/dist/DroidStarRating.js
CHANGED
|
@@ -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
|
*/
|
|
@@ -67,9 +72,6 @@ class DroidStarRating extends StarRating_1.StarRating {
|
|
|
67
72
|
* Calculates the speed star rating of the beatmap and stores it in this instance.
|
|
68
73
|
*/
|
|
69
74
|
calculateTap() {
|
|
70
|
-
if (this.mods.some((m) => m instanceof osu_base_1.ModRelax)) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
75
|
const tapSkill = new DroidTap_1.DroidTap(this.mods, this.stats.od);
|
|
74
76
|
this.calculateSkills(tapSkill);
|
|
75
77
|
this.strainPeaks.speed = tapSkill.strainPeaks;
|
|
@@ -80,6 +82,14 @@ class DroidStarRating extends StarRating_1.StarRating {
|
|
|
80
82
|
this.attributes.speedNoteCount = objectStrains.reduce((total, next) => total + 1 / (1 + Math.exp(-((next / maxStrain) * 12 - 6))), 0);
|
|
81
83
|
}
|
|
82
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Calculates the rhythm star rating of the beatmap and stores it in this instance.
|
|
87
|
+
*/
|
|
88
|
+
calculateRhythm() {
|
|
89
|
+
const rhythmSkill = new DroidRhythm_1.DroidRhythm(this.mods, this.stats.od);
|
|
90
|
+
this.calculateSkills(rhythmSkill);
|
|
91
|
+
this.rhythm = this.starValue(rhythmSkill.difficultyValue());
|
|
92
|
+
}
|
|
83
93
|
/**
|
|
84
94
|
* Calculates the flashlight star rating of the beatmap and stores it in this instance.
|
|
85
95
|
*/
|
|
@@ -109,22 +119,12 @@ class DroidStarRating extends StarRating_1.StarRating {
|
|
|
109
119
|
calculateAll() {
|
|
110
120
|
const skills = this.createSkills();
|
|
111
121
|
const isRelax = this.mods.some((m) => m instanceof osu_base_1.ModRelax);
|
|
112
|
-
if (isRelax) {
|
|
113
|
-
// Remove speed skill to prevent overhead
|
|
114
|
-
skills.splice(2, 1);
|
|
115
|
-
}
|
|
116
122
|
this.calculateSkills(...skills);
|
|
117
123
|
const aimSkill = skills[0];
|
|
118
124
|
const aimSkillWithoutSliders = skills[1];
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
tapSkill = skills[2];
|
|
123
|
-
flashlightSkill = skills[3];
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
flashlightSkill = skills[2];
|
|
127
|
-
}
|
|
125
|
+
const rhythmSkill = skills[2];
|
|
126
|
+
const tapSkill = skills[3];
|
|
127
|
+
const flashlightSkill = skills[4];
|
|
128
128
|
this.strainPeaks.aimWithSliders = aimSkill.strainPeaks;
|
|
129
129
|
this.strainPeaks.aimWithoutSliders = aimSkillWithoutSliders.strainPeaks;
|
|
130
130
|
this.aim = this.starValue(aimSkill.difficultyValue());
|
|
@@ -133,15 +133,17 @@ class DroidStarRating extends StarRating_1.StarRating {
|
|
|
133
133
|
this.starValue(aimSkillWithoutSliders.difficultyValue()) /
|
|
134
134
|
this.aim;
|
|
135
135
|
}
|
|
136
|
-
if (
|
|
136
|
+
if (!isRelax) {
|
|
137
137
|
this.strainPeaks.speed = tapSkill.strainPeaks;
|
|
138
138
|
this.tap = this.starValue(tapSkill.difficultyValue());
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
139
|
+
}
|
|
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) {
|
|
146
|
+
this.rhythm = this.starValue(rhythmSkill.difficultyValue());
|
|
145
147
|
}
|
|
146
148
|
this.strainPeaks.flashlight = flashlightSkill.strainPeaks;
|
|
147
149
|
this.flashlight = this.starValue(flashlightSkill.difficultyValue());
|
|
@@ -157,6 +159,8 @@ class DroidStarRating extends StarRating_1.StarRating {
|
|
|
157
159
|
" aim, " +
|
|
158
160
|
this.tap.toFixed(2) +
|
|
159
161
|
" tap, " +
|
|
162
|
+
this.rhythm.toFixed(2) +
|
|
163
|
+
" rhythm, " +
|
|
160
164
|
this.flashlight.toFixed(2) +
|
|
161
165
|
" flashlight)");
|
|
162
166
|
}
|
|
@@ -167,6 +171,8 @@ class DroidStarRating extends StarRating_1.StarRating {
|
|
|
167
171
|
return [
|
|
168
172
|
new DroidAim_1.DroidAim(this.mods, true),
|
|
169
173
|
new DroidAim_1.DroidAim(this.mods, false),
|
|
174
|
+
// Tap skill depends on rhythm skill, so we put it first
|
|
175
|
+
new DroidRhythm_1.DroidRhythm(this.mods, this.stats.od),
|
|
170
176
|
new DroidTap_1.DroidTap(this.mods, this.stats.od),
|
|
171
177
|
new DroidFlashlight_1.DroidFlashlight(this.mods),
|
|
172
178
|
];
|
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;
|
package/dist/skills/DroidTap.js
CHANGED
|
@@ -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.
|
|
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.
|
|
@@ -41,7 +37,7 @@ class DroidTap extends DroidSkill_1.DroidSkill {
|
|
|
41
37
|
strainTime = osu_base_1.Interpolation.lerp(this.previous[0].strainTime, strainTime, strainTime / greatWindowFull);
|
|
42
38
|
}
|
|
43
39
|
// Cap deltatime to the OD 300 hitwindow.
|
|
44
|
-
// 0.
|
|
40
|
+
// 0.58 is derived from making sure 260 BPM 1/4 OD5 streams aren't nerfed harshly, whilst 0.92 limits the effect of the cap.
|
|
45
41
|
strainTime /= osu_base_1.MathUtils.clamp(strainTime / greatWindowFull / 0.58, 0.92, 1);
|
|
46
42
|
let speedBonus = 1;
|
|
47
43
|
if (strainTime < this.minSpeedBonus) {
|
|
@@ -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 *
|
|
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 *
|
|
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
|
|
3
|
+
"version": "1.2.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",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"url": "https://github.com/Rian8337/osu-droid-module/issues"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@rian8337/osu-base": "^1.0.
|
|
33
|
+
"@rian8337/osu-base": "^1.0.5"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "745e369ae1c5895e7a58188cb522eaecac618966"
|
|
39
39
|
}
|
package/typings/index.d.ts
CHANGED
|
@@ -31,6 +31,8 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
31
31
|
aimStrainWithoutSliders: number;
|
|
32
32
|
/**
|
|
33
33
|
* The tap strain generated by the hitobject.
|
|
34
|
+
*
|
|
35
|
+
* This is also used for osu!standard as opposed to "speed strain".
|
|
34
36
|
*/
|
|
35
37
|
tapStrain: number;
|
|
36
38
|
/**
|
|
@@ -39,9 +41,13 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
39
41
|
*/
|
|
40
42
|
originalTapStrain: number;
|
|
41
43
|
/**
|
|
42
|
-
* The rhythm multiplier generated by the hitobject.
|
|
44
|
+
* The rhythm multiplier generated by the hitobject. This is used to alter tap strain.
|
|
43
45
|
*/
|
|
44
46
|
rhythmMultiplier: number;
|
|
47
|
+
/**
|
|
48
|
+
* The rhythm strain generated by the hitobject.
|
|
49
|
+
*/
|
|
50
|
+
rhythmStrain: number;
|
|
45
51
|
/**
|
|
46
52
|
* The flashlight strain generated by the hitobject.
|
|
47
53
|
*/
|
|
@@ -278,6 +284,29 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
278
284
|
override toString(): string;
|
|
279
285
|
}
|
|
280
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
|
+
|
|
281
310
|
/**
|
|
282
311
|
* Difficulty calculator for osu!droid gamemode.
|
|
283
312
|
*/
|
|
@@ -290,6 +319,10 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
290
319
|
* The tap star rating of the beatmap.
|
|
291
320
|
*/
|
|
292
321
|
tap: number;
|
|
322
|
+
/**
|
|
323
|
+
* The rhythm star rating of the beatmap.
|
|
324
|
+
*/
|
|
325
|
+
rhythm: number;
|
|
293
326
|
/**
|
|
294
327
|
* The flashlight star rating of the beatmap.
|
|
295
328
|
*/
|
|
@@ -335,6 +368,10 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
335
368
|
* Calculates the tap star rating of the beatmap and stores it in this instance.
|
|
336
369
|
*/
|
|
337
370
|
calculateTap(): void;
|
|
371
|
+
/**
|
|
372
|
+
* Calculates the rhythm star rating of the beatmap and stores it in this instance.
|
|
373
|
+
*/
|
|
374
|
+
calculateRhythm(): void;
|
|
338
375
|
/**
|
|
339
376
|
* Calculates the flashlight star rating of the beatmap and stores it in this instance.
|
|
340
377
|
*/
|
|
@@ -380,10 +417,6 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
380
417
|
private readonly minSpeedBonus: number;
|
|
381
418
|
private currentTapStrain: number;
|
|
382
419
|
private currentOriginalTapStrain: number;
|
|
383
|
-
private readonly rhythmMultiplier: number;
|
|
384
|
-
private readonly historyTimeMax: number;
|
|
385
|
-
private currentRhythm: number;
|
|
386
|
-
private readonly overallDifficulty: number;
|
|
387
420
|
private readonly hitWindow: OsuHitWindow;
|
|
388
421
|
constructor(mods: Mod[], overallDifficulty: number);
|
|
389
422
|
/**
|