1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-18 07:22:57 +08:00

Use clockrate in the difficult strain count method

This commit is contained in:
apollo-dw 2021-12-29 23:49:07 +00:00
parent 4f257d6987
commit fd1028f3bb
2 changed files with 9 additions and 8 deletions

View File

@ -40,12 +40,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty
double sliderFactor = aimRating > 0 ? aimRatingNoSliders / aimRating : 1;
int aimDifficultyStrainCount = ((OsuStrainSkill)skills[0]).RelevantDifficultStrains();
int speedDifficultyStrainCount = ((OsuStrainSkill)skills[2]).RelevantDifficultStrains();
// Total number of strains in a map can vary by clockrate, and this needs to be corrected for.
aimDifficultyStrainCount = (int)(aimDifficultyStrainCount * clockRate);
speedDifficultyStrainCount = (int)(speedDifficultyStrainCount * clockRate);
int aimDifficultyStrainCount = ((OsuStrainSkill)skills[0]).CountDifficultStrains(clockRate);
int speedDifficultyStrainCount = ((OsuStrainSkill)skills[2]).CountDifficultStrains(clockRate);
if (mods.Any(h => h is OsuModRelax))
speedRating = 0.0;

View File

@ -58,11 +58,16 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
return difficulty * DifficultyMultiplier;
}
public int RelevantDifficultStrains()
/// <summary>
/// Returns the number of difficult strains.
/// A strain is considered difficult if it's higher than 66% of the highest strain.
/// </summary>
public int CountDifficultStrains(double clockRate)
{
List<double> strains = GetCurrentStrainPeaks().OrderByDescending(d => d).ToList();
return strains.Count(s => s > strains[0] * 0.66);
// Total number of strains in a map can vary by clockrate, and this needs to be corrected for.
return (int)(strains.Count(s => s > strains[0] * 0.66) * clockRate);
}
}
}