1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-17 17:33:03 +08:00

Apply code quality changes

This commit is contained in:
js1086 2024-05-23 19:08:32 +01:00
parent 9ff277cfb3
commit 20c54ab697
3 changed files with 13 additions and 16 deletions

View File

@ -34,8 +34,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
{
currentStrain *= strainDecay(current.DeltaTime);
currentStrain += AimEvaluator.EvaluateDifficultyOf(current, withSliders) * skillMultiplier;
objectStrains.Add(currentStrain);
ObjectStrains.Add(currentStrain);
return currentStrain;
}

View File

@ -34,8 +34,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
/// </summary>
protected virtual double DifficultyMultiplier => DEFAULT_DIFFICULTY_MULTIPLIER;
protected List<double> objectStrains = new List<double>();
protected double difficulty;
protected List<double> ObjectStrains = new List<double>();
protected double Difficulty;
protected OsuStrainSkill(Mod[] mods)
: base(mods)
@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
public override double DifficultyValue()
{
difficulty = 0;
Difficulty = 0;
double weight = 1;
// Sections with 0 strain are excluded to avoid worst-case time complexity of the following sort (e.g. /b/2351871).
@ -64,11 +64,11 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
// We're sorting from highest to lowest strain.
foreach (double strain in strains.OrderDescending())
{
difficulty += strain * weight;
Difficulty += strain * weight;
weight *= DecayWeight;
}
return difficulty * DifficultyMultiplier;
return Difficulty * DifficultyMultiplier;
}
/// <summary>
@ -77,9 +77,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
/// </summary>
public double CountDifficultStrains()
{
double consistentTopStrain = difficulty / 10; // What would the top strain be if all strain values were identical
double consistentTopStrain = Difficulty / 10; // What would the top strain be if all strain values were identical
// Use a weighted sum of all strains. Constants are arbitrary and give nice values
return objectStrains.Sum(s => 1.1 / (1 + Math.Exp(-10 * (s / consistentTopStrain - 0.88))));
return ObjectStrains.Sum(s => 1.1 / (1 + Math.Exp(-10 * (s / consistentTopStrain - 0.88))));
}
}
}
}

View File

@ -41,23 +41,21 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
currentRhythm = RhythmEvaluator.EvaluateDifficultyOf(current);
double totalStrain = currentStrain * currentRhythm;
objectStrains.Add(totalStrain);
ObjectStrains.Add(totalStrain);
return totalStrain;
}
public double RelevantNoteCount()
{
if (objectStrains.Count == 0)
if (ObjectStrains.Count == 0)
return 0;
double maxStrain = objectStrains.Max();
double maxStrain = ObjectStrains.Max();
if (maxStrain == 0)
return 0;
return objectStrains.Sum(strain => 1.0 / (1.0 + Math.Exp(-(strain / maxStrain * 12.0 - 6.0))));
return ObjectStrains.Sum(strain => 1.0 / (1.0 + Math.Exp(-(strain / maxStrain * 12.0 - 6.0))));
}
}
}