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

Merge pull request #15507 from Wieku/relax-nan-fix

Add sanity check in Relax's effectiveMissCount calculation
This commit is contained in:
Bartłomiej Dach 2021-11-07 16:59:50 +01:00 committed by GitHub
commit 616d7bf9ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,7 +54,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty
if (mods.Any(h => h is OsuModRelax))
{
effectiveMissCount += countOk + countMeh;
// As we're adding Oks and Mehs to an approximated number of combo breaks the result can be higher than total hits in specific scenarios (which breaks some calculations) so we need to clamp it.
effectiveMissCount = Math.Min(effectiveMissCount + countOk + countMeh, totalHits);
multiplier *= 0.6;
}
@ -255,7 +257,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
private int calculateEffectiveMissCount()
{
// guess the number of misses + slider breaks from combo
// Guess the number of misses + slider breaks from combo
double comboBasedMissCount = 0.0;
if (Attributes.SliderCount > 0)
@ -265,7 +267,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
comboBasedMissCount = fullComboThreshold / Math.Max(1.0, scoreMaxCombo);
}
// we're clamping misscount because since its derived from combo it can be higher than total hits and that breaks some calculations
// Clamp misscount since it's derived from combo and can be higher than total hits and that breaks some calculations
comboBasedMissCount = Math.Min(comboBasedMissCount, totalHits);
return Math.Max(countMiss, (int)Math.Floor(comboBasedMissCount));