mirror of
https://github.com/ppy/osu.git
synced 2025-01-31 15:52:55 +08:00
Update for recent changes and refactor for better readability
This commit is contained in:
parent
8c1e678b42
commit
77a6ef850e
@ -59,6 +59,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
|||||||
countSliderEndsDropped = osuAttributes.SliderCount - score.Statistics.GetValueOrDefault(HitResult.SliderTailHit);
|
countSliderEndsDropped = osuAttributes.SliderCount - score.Statistics.GetValueOrDefault(HitResult.SliderTailHit);
|
||||||
countSliderTickMiss = score.Statistics.GetValueOrDefault(HitResult.LargeTickMiss);
|
countSliderTickMiss = score.Statistics.GetValueOrDefault(HitResult.LargeTickMiss);
|
||||||
|
|
||||||
|
accuracy = calculateAccuracy(countGreat, countOk, countMeh, countMiss, totalHits);
|
||||||
|
|
||||||
if (osuAttributes.SliderCount > 0)
|
if (osuAttributes.SliderCount > 0)
|
||||||
{
|
{
|
||||||
if (usingClassicSliderAccuracy)
|
if (usingClassicSliderAccuracy)
|
||||||
@ -227,7 +229,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
|||||||
double relevantCountGreat = Math.Max(0, countGreat - relevantTotalDiff);
|
double relevantCountGreat = Math.Max(0, countGreat - relevantTotalDiff);
|
||||||
double relevantCountOk = Math.Max(0, countOk - Math.Max(0, relevantTotalDiff - countGreat));
|
double relevantCountOk = Math.Max(0, countOk - Math.Max(0, relevantTotalDiff - countGreat));
|
||||||
double relevantCountMeh = Math.Max(0, countMeh - Math.Max(0, relevantTotalDiff - countGreat - countOk));
|
double relevantCountMeh = Math.Max(0, countMeh - Math.Max(0, relevantTotalDiff - countGreat - countOk));
|
||||||
double relevantAccuracy = attributes.SpeedNoteCount == 0 ? 0 : (relevantCountGreat * 6.0 + relevantCountOk * 2.0 + relevantCountMeh) / (attributes.SpeedNoteCount * 6.0);
|
double relevantCountMiss = Math.Max(0, countMiss - Math.Max(0, relevantTotalDiff - countGreat - countOk - countMeh));
|
||||||
|
double relevantAccuracy = attributes.SpeedNoteCount == 0 ? 0 : calculateAccuracy(relevantCountGreat, relevantCountOk, relevantCountMeh, relevantCountMiss, attributes.SpeedNoteCount);
|
||||||
|
|
||||||
// Scale the speed value with accuracy and OD.
|
// Scale the speed value with accuracy and OD.
|
||||||
speedValue *= (0.95 + Math.Pow(attributes.OverallDifficulty, 2) / 750) * Math.Pow((accuracy + relevantAccuracy) / 2.0, (14.5 - attributes.OverallDifficulty) / 2);
|
speedValue *= (0.95 + Math.Pow(attributes.OverallDifficulty, 2) / 750) * Math.Pow((accuracy + relevantAccuracy) / 2.0, (14.5 - attributes.OverallDifficulty) / 2);
|
||||||
@ -250,17 +253,17 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
|||||||
amountHitObjectsWithAccuracy += attributes.SliderCount;
|
amountHitObjectsWithAccuracy += attributes.SliderCount;
|
||||||
|
|
||||||
if (amountHitObjectsWithAccuracy > 0)
|
if (amountHitObjectsWithAccuracy > 0)
|
||||||
betterAccuracyPercentage = ((countGreat - (totalHits - amountHitObjectsWithAccuracy)) * 6 + countOk * 2 + countMeh) / (double)(amountHitObjectsWithAccuracy * 6);
|
betterAccuracyPercentage = calculateAccuracy(countGreat - (totalHits - amountHitObjectsWithAccuracy), countOk, countMeh, countMiss, amountHitObjectsWithAccuracy);
|
||||||
else
|
else
|
||||||
betterAccuracyPercentage = 0;
|
betterAccuracyPercentage = 0;
|
||||||
|
|
||||||
// It is possible to reach a negative accuracy with this formula. Cap it at zero - zero points.
|
// It is possible to reach a negative accuracy with this formula. Cap it at zero - zero points.
|
||||||
if (accuracy < 0)
|
if (betterAccuracyPercentage < 0)
|
||||||
accuracy = 0;
|
betterAccuracyPercentage = 0;
|
||||||
|
|
||||||
// Lots of arbitrary values from testing.
|
// Lots of arbitrary values from testing.
|
||||||
// Considering to use derivation from perfect accuracy in a probabilistic manner - assume normal distribution.
|
// Considering to use derivation from perfect accuracy in a probabilistic manner - assume normal distribution.
|
||||||
double accuracyValue = Math.Pow(1.52163, attributes.OverallDifficulty) * Math.Pow(accuracy, 24) * 2.83;
|
double accuracyValue = Math.Pow(1.52163, attributes.OverallDifficulty) * Math.Pow(betterAccuracyPercentage, 24) * 2.83;
|
||||||
|
|
||||||
// Bonus for many hitcircles - it's harder to keep good accuracy up for longer.
|
// Bonus for many hitcircles - it's harder to keep good accuracy up for longer.
|
||||||
accuracyValue *= Math.Min(1.15, Math.Pow(amountHitObjectsWithAccuracy / 1000.0, 0.3));
|
accuracyValue *= Math.Min(1.15, Math.Pow(amountHitObjectsWithAccuracy / 1000.0, 0.3));
|
||||||
@ -306,6 +309,12 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
|||||||
// so we use the amount of relatively difficult sections to adjust miss penalty
|
// so we use the amount of relatively difficult sections to adjust miss penalty
|
||||||
// to make it more punishing on maps with lower amount of hard sections.
|
// to make it more punishing on maps with lower amount of hard sections.
|
||||||
private double calculateMissPenalty(double missCount, double difficultStrainCount) => 0.96 / ((missCount / (4 * Math.Pow(Math.Log(difficultStrainCount), 0.94))) + 1);
|
private double calculateMissPenalty(double missCount, double difficultStrainCount) => 0.96 / ((missCount / (4 * Math.Pow(Math.Log(difficultStrainCount), 0.94))) + 1);
|
||||||
|
|
||||||
|
private double calculateAccuracy(double countGreat, double countOk, double countMeh, double countMiss, double totalHits)
|
||||||
|
=> usingClassicSliderAccuracy
|
||||||
|
? (countGreat * 6 + countOk * 2 + countMeh + countMiss * 2) / (totalHits * 6)
|
||||||
|
: (countGreat * 6 + countOk * 2 + countMeh) / ((totalHits - countMiss) * 6);
|
||||||
|
|
||||||
private double getComboScalingFactor(OsuDifficultyAttributes attributes) => attributes.MaxCombo <= 0 ? 1.0 : Math.Min(Math.Pow(scoreMaxCombo, 0.8) / Math.Pow(attributes.MaxCombo, 0.8), 1.0);
|
private double getComboScalingFactor(OsuDifficultyAttributes attributes) => attributes.MaxCombo <= 0 ? 1.0 : Math.Min(Math.Pow(scoreMaxCombo, 0.8) / Math.Pow(attributes.MaxCombo, 0.8), 1.0);
|
||||||
private int totalHits => countGreat + countOk + countMeh + countMiss;
|
private int totalHits => countGreat + countOk + countMeh + countMiss;
|
||||||
private int totalImperfectHits => countOk + countMeh + countMiss;
|
private int totalImperfectHits => countOk + countMeh + countMiss;
|
||||||
|
Loading…
Reference in New Issue
Block a user