From 2c4f1817d3af1b20fe4e9002add599375c49bd95 Mon Sep 17 00:00:00 2001 From: Darius Wattimena Date: Sun, 14 Nov 2021 20:43:31 +0100 Subject: [PATCH 1/5] Fixed an issue where banana showers don't clear the plate when missing the last banana --- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index 604e878782..0cbabac911 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -10,7 +10,6 @@ using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Catch.Objects.Drawables; using osu.Game.Rulesets.Catch.Replays; using osu.Game.Rulesets.Judgements; -using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; using osuTK; @@ -73,8 +72,8 @@ namespace osu.Game.Rulesets.Catch.UI { Catcher.OnNewResult(hitObject, result); - if (!result.Type.IsScorable()) - return; + // Ignore JuiceStreams and BananaShowers + if (!(hitObject is DrawablePalpableCatchHitObject)) return; if (hitObject.HitObject.LastInCombo) { From 95891bc6550180c5a3959ebcb3122a8712e8da2d Mon Sep 17 00:00:00 2001 From: Darius Wattimena Date: Thu, 18 Nov 2021 20:03:41 +0100 Subject: [PATCH 2/5] Moved clear plate logic to Catcher class --- osu.Game.Rulesets.Catch/UI/Catcher.cs | 9 +++++++++ osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 13 ------------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Catch/UI/Catcher.cs b/osu.Game.Rulesets.Catch/UI/Catcher.cs index 2a13190cc5..0b041da076 100644 --- a/osu.Game.Rulesets.Catch/UI/Catcher.cs +++ b/osu.Game.Rulesets.Catch/UI/Catcher.cs @@ -210,8 +210,17 @@ namespace osu.Game.Rulesets.Catch.UI catchResult.CatcherAnimationState = CurrentState; catchResult.CatcherHyperDash = HyperDashing; + // Ignore JuiceStreams and BananaShowers if (!(drawableObject is DrawablePalpableCatchHitObject palpableObject)) return; + if (palpableObject.HitObject.LastInCombo) + { + if (result.Judgement is CatchJudgement catchJudgement && catchJudgement.ShouldExplodeFor(result)) + Explode(); + else + Drop(); + } + var hitObject = palpableObject.HitObject; if (result.IsHit) diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index 0cbabac911..37002d1051 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; -using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Catch.Objects.Drawables; using osu.Game.Rulesets.Catch.Replays; using osu.Game.Rulesets.Judgements; @@ -71,18 +70,6 @@ namespace osu.Game.Rulesets.Catch.UI public void OnNewResult(DrawableCatchHitObject hitObject, JudgementResult result) { Catcher.OnNewResult(hitObject, result); - - // Ignore JuiceStreams and BananaShowers - if (!(hitObject is DrawablePalpableCatchHitObject)) return; - - if (hitObject.HitObject.LastInCombo) - { - if (result.Judgement is CatchJudgement catchJudgement && catchJudgement.ShouldExplodeFor(result)) - Catcher.Explode(); - else - Catcher.Drop(); - } - comboDisplay.OnNewResult(hitObject, result); } From cfedbb92c1ad6bb4ee58cf54fd7654d827da5be2 Mon Sep 17 00:00:00 2001 From: Darius Wattimena Date: Thu, 18 Nov 2021 20:07:03 +0100 Subject: [PATCH 3/5] Added a unit test to cover clearing of the plate when missing the last banana --- osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs index 29a7b03ad3..bc94b50301 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs @@ -168,6 +168,17 @@ namespace osu.Game.Rulesets.Catch.Tests checkHyperDash(false); } + [Test] + public void TestLastBananaShouldClearPlate() + { + AddStep("catch fruit", () => attemptCatch(new Fruit())); + checkPlate(1); + AddStep("miss banana", () => attemptCatch(new Banana { X = 100 })); + checkPlate(1); + AddStep("miss last banana", () => attemptCatch(new Banana { LastInCombo = true, X = 100 })); + checkPlate(0); + } + [Test] public void TestCatcherRandomStacking() { From 9685892b946c36f3f2ba4eadd0ed49b0834c4444 Mon Sep 17 00:00:00 2001 From: Darius Wattimena Date: Thu, 18 Nov 2021 20:23:42 +0100 Subject: [PATCH 4/5] Added an extra unit test when actually catching the last banana to also clear the plate --- osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs index bc94b50301..4f527e9a0f 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs @@ -169,7 +169,7 @@ namespace osu.Game.Rulesets.Catch.Tests } [Test] - public void TestLastBananaShouldClearPlate() + public void TestLastBananaShouldClearPlateOnMiss() { AddStep("catch fruit", () => attemptCatch(new Fruit())); checkPlate(1); @@ -179,6 +179,17 @@ namespace osu.Game.Rulesets.Catch.Tests checkPlate(0); } + [Test] + public void TestLastBananaShouldClearPlateOnCatch() + { + AddStep("catch fruit", () => attemptCatch(new Fruit())); + checkPlate(1); + AddStep("catch banana", () => attemptCatch(new Banana())); + checkPlate(2); + AddStep("catch last banana", () => attemptCatch(new Banana { LastInCombo = true })); + checkPlate(0); + } + [Test] public void TestCatcherRandomStacking() { From 38edeac71031aff9aaf6f1559d8407a6a396c1d3 Mon Sep 17 00:00:00 2001 From: Darius Wattimena Date: Thu, 18 Nov 2021 20:24:40 +0100 Subject: [PATCH 5/5] Moved the logic to the bottom as placeCaughtObject is otherwise not called yet --- osu.Game.Rulesets.Catch/UI/Catcher.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Catch/UI/Catcher.cs b/osu.Game.Rulesets.Catch/UI/Catcher.cs index 0b041da076..04708c8796 100644 --- a/osu.Game.Rulesets.Catch/UI/Catcher.cs +++ b/osu.Game.Rulesets.Catch/UI/Catcher.cs @@ -213,14 +213,6 @@ namespace osu.Game.Rulesets.Catch.UI // Ignore JuiceStreams and BananaShowers if (!(drawableObject is DrawablePalpableCatchHitObject palpableObject)) return; - if (palpableObject.HitObject.LastInCombo) - { - if (result.Judgement is CatchJudgement catchJudgement && catchJudgement.ShouldExplodeFor(result)) - Explode(); - else - Drop(); - } - var hitObject = palpableObject.HitObject; if (result.IsHit) @@ -253,6 +245,14 @@ namespace osu.Game.Rulesets.Catch.UI CurrentState = hitObject.Kiai ? CatcherAnimationState.Kiai : CatcherAnimationState.Idle; else if (!(hitObject is Banana)) CurrentState = CatcherAnimationState.Fail; + + if (palpableObject.HitObject.LastInCombo) + { + if (result.Judgement is CatchJudgement catchJudgement && catchJudgement.ShouldExplodeFor(result)) + Explode(); + else + Drop(); + } } public void OnRevertResult(DrawableCatchHitObject drawableObject, JudgementResult result)