@rian8337/osu-difficulty-calculator 1.2.9 → 1.4.8
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.
|
@@ -29,22 +29,26 @@ class DroidPerformanceCalculator extends PerformanceCalculator_1.PerformanceCalc
|
|
|
29
29
|
*/
|
|
30
30
|
this.flashlight = 0;
|
|
31
31
|
this.aggregatedRhythmMultiplier = 0;
|
|
32
|
+
this.tapPenalty = 1;
|
|
32
33
|
}
|
|
33
34
|
calculate(params) {
|
|
34
|
-
this.
|
|
35
|
+
this.tapPenalty = params.tapPenalty ?? 1;
|
|
36
|
+
return this.calculateInternal(params, osu_base_1.modes.droid);
|
|
37
|
+
}
|
|
38
|
+
calculateValues() {
|
|
35
39
|
this.calculateAverageRhythmMultiplier();
|
|
36
40
|
this.calculateAimValue();
|
|
37
41
|
this.calculateTapValue();
|
|
38
42
|
this.calculateAccuracyValue();
|
|
39
43
|
this.calculateFlashlightValue();
|
|
40
44
|
// Apply tap penalty for penalized plays.
|
|
41
|
-
this.tap /=
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
this.tap /= this.tapPenalty;
|
|
46
|
+
}
|
|
47
|
+
calculateTotalValue() {
|
|
48
|
+
return (Math.pow(Math.pow(this.aim, 1.1) +
|
|
49
|
+
Math.pow(this.tap, 1.1) +
|
|
50
|
+
Math.pow(this.accuracy, 1.1) +
|
|
51
|
+
Math.pow(this.flashlight, 1.1), 1 / 1.1) * this.finalMultiplier);
|
|
48
52
|
}
|
|
49
53
|
/**
|
|
50
54
|
* Calculates the average rhythm multiplier of the beatmap.
|
|
@@ -30,17 +30,19 @@ class OsuPerformanceCalculator extends PerformanceCalculator_1.PerformanceCalcul
|
|
|
30
30
|
this.flashlight = 0;
|
|
31
31
|
}
|
|
32
32
|
calculate(params) {
|
|
33
|
-
this.
|
|
33
|
+
return this.calculateInternal(params, osu_base_1.modes.osu);
|
|
34
|
+
}
|
|
35
|
+
calculateValues() {
|
|
34
36
|
this.calculateAimValue();
|
|
35
37
|
this.calculateSpeedValue();
|
|
36
38
|
this.calculateAccuracyValue();
|
|
37
39
|
this.calculateFlashlightValue();
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
}
|
|
41
|
+
calculateTotalValue() {
|
|
42
|
+
return (Math.pow(Math.pow(this.aim, 1.1) +
|
|
43
|
+
Math.pow(this.speed, 1.1) +
|
|
44
|
+
Math.pow(this.accuracy, 1.1) +
|
|
45
|
+
Math.pow(this.flashlight, 1.1), 1 / 1.1) * this.finalMultiplier);
|
|
44
46
|
}
|
|
45
47
|
/**
|
|
46
48
|
* Calculates the aim performance value of the beatmap.
|
|
@@ -33,7 +33,16 @@ class PerformanceCalculator {
|
|
|
33
33
|
this.sliderNerfFactor = 1;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* Internal calculation method, used to process calculation from implementations.
|
|
37
|
+
*/
|
|
38
|
+
calculateInternal(params, mode) {
|
|
39
|
+
this.handleParams(params, mode);
|
|
40
|
+
this.calculateValues();
|
|
41
|
+
this.total = this.calculateTotalValue();
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Calculates the base performance value of a star rating.
|
|
37
46
|
*/
|
|
38
47
|
baseValue(stars) {
|
|
39
48
|
return Math.pow(5 * Math.max(1, stars / 0.0675) - 4, 3) / 100000;
|
|
@@ -62,7 +71,7 @@ class PerformanceCalculator {
|
|
|
62
71
|
nmiss: params.miss || 0,
|
|
63
72
|
});
|
|
64
73
|
}
|
|
65
|
-
this.effectiveMissCount = this.calculateEffectiveMissCount(combo, maxCombo);
|
|
74
|
+
this.effectiveMissCount = this.calculateEffectiveMissCount(combo, maxCombo, mode);
|
|
66
75
|
if (this.stars.mods.some((m) => m instanceof osu_base_1.ModNoFail)) {
|
|
67
76
|
this.finalMultiplier *= Math.max(0.9, 1 - 0.02 * this.effectiveMissCount);
|
|
68
77
|
}
|
|
@@ -112,7 +121,7 @@ class PerformanceCalculator {
|
|
|
112
121
|
/**
|
|
113
122
|
* Calculates the amount of misses + sliderbreaks from combo.
|
|
114
123
|
*/
|
|
115
|
-
calculateEffectiveMissCount(combo, maxCombo) {
|
|
124
|
+
calculateEffectiveMissCount(combo, maxCombo, mode) {
|
|
116
125
|
let comboBasedMissCount = 0;
|
|
117
126
|
if (this.stars.map.sliders > 0) {
|
|
118
127
|
const fullComboThreshold = maxCombo - 0.1 * this.stars.map.sliders;
|
|
@@ -122,7 +131,9 @@ class PerformanceCalculator {
|
|
|
122
131
|
comboBasedMissCount = Math.min(fullComboThreshold / Math.max(1, combo), this.stars.objects.length);
|
|
123
132
|
}
|
|
124
133
|
}
|
|
125
|
-
return Math.max(this.computedAccuracy.nmiss,
|
|
134
|
+
return Math.max(this.computedAccuracy.nmiss, mode === osu_base_1.modes.droid
|
|
135
|
+
? comboBasedMissCount
|
|
136
|
+
: Math.floor(comboBasedMissCount));
|
|
126
137
|
}
|
|
127
138
|
}
|
|
128
139
|
exports.PerformanceCalculator = PerformanceCalculator;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rian8337/osu-difficulty-calculator",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.8",
|
|
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",
|
|
@@ -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.
|
|
33
|
+
"@rian8337/osu-base": "^1.4.8"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "dd3ffd562dcdd8da4f2b48548b936a6012fdff1a"
|
|
39
39
|
}
|
package/typings/index.d.ts
CHANGED
|
@@ -233,6 +233,7 @@ declare module "@rian8337/osu-difficulty-calculator" {
|
|
|
233
233
|
*/
|
|
234
234
|
flashlight: number;
|
|
235
235
|
private averageRhythmMultiplier: number;
|
|
236
|
+
private tapPenalty: number;
|
|
236
237
|
override calculate(params: {
|
|
237
238
|
/**
|
|
238
239
|
* The star rating instance to calculate.
|
|
@@ -259,6 +260,8 @@ declare module "@rian8337/osu-difficulty-calculator" {
|
|
|
259
260
|
*/
|
|
260
261
|
stats?: MapStats;
|
|
261
262
|
}): this;
|
|
263
|
+
protected override calculateValues(): void;
|
|
264
|
+
protected override calculateTotalValue(): number;
|
|
262
265
|
/**
|
|
263
266
|
* Calculates the average rhythm multiplier of the beatmap.
|
|
264
267
|
*/
|
|
@@ -587,6 +590,8 @@ declare module "@rian8337/osu-difficulty-calculator" {
|
|
|
587
590
|
*/
|
|
588
591
|
stats?: MapStats;
|
|
589
592
|
}): this;
|
|
593
|
+
protected override calculateValues(): void;
|
|
594
|
+
protected override calculateTotalValue(): number;
|
|
590
595
|
/**
|
|
591
596
|
* Calculates the aim performance value of the beatmap.
|
|
592
597
|
*/
|
|
@@ -867,10 +872,6 @@ declare module "@rian8337/osu-difficulty-calculator" {
|
|
|
867
872
|
* The amount of misses achieved in the score.
|
|
868
873
|
*/
|
|
869
874
|
miss?: number;
|
|
870
|
-
/**
|
|
871
|
-
* The gamemode to calculate.
|
|
872
|
-
*/
|
|
873
|
-
mode?: modes;
|
|
874
875
|
/**
|
|
875
876
|
* The tap penalty to apply for penalized scores. Only applies to droid gamemode.
|
|
876
877
|
*/
|
|
@@ -885,13 +886,53 @@ declare module "@rian8337/osu-difficulty-calculator" {
|
|
|
885
886
|
*/
|
|
886
887
|
abstract toString(): string;
|
|
887
888
|
/**
|
|
888
|
-
*
|
|
889
|
+
* Internal calculation method, used to process calculation from implementations.
|
|
890
|
+
*/
|
|
891
|
+
protected calculateInternal(
|
|
892
|
+
params: {
|
|
893
|
+
/**
|
|
894
|
+
* The star rating instance to calculate.
|
|
895
|
+
*/
|
|
896
|
+
stars: StarRating;
|
|
897
|
+
/**
|
|
898
|
+
* The maximum combo achieved in the score.
|
|
899
|
+
*/
|
|
900
|
+
combo?: number;
|
|
901
|
+
/**
|
|
902
|
+
* The accuracy achieved in the score.
|
|
903
|
+
*/
|
|
904
|
+
accPercent?: Accuracy | number;
|
|
905
|
+
/**
|
|
906
|
+
* The amount of misses achieved in the score.
|
|
907
|
+
*/
|
|
908
|
+
miss?: number;
|
|
909
|
+
/**
|
|
910
|
+
* The tap penalty to apply for penalized scores. Only applies to droid gamemode.
|
|
911
|
+
*/
|
|
912
|
+
tapPenalty?: number;
|
|
913
|
+
/**
|
|
914
|
+
* Custom map statistics to apply custom speed multiplier and force AR values as well as old statistics.
|
|
915
|
+
*/
|
|
916
|
+
stats?: MapStats;
|
|
917
|
+
},
|
|
918
|
+
mode: modes
|
|
919
|
+
): this;
|
|
920
|
+
/**
|
|
921
|
+
* Calculates values that will be used for calculating the total performance value of the beatmap.
|
|
922
|
+
*/
|
|
923
|
+
protected abstract calculateValues(): void;
|
|
924
|
+
/**
|
|
925
|
+
* Calculates the total performance value of the beatmap.
|
|
926
|
+
*/
|
|
927
|
+
protected abstract calculateTotalValue(): number;
|
|
928
|
+
/**
|
|
929
|
+
* Calculates the base performance value of a star rating.
|
|
889
930
|
*/
|
|
890
931
|
protected baseValue(stars: number): number;
|
|
891
932
|
/**
|
|
892
933
|
* Processes given parameters for usage in performance calculation.
|
|
893
934
|
*/
|
|
894
|
-
|
|
935
|
+
private handleParams(
|
|
895
936
|
params: {
|
|
896
937
|
/**
|
|
897
938
|
* The star rating instance to calculate.
|
|
@@ -909,10 +950,6 @@ declare module "@rian8337/osu-difficulty-calculator" {
|
|
|
909
950
|
* The amount of misses achieved in the score.
|
|
910
951
|
*/
|
|
911
952
|
miss?: number;
|
|
912
|
-
/**
|
|
913
|
-
* The gamemode to calculate.
|
|
914
|
-
*/
|
|
915
|
-
mode?: modes;
|
|
916
953
|
/**
|
|
917
954
|
* The tap penalty to apply for penalized scores.
|
|
918
955
|
*/
|
|
@@ -929,7 +966,8 @@ declare module "@rian8337/osu-difficulty-calculator" {
|
|
|
929
966
|
*/
|
|
930
967
|
private calculateEffectiveMissCount(
|
|
931
968
|
combo: number,
|
|
932
|
-
maxCombo: number
|
|
969
|
+
maxCombo: number,
|
|
970
|
+
mode: modes
|
|
933
971
|
): number;
|
|
934
972
|
}
|
|
935
973
|
|