From b5f48c2368091420df894168b68af1311fbef8e0 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 12 Sep 2017 22:27:27 +0900 Subject: [PATCH] Add storeResults as a parameter to Reset Whether to store the current state of the ScoreProcessor for future use. --- .../Scoring/ManiaScoreProcessor.cs | 12 +++------ .../Scoring/OsuScoreProcessor.cs | 6 ++--- .../Scoring/TaikoScoreProcessor.cs | 4 +-- osu.Game/Rulesets/Judgements/Judgement.cs | 7 +++++ osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 27 ++++++++++--------- 5 files changed, 31 insertions(+), 25 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs index 41e2de5f39..ff9dcdc682 100644 --- a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs +++ b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs @@ -113,11 +113,7 @@ namespace osu.Game.Rulesets.Mania.Scoring { var holdNote = obj as HoldNote; - if (obj is Note) - { - AddJudgement(new ManiaJudgement { Result = HitResult.Perfect }); - } - else if (holdNote != null) + if (holdNote != null) { // Head AddJudgement(new ManiaJudgement { Result = HitResult.Perfect }); @@ -126,9 +122,9 @@ namespace osu.Game.Rulesets.Mania.Scoring int tickCount = holdNote.Ticks.Count(); for (int i = 0; i < tickCount; i++) AddJudgement(new HoldNoteTickJudgement { Result = HitResult.Perfect }); - - AddJudgement(new HoldNoteTailJudgement { Result = HitResult.Perfect }); } + + AddJudgement(new ManiaJudgement { Result = HitResult.Perfect }); } if (!HasFailed) @@ -137,7 +133,7 @@ namespace osu.Game.Rulesets.Mania.Scoring hpMultiplier *= 1.01; hpMissMultiplier *= 0.98; - Reset(); + Reset(false); } } diff --git a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs index 32cd53f3a2..da474dac65 100644 --- a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs +++ b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs @@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Osu.Scoring AddJudgement(new OsuJudgement { Result = HitResult.Great }); // Ticks - foreach (var tick in slider.Ticks) + foreach (var unused in slider.Ticks) 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(); comboResultCounts.Clear(); diff --git a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs index 7b0bdeea13..f31cd2d634 100644 --- a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs @@ -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; } diff --git a/osu.Game/Rulesets/Judgements/Judgement.cs b/osu.Game/Rulesets/Judgements/Judgement.cs index 40cc643f60..71743b9988 100644 --- a/osu.Game/Rulesets/Judgements/Judgement.cs +++ b/osu.Game/Rulesets/Judgements/Judgement.cs @@ -25,8 +25,15 @@ namespace osu.Game.Rulesets.Judgements /// public double TimeOffset { get; internal set; } + /// + /// Whether the should be considered as a factor in the accuracy percentage and portion. + /// public virtual bool AffectsAccuracy => true; + /// + /// Whether the should affect the combo portion of the score. + /// If false, the will be considered for the bonus portion of the score. + /// public virtual bool AffectsCombo => true; /// diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index be468f84b4..9f46d7da8f 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -73,8 +73,6 @@ namespace osu.Game.Rulesets.Scoring protected ScoreProcessor() { Combo.ValueChanged += delegate { HighestCombo.Value = Math.Max(HighestCombo.Value, Combo.Value); }; - - Reset(); } private ScoreRank rankFrom(double acc) @@ -95,7 +93,8 @@ namespace osu.Game.Rulesets.Scoring /// /// Resets this ScoreProcessor to a default state. /// - protected virtual void Reset() + /// Whether to store the current state of the for future use. + protected virtual void Reset(bool storeResults) { TotalScore.Value = 0; Accuracy.Value = 1; @@ -160,10 +159,11 @@ namespace osu.Game.Rulesets.Scoring protected virtual double ComboPortion => 0.5f; protected virtual double AccuracyPortion => 0.5f; - protected readonly int MaxHits; + protected int MaxHits { get; private set; } protected int Hits { get; private set; } - private readonly double maxComboScore; + private double maxHighestCombo; + private double maxComboScore; private double comboScore; protected ScoreProcessor() @@ -175,11 +175,7 @@ namespace osu.Game.Rulesets.Scoring rulesetContainer.OnJudgement += AddJudgement; SimulateAutoplay(rulesetContainer.Beatmap); - - maxComboScore = comboScore; - MaxHits = Hits; - - Reset(); + Reset(true); } /// @@ -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; comboScore = 0;