diff --git a/osu.Game.Rulesets.Catch/Scoring/CatchHealthProcessor.cs b/osu.Game.Rulesets.Catch/Scoring/CatchHealthProcessor.cs index 2e1aec0803..2f55f9a85f 100644 --- a/osu.Game.Rulesets.Catch/Scoring/CatchHealthProcessor.cs +++ b/osu.Game.Rulesets.Catch/Scoring/CatchHealthProcessor.cs @@ -22,7 +22,7 @@ public CatchHealthProcessor(double drainStartTime) protected override IEnumerable EnumerateNestedHitObjects(HitObject hitObject) => Enumerable.Empty(); - protected override bool CanFailOn(JudgementResult result) + protected override bool CheckDefaultFailCondition(JudgementResult result) { // matches stable. // see: https://github.com/peppy/osu-stable-reference/blob/46cd3a10af7cc6cc96f4eba92ef1812dc8c3a27e/osu!/GameModes/Play/Rulesets/Ruleset.cs#L967 @@ -32,7 +32,7 @@ protected override bool CanFailOn(JudgementResult result) if (result.Type == HitResult.SmallTickMiss) return false; - return base.CanFailOn(result); + return base.CheckDefaultFailCondition(result); } protected override double GetHealthIncreaseFor(HitObject hitObject, HitResult result) diff --git a/osu.Game/Rulesets/Scoring/AccumulatingHealthProcessor.cs b/osu.Game/Rulesets/Scoring/AccumulatingHealthProcessor.cs index 422bf8ea79..bb4c2463a7 100644 --- a/osu.Game/Rulesets/Scoring/AccumulatingHealthProcessor.cs +++ b/osu.Game/Rulesets/Scoring/AccumulatingHealthProcessor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Game.Rulesets.Judgements; + namespace osu.Game.Rulesets.Scoring { /// @@ -9,7 +11,7 @@ namespace osu.Game.Rulesets.Scoring /// public partial class AccumulatingHealthProcessor : HealthProcessor { - protected override bool DefaultFailCondition => JudgedHits == MaxHits && Health.Value < requiredHealth; + protected override bool CheckDefaultFailCondition(JudgementResult _) => JudgedHits == MaxHits && Health.Value < requiredHealth; private readonly double requiredHealth; diff --git a/osu.Game/Rulesets/Scoring/DrainingHealthProcessor.cs b/osu.Game/Rulesets/Scoring/DrainingHealthProcessor.cs index 92a064385b..e72a8aaf67 100644 --- a/osu.Game/Rulesets/Scoring/DrainingHealthProcessor.cs +++ b/osu.Game/Rulesets/Scoring/DrainingHealthProcessor.cs @@ -142,9 +142,12 @@ protected override void ApplyResultInternal(JudgementResult result) } } - protected override bool CanFailOn(JudgementResult result) + protected override bool CheckDefaultFailCondition(JudgementResult result) { - return !result.Judgement.MaxResult.IsBonus() && result.Type != HitResult.IgnoreHit; + if (result.Judgement.MaxResult.IsBonus() || result.Type == HitResult.IgnoreHit) + return false; + + return base.CheckDefaultFailCondition(result); } protected override void Reset(bool storeResults) diff --git a/osu.Game/Rulesets/Scoring/HealthProcessor.cs b/osu.Game/Rulesets/Scoring/HealthProcessor.cs index ccf53f075a..9e4c06b783 100644 --- a/osu.Game/Rulesets/Scoring/HealthProcessor.cs +++ b/osu.Game/Rulesets/Scoring/HealthProcessor.cs @@ -17,7 +17,7 @@ public abstract partial class HealthProcessor : JudgementProcessor public event Func? Failed; /// - /// Additional conditions on top of that cause a failing state. + /// Additional conditions on top of that cause a failing state. /// public event Func? FailConditions; @@ -50,7 +50,7 @@ protected override void ApplyResultInternal(JudgementResult result) Health.Value += GetHealthIncreaseFor(result); - if (CanFailOn(result) && meetsAnyFailCondition(result)) + if (meetsAnyFailCondition(result)) TriggerFailure(); } @@ -69,16 +69,10 @@ protected override void RevertResultInternal(JudgementResult result) protected virtual double GetHealthIncreaseFor(JudgementResult result) => result.HealthIncrease; /// - /// Whether a failure can occur on a given . - /// If the return value of this method is , neither nor will be checked - /// after this . + /// Checks whether the default conditions for failing are met. /// - protected virtual bool CanFailOn(JudgementResult result) => true; - - /// - /// The default conditions for failing. - /// - protected virtual bool DefaultFailCondition => Precision.AlmostBigger(Health.MinValue, Health.Value); + /// if failure should be invoked. + protected virtual bool CheckDefaultFailCondition(JudgementResult result) => Precision.AlmostBigger(Health.MinValue, Health.Value); /// /// Whether the current state of or the provided meets any fail condition. @@ -86,7 +80,7 @@ protected override void RevertResultInternal(JudgementResult result) /// The judgement result. private bool meetsAnyFailCondition(JudgementResult result) { - if (DefaultFailCondition) + if (CheckDefaultFailCondition(result)) return true; if (FailConditions != null)