1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 23:15:14 +08:00

Add storeResults as a parameter to Reset

Whether to store the current state of the ScoreProcessor for future use.
This commit is contained in:
smoogipooo 2017-09-12 22:27:27 +09:00
parent 2e0218f388
commit b5f48c2368
5 changed files with 31 additions and 25 deletions

View File

@ -113,11 +113,7 @@ namespace osu.Game.Rulesets.Mania.Scoring
{ {
var holdNote = obj as HoldNote; var holdNote = obj as HoldNote;
if (obj is Note) if (holdNote != null)
{
AddJudgement(new ManiaJudgement { Result = HitResult.Perfect });
}
else if (holdNote != null)
{ {
// Head // Head
AddJudgement(new ManiaJudgement { Result = HitResult.Perfect }); AddJudgement(new ManiaJudgement { Result = HitResult.Perfect });
@ -126,9 +122,9 @@ namespace osu.Game.Rulesets.Mania.Scoring
int tickCount = holdNote.Ticks.Count(); int tickCount = holdNote.Ticks.Count();
for (int i = 0; i < tickCount; i++) for (int i = 0; i < tickCount; i++)
AddJudgement(new HoldNoteTickJudgement { Result = HitResult.Perfect }); AddJudgement(new HoldNoteTickJudgement { Result = HitResult.Perfect });
AddJudgement(new HoldNoteTailJudgement { Result = HitResult.Perfect });
} }
AddJudgement(new ManiaJudgement { Result = HitResult.Perfect });
} }
if (!HasFailed) if (!HasFailed)
@ -137,7 +133,7 @@ namespace osu.Game.Rulesets.Mania.Scoring
hpMultiplier *= 1.01; hpMultiplier *= 1.01;
hpMissMultiplier *= 0.98; hpMissMultiplier *= 0.98;
Reset(); Reset(false);
} }
} }

View File

@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Osu.Scoring
AddJudgement(new OsuJudgement { Result = HitResult.Great }); AddJudgement(new OsuJudgement { Result = HitResult.Great });
// Ticks // Ticks
foreach (var tick in slider.Ticks) foreach (var unused in slider.Ticks)
AddJudgement(new OsuJudgement { Result = HitResult.Great }); AddJudgement(new OsuJudgement { Result = HitResult.Great });
} }
@ -54,9 +54,9 @@ namespace osu.Game.Rulesets.Osu.Scoring
} }
} }
protected override void Reset() protected override void Reset(bool storeResults)
{ {
base.Reset(); base.Reset(storeResults);
scoreResultCounts.Clear(); scoreResultCounts.Clear();
comboResultCounts.Clear(); comboResultCounts.Clear();

View File

@ -137,9 +137,9 @@ namespace osu.Game.Rulesets.Taiko.Scoring
} }
} }
protected override void Reset() protected override void Reset(bool storeResults)
{ {
base.Reset(); base.Reset(storeResults);
Health.Value = 0; Health.Value = 0;
} }

View File

@ -25,8 +25,15 @@ namespace osu.Game.Rulesets.Judgements
/// </summary> /// </summary>
public double TimeOffset { get; internal set; } public double TimeOffset { get; internal set; }
/// <summary>
/// Whether the <see cref="Result"/> should be considered as a factor in the accuracy percentage and portion.
/// </summary>
public virtual bool AffectsAccuracy => true; public virtual bool AffectsAccuracy => true;
/// <summary>
/// Whether the <see cref="Result"/> should affect the combo portion of the score.
/// If false, the <see cref="Result"/> will be considered for the bonus portion of the score.
/// </summary>
public virtual bool AffectsCombo => true; public virtual bool AffectsCombo => true;
/// <summary> /// <summary>

View File

@ -73,8 +73,6 @@ namespace osu.Game.Rulesets.Scoring
protected ScoreProcessor() protected ScoreProcessor()
{ {
Combo.ValueChanged += delegate { HighestCombo.Value = Math.Max(HighestCombo.Value, Combo.Value); }; Combo.ValueChanged += delegate { HighestCombo.Value = Math.Max(HighestCombo.Value, Combo.Value); };
Reset();
} }
private ScoreRank rankFrom(double acc) private ScoreRank rankFrom(double acc)
@ -95,7 +93,8 @@ namespace osu.Game.Rulesets.Scoring
/// <summary> /// <summary>
/// Resets this ScoreProcessor to a default state. /// Resets this ScoreProcessor to a default state.
/// </summary> /// </summary>
protected virtual void Reset() /// <param name="storeResults">Whether to store the current state of the <see cref="ScoreProcessor"/> for future use.</param>
protected virtual void Reset(bool storeResults)
{ {
TotalScore.Value = 0; TotalScore.Value = 0;
Accuracy.Value = 1; Accuracy.Value = 1;
@ -160,10 +159,11 @@ namespace osu.Game.Rulesets.Scoring
protected virtual double ComboPortion => 0.5f; protected virtual double ComboPortion => 0.5f;
protected virtual double AccuracyPortion => 0.5f; protected virtual double AccuracyPortion => 0.5f;
protected readonly int MaxHits; protected int MaxHits { get; private set; }
protected int Hits { get; private set; } protected int Hits { get; private set; }
private readonly double maxComboScore; private double maxHighestCombo;
private double maxComboScore;
private double comboScore; private double comboScore;
protected ScoreProcessor() protected ScoreProcessor()
@ -175,11 +175,7 @@ namespace osu.Game.Rulesets.Scoring
rulesetContainer.OnJudgement += AddJudgement; rulesetContainer.OnJudgement += AddJudgement;
SimulateAutoplay(rulesetContainer.Beatmap); SimulateAutoplay(rulesetContainer.Beatmap);
Reset(true);
maxComboScore = comboScore;
MaxHits = Hits;
Reset();
} }
/// <summary> /// <summary>
@ -252,9 +248,16 @@ namespace osu.Game.Rulesets.Scoring
} }
} }
protected override void Reset() protected override void Reset(bool storeResults)
{ {
base.Reset(); if (storeResults)
{
maxHighestCombo = HighestCombo;
maxComboScore = comboScore;
MaxHits = Hits;
}
base.Reset(storeResults);
Hits = 0; Hits = 0;
comboScore = 0; comboScore = 0;