From 1b27ce6198eaa525deb2560ee75f76d7e3d9570d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 21 Nov 2017 17:09:22 +0900 Subject: [PATCH] Cleanup + renaming --- .../Scoring/TaikoScoreProcessor.cs | 2 +- osu.Game/Rulesets/Mods/ModPerfect.cs | 10 +--------- osu.Game/Rulesets/Mods/ModSuddenDeath.cs | 9 +++------ osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 12 ++++++------ 4 files changed, 11 insertions(+), 22 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs index 0e5df329d8..0048566b15 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. /// - protected override bool FailCondition => Hits == MaxHits && Health.Value <= 0.5; + protected override bool DefaultFailCondition => Hits == MaxHits && Health.Value <= 0.5; private double hpIncreaseTick; private double hpIncreaseGreat; diff --git a/osu.Game/Rulesets/Mods/ModPerfect.cs b/osu.Game/Rulesets/Mods/ModPerfect.cs index cf7bf141c3..e7887c8fc4 100644 --- a/osu.Game/Rulesets/Mods/ModPerfect.cs +++ b/osu.Game/Rulesets/Mods/ModPerfect.cs @@ -11,14 +11,6 @@ namespace osu.Game.Rulesets.Mods public override string ShortenedName => "PF"; public override string Description => "SS or quit."; - public bool OnFailCheck(ScoreProcessor scoreProcessor) - { - return scoreProcessor.Accuracy.Value != 1; - } - - public virtual void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) - { - scoreProcessor.FailChecker += OnFailCheck; - } + protected override bool FailCondition(ScoreProcessor scoreProcessor) => scoreProcessor.Accuracy.Value != 1; } } diff --git a/osu.Game/Rulesets/Mods/ModSuddenDeath.cs b/osu.Game/Rulesets/Mods/ModSuddenDeath.cs index 6675c41bd4..17350fdaa4 100644 --- a/osu.Game/Rulesets/Mods/ModSuddenDeath.cs +++ b/osu.Game/Rulesets/Mods/ModSuddenDeath.cs @@ -18,14 +18,11 @@ namespace osu.Game.Rulesets.Mods public override bool Ranked => true; public override Type[] IncompatibleMods => new[] { typeof(ModNoFail), typeof(ModRelax), typeof(ModAutoplay) }; - public bool OnFailCheck(ScoreProcessor scoreProcessor) + public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) { - return scoreProcessor.Combo.Value != scoreProcessor.HighestCombo.Value; + scoreProcessor.FailConditions += FailCondition; } - public virtual void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) - { - scoreProcessor.FailChecker += OnFailCheck; - } + protected virtual bool FailCondition(ScoreProcessor scoreProcessor) => scoreProcessor.Combo.Value != scoreProcessor.HighestCombo.Value; } } diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index c3ae887a9f..de8a510590 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -32,9 +32,9 @@ namespace osu.Game.Rulesets.Scoring public event Action NewJudgement; /// - /// Invoked when we want to check if a failure condition has been fulfilled + /// Additional conditions on top of that cause a failing state. /// - public event Func FailChecker; + public event Func FailConditions; /// /// The current total score. @@ -77,9 +77,9 @@ namespace osu.Game.Rulesets.Scoring public virtual bool HasFailed { get; private set; } /// - /// The conditions for failing. + /// The default conditions for failing. /// - protected virtual bool FailCondition => Health.Value == Health.MinValue; + protected virtual bool DefaultFailCondition => Health.Value == Health.MinValue; protected ScoreProcessor() { @@ -126,7 +126,7 @@ namespace osu.Game.Rulesets.Scoring /// protected void UpdateFailed() { - if (HasFailed || !FailCondition) + if (HasFailed || !DefaultFailCondition) return; if (Failed?.Invoke() != false) @@ -150,7 +150,7 @@ namespace osu.Game.Rulesets.Scoring if (HasFailed) return; - if (FailChecker?.Invoke(this) == true) + if (FailConditions?.Invoke(this) == true) { if (Failed?.Invoke() != false) HasFailed = true;