mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 09:57:21 +09:00
Use ComputeAccuracy
to get imminent accuracy
This commit is contained in:
parent
0b1e5c0f53
commit
522bb8bcca
@ -51,11 +51,22 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
|
|
||||||
protected override bool FailCondition(HealthProcessor healthProcessor, JudgementResult result)
|
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())
|
if (!result.Type.IsScorable() || result.Type.IsBonus())
|
||||||
return false;
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,11 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual double ClassicScoreMultiplier => 36;
|
protected virtual double ClassicScoreMultiplier => 36;
|
||||||
|
|
||||||
private readonly Ruleset ruleset;
|
/// <summary>
|
||||||
|
/// The ruleset this score processor is valid for.
|
||||||
|
/// </summary>
|
||||||
|
public readonly Ruleset Ruleset;
|
||||||
|
|
||||||
private readonly double accuracyPortion;
|
private readonly double accuracyPortion;
|
||||||
private readonly double comboPortion;
|
private readonly double comboPortion;
|
||||||
|
|
||||||
@ -145,7 +149,7 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
|
|
||||||
public ScoreProcessor(Ruleset ruleset)
|
public ScoreProcessor(Ruleset ruleset)
|
||||||
{
|
{
|
||||||
this.ruleset = ruleset;
|
this.Ruleset = ruleset;
|
||||||
|
|
||||||
accuracyPortion = DefaultAccuracyPortion;
|
accuracyPortion = DefaultAccuracyPortion;
|
||||||
comboPortion = DefaultComboPortion;
|
comboPortion = DefaultComboPortion;
|
||||||
@ -291,8 +295,8 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
[Pure]
|
[Pure]
|
||||||
public double ComputeAccuracy(ScoreInfo scoreInfo)
|
public double ComputeAccuracy(ScoreInfo scoreInfo)
|
||||||
{
|
{
|
||||||
if (!ruleset.RulesetInfo.Equals(scoreInfo.Ruleset))
|
if (!Ruleset.RulesetInfo.Equals(scoreInfo.Ruleset))
|
||||||
throw new ArgumentException($"Unexpected score ruleset. Expected \"{ruleset.RulesetInfo.ShortName}\" but was \"{scoreInfo.Ruleset.ShortName}\".");
|
throw new ArgumentException($"Unexpected score ruleset. Expected \"{Ruleset.RulesetInfo.ShortName}\" but was \"{scoreInfo.Ruleset.ShortName}\".");
|
||||||
|
|
||||||
// We only extract scoring values from the score's statistics. This is because accuracy is always relative to the point of pass or fail rather than relative to the whole beatmap.
|
// We only extract scoring values from the score's statistics. This is because accuracy is always relative to the point of pass or fail rather than relative to the whole beatmap.
|
||||||
extractScoringValues(scoreInfo.Statistics, out var current, out var maximum);
|
extractScoringValues(scoreInfo.Statistics, out var current, out var maximum);
|
||||||
@ -312,8 +316,8 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
[Pure]
|
[Pure]
|
||||||
public long ComputeScore(ScoringMode mode, ScoreInfo scoreInfo)
|
public long ComputeScore(ScoringMode mode, ScoreInfo scoreInfo)
|
||||||
{
|
{
|
||||||
if (!ruleset.RulesetInfo.Equals(scoreInfo.Ruleset))
|
if (!Ruleset.RulesetInfo.Equals(scoreInfo.Ruleset))
|
||||||
throw new ArgumentException($"Unexpected score ruleset. Expected \"{ruleset.RulesetInfo.ShortName}\" but was \"{scoreInfo.Ruleset.ShortName}\".");
|
throw new ArgumentException($"Unexpected score ruleset. Expected \"{Ruleset.RulesetInfo.ShortName}\" but was \"{scoreInfo.Ruleset.ShortName}\".");
|
||||||
|
|
||||||
extractScoringValues(scoreInfo, out var current, out var maximum);
|
extractScoringValues(scoreInfo, out var current, out var maximum);
|
||||||
|
|
||||||
@ -552,7 +556,7 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
maxResult = maxBasicResult ??= ruleset.GetHitResults().MaxBy(kvp => Judgement.ToNumericResult(kvp.result)).result;
|
maxResult = maxBasicResult ??= Ruleset.GetHitResults().MaxBy(kvp => Judgement.ToNumericResult(kvp.result)).result;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user