From 9b54e834d9225d3b601f63ccf2de6e2d9beedc9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Sun, 22 Oct 2017 20:32:59 +0200 Subject: [PATCH 1/2] Implements virtual Failcondition in scoreprocessor and enforces nofail in UpdateFailed --- osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs | 2 +- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs index 752e3bee26..0e5df329d8 100644 --- a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs @@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Taiko.Scoring /// /// Taiko fails at the end of the map if the player has not half-filled their HP bar. /// - public override bool HasFailed => Hits == MaxHits && Health.Value <= 0.5; + protected override bool FailCondition => Hits == MaxHits && Health.Value <= 0.5; private double hpIncreaseTick; private double hpIncreaseGreat; diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 0b631a7148..934b19b511 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -69,7 +69,12 @@ namespace osu.Game.Rulesets.Scoring /// /// Whether the score is in a failed state. /// - public virtual bool HasFailed => Health.Value == Health.MinValue; + public virtual bool HasFailed => alreadyFailed; + + /// + /// The conditions for failing + /// + protected virtual bool FailCondition => Health.Value == Health.MinValue; /// /// Whether this ScoreProcessor has already triggered the failed state. @@ -121,7 +126,7 @@ namespace osu.Game.Rulesets.Scoring /// protected void UpdateFailed() { - if (alreadyFailed || !HasFailed) + if (alreadyFailed || !FailCondition) return; if (Failed?.Invoke() != false) From 493fe1d621da5c7c67a98a84e702b6216bba8701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Tue, 24 Oct 2017 08:34:10 +0200 Subject: [PATCH 2/2] Makes HasFailed private set and removes alreadyFailed --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 23 ++++++++------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 934b19b511..5a54c679dd 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -66,20 +66,15 @@ namespace osu.Game.Rulesets.Scoring /// protected virtual bool HasCompleted => false; - /// - /// Whether the score is in a failed state. - /// - public virtual bool HasFailed => alreadyFailed; - - /// - /// The conditions for failing - /// - protected virtual bool FailCondition => Health.Value == Health.MinValue; - /// /// Whether this ScoreProcessor has already triggered the failed state. /// - private bool alreadyFailed; + public virtual bool HasFailed { get; private set; } + + /// + /// The conditions for failing. + /// + protected virtual bool FailCondition => Health.Value == Health.MinValue; protected ScoreProcessor() { @@ -115,7 +110,7 @@ namespace osu.Game.Rulesets.Scoring Rank.Value = ScoreRank.X; HighestCombo.Value = 0; - alreadyFailed = false; + HasFailed = false; } /// @@ -126,11 +121,11 @@ namespace osu.Game.Rulesets.Scoring /// protected void UpdateFailed() { - if (alreadyFailed || !FailCondition) + if (HasFailed || !FailCondition) return; if (Failed?.Invoke() != false) - alreadyFailed = true; + HasFailed = true; } ///