Use ComputeAccuracy to get imminent accuracy

This commit is contained in:
Dean Herbert
2023-01-18 18:08:58 +09:00
parent 0b1e5c0f53
commit 522bb8bcca
2 changed files with 24 additions and 9 deletions

View File

@ -51,11 +51,22 @@ namespace osu.Game.Rulesets.Mods
protected override bool FailCondition(HealthProcessor healthProcessor, JudgementResult result)
{
// accuracy calculation logic taken from `ScoreProcessor`. should be updated here if the formula ever changes.
if (!result.Type.IsScorable() || result.Type.IsBonus())
return false;
return scoreProcessor.Accuracy.Value < MinimumAccuracy.Value;
return getAccuracyWithImminentResultAdded(result) < MinimumAccuracy.Value;
}
private double getAccuracyWithImminentResultAdded(JudgementResult result)
{
var score = new ScoreInfo { Ruleset = scoreProcessor.Ruleset.RulesetInfo };
// This is super ugly, but if we don't do it this way we will not have the most recent result added to the accuracy value.
// Hopefully we can improve this in the future.
scoreProcessor.PopulateScore(score);
score.Statistics[result.Type]++;
return scoreProcessor.ComputeAccuracy(score);
}
}