1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-08 22:02:56 +08:00

Fix NaN PP values when SR is 0

This commit is contained in:
Nathen 2024-11-14 01:42:07 -05:00
parent 5cc1cbe880
commit ce818f59e7

View File

@ -70,10 +70,11 @@ namespace osu.Game.Rulesets.Difficulty.Skills
/// </summary>
public virtual double CountTopWeightedStrains()
{
if (ObjectStrains.Count == 0)
double consistentTopStrain = DifficultyValue() / 10; // What would the top strain be if all strain values were identical
if (ObjectStrains.Count == 0 || consistentTopStrain == 0)
return 0.0;
double consistentTopStrain = DifficultyValue() / 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))));
}