1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Refactor as proposed

This commit is contained in:
smoogipoo 2019-08-09 12:29:58 +09:00
parent 566d874641
commit 88fa06efba
2 changed files with 14 additions and 20 deletions

View File

@ -42,6 +42,11 @@ namespace osu.Game.Rulesets.Judgements
/// </summary>
public double HealthAtJudgement { get; internal set; }
/// <summary>
/// Whether the user was in a failed state prior to this <see cref="JudgementResult"/> occurring.
/// </summary>
public bool FailedAtJudgement { get; internal set; }
/// <summary>
/// Whether a miss or hit occurred.
/// </summary>

View File

@ -309,7 +309,6 @@ 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,17 +316,13 @@ namespace osu.Game.Rulesets.Scoring
/// <param name="result">The <see cref="JudgementResult"/> to apply.</param>
protected virtual void ApplyResult(JudgementResult result)
{
if (HasFailed)
{
if (hasFailedAtJudgement == null)
hasFailedAtJudgement = result.Judgement;
return;
}
result.ComboAtJudgement = Combo.Value;
result.HighestComboAtJudgement = HighestCombo.Value;
result.HealthAtJudgement = Health.Value;
result.FailedAtJudgement = HasFailed;
if (HasFailed)
return;
JudgedHits++;
@ -371,21 +366,15 @@ 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;
// Todo: Revert HasFailed state with proper player support
if (result.FailedAtJudgement)
return;
JudgedHits--;
if (result.Type != HitResult.None)