1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 18:42:56 +08:00

Prevent failing when reverting to a hasFailedAtJudgement

This commit is contained in:
iiSaLMaN 2019-08-08 15:25:07 +03:00
parent c77e6074f6
commit 566d874641

View File

@ -95,7 +95,7 @@ namespace osu.Game.Rulesets.Scoring
/// <summary>
/// Whether this ScoreProcessor has already triggered the failed state.
/// </summary>
public virtual bool HasFailed { get; private set; }
public virtual bool HasFailed { get; protected set; }
/// <summary>
/// The default conditions for failing.
@ -309,6 +309,7 @@ namespace osu.Game.Rulesets.Scoring
}
private readonly Dictionary<HitResult, int> scoreResultCounts = new Dictionary<HitResult, int>();
private Judgement hasFailedAtJudgement;
/// <summary>
/// Applies the score change of a <see cref="JudgementResult"/> to this <see cref="ScoreProcessor"/>.
@ -317,7 +318,12 @@ namespace osu.Game.Rulesets.Scoring
protected virtual void ApplyResult(JudgementResult result)
{
if (HasFailed)
{
if (hasFailedAtJudgement == null)
hasFailedAtJudgement = result.Judgement;
return;
}
result.ComboAtJudgement = Combo.Value;
result.HighestComboAtJudgement = HighestCombo.Value;
@ -365,6 +371,17 @@ namespace osu.Game.Rulesets.Scoring
/// <param name="result">The judgement scoring result.</param>
protected virtual void RevertResult(JudgementResult result)
{
if (HasFailed)
{
if (hasFailedAtJudgement == result.Judgement)
{
hasFailedAtJudgement = null;
HasFailed = false;
}
return;
}
Combo.Value = result.ComboAtJudgement;
HighestCombo.Value = result.HighestComboAtJudgement;
Health.Value = result.HealthAtJudgement;