1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 20:22:55 +08:00

Ensure to not multiply by 0

This commit is contained in:
Dan Balasescu 2022-02-21 17:19:35 +09:00
parent c3b365cf6b
commit c466d6df94

View File

@ -239,6 +239,10 @@ namespace osu.Game.Rulesets.Scoring
case ScoringMode.Classic:
int totalHitObjects = statistics.Where(k => k.Key >= HitResult.Miss && k.Key <= HitResult.Perfect).Sum(k => k.Value);
// If there are no hitobjects then the beatmap can be composed of only ticks or spinners, so ensure we don't multiply by 0 at all times.
if (totalHitObjects == 0)
totalHitObjects = 1;
// This gives a similar feeling to osu!stable scoring (ScoreV1) while keeping classic scoring as only a constant multiple of standardised scoring.
// The invariant is important to ensure that scores don't get re-ordered on leaderboards between the two scoring modes.
double scaledStandardised = GetScore(ScoringMode.Standardised, accuracyRatio, comboRatio, statistics) / max_score;