From cb2444e01cd34e16d4e196581bc99698a4208c17 Mon Sep 17 00:00:00 2001 From: Ivan Pavluk Date: Thu, 6 Dec 2018 19:04:54 +0700 Subject: [PATCH] Remove Meh from TaikoHitWindows --- .../Objects/ManiaHitWindows.cs | 5 +-- .../Objects/Drawables/DrawableHit.cs | 6 +-- .../Objects/TaikoHitWindows.cs | 19 +++++++-- osu.Game/Rulesets/Objects/HitWindows.cs | 42 ++++++++++--------- 4 files changed, 43 insertions(+), 29 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Objects/ManiaHitWindows.cs b/osu.Game.Rulesets.Mania/Objects/ManiaHitWindows.cs index 063b626af1..ad0c04b4cc 100644 --- a/osu.Game.Rulesets.Mania/Objects/ManiaHitWindows.cs +++ b/osu.Game.Rulesets.Mania/Objects/ManiaHitWindows.cs @@ -20,11 +20,10 @@ namespace osu.Game.Rulesets.Mania.Objects { HitResult.Miss, (376, 346, 316) }, }; + public override bool IsHitResultAllowed(HitResult result) => true; + public override void SetDifficulty(double difficulty) { - AllowsPerfect = true; - AllowsOk = true; - Perfect = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Perfect]); Great = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Great]); Good = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Good]); diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index 8c19e64de6..d4f0360b40 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables } var result = HitObject.HitWindows.ResultFor(timeOffset); - if (result <= HitResult.Miss) + if (result == HitResult.None) return; if (!validActionPressed) @@ -173,12 +173,12 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables if (!userTriggered) { - if (timeOffset > second_hit_window) + if (timeOffset - MainObject.Result.TimeOffset > second_hit_window) ApplyResult(r => r.Type = HitResult.Miss); return; } - if (Math.Abs(MainObject.Result.TimeOffset - timeOffset) < second_hit_window) + if (Math.Abs(timeOffset - MainObject.Result.TimeOffset) <= second_hit_window) ApplyResult(r => r.Type = MainObject.Result.Type); } diff --git a/osu.Game.Rulesets.Taiko/Objects/TaikoHitWindows.cs b/osu.Game.Rulesets.Taiko/Objects/TaikoHitWindows.cs index 289f084a45..722a327f45 100644 --- a/osu.Game.Rulesets.Taiko/Objects/TaikoHitWindows.cs +++ b/osu.Game.Rulesets.Taiko/Objects/TaikoHitWindows.cs @@ -14,15 +14,28 @@ namespace osu.Game.Rulesets.Taiko.Objects { { HitResult.Great, (100, 70, 40) }, { HitResult.Good, (240, 160, 100) }, - { HitResult.Meh, (270, 190, 140) }, - { HitResult.Miss, (400, 400, 400) }, + { HitResult.Miss, (270, 190, 140) }, }; + protected override double SuccessfulHitWindow => Good; + + public override bool IsHitResultAllowed(HitResult result) + { + switch (result) + { + case HitResult.Great: + case HitResult.Good: + case HitResult.Miss: + return true; + default: + return false; + } + } + public override void SetDifficulty(double difficulty) { Great = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Great]); Good = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Good]); - Meh = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Meh]); Miss = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Miss]); } } diff --git a/osu.Game/Rulesets/Objects/HitWindows.cs b/osu.Game/Rulesets/Objects/HitWindows.cs index 3717209860..621fb418eb 100644 --- a/osu.Game/Rulesets/Objects/HitWindows.cs +++ b/osu.Game/Rulesets/Objects/HitWindows.cs @@ -22,7 +22,6 @@ namespace osu.Game.Rulesets.Objects /// /// Hit window for a result. - /// The user can only achieve receive this result if is true. /// public double Perfect { get; protected set; } @@ -38,7 +37,6 @@ namespace osu.Game.Rulesets.Objects /// /// Hit window for an result. - /// The user can only achieve this result if is true. /// public double Ok { get; protected set; } @@ -53,14 +51,25 @@ namespace osu.Game.Rulesets.Objects public double Miss { get; protected set; } /// - /// Whether it's possible to achieve a result. + /// Hit window for a non- result. /// - public bool AllowsPerfect; + protected virtual double SuccessfulHitWindow => Meh; /// - /// Whether it's possible to achieve a result. + /// Whether it's possible to achieve this . /// - public bool AllowsOk; + /// The result. + public virtual bool IsHitResultAllowed(HitResult result) + { + switch(result) + { + case HitResult.Perfect: + case HitResult.Ok: + return false; + default: + return true; + } + } /// /// Sets hit windows with values that correspond to a difficulty parameter. @@ -85,18 +94,11 @@ namespace osu.Game.Rulesets.Objects { timeOffset = Math.Abs(timeOffset); - if (AllowsPerfect && timeOffset <= HalfWindowFor(HitResult.Perfect)) - return HitResult.Perfect; - if (timeOffset <= HalfWindowFor(HitResult.Great)) - return HitResult.Great; - if (timeOffset <= HalfWindowFor(HitResult.Good)) - return HitResult.Good; - if (AllowsOk && timeOffset <= HalfWindowFor(HitResult.Ok)) - return HitResult.Ok; - if (timeOffset <= HalfWindowFor(HitResult.Meh)) - return HitResult.Meh; - if (timeOffset <= HalfWindowFor(HitResult.Miss)) - return HitResult.Miss; + for(var result = HitResult.Perfect; result >= HitResult.Miss; --result) + { + if(IsHitResultAllowed(result) && timeOffset <= HalfWindowFor(result)) + return result; + } return HitResult.None; } @@ -130,10 +132,10 @@ namespace osu.Game.Rulesets.Objects /// /// Given a time offset, whether the can ever be hit in the future with a non- result. - /// This happens if is less than what is required for a result. + /// This happens if is less than what is required for a result. /// /// The time offset. /// Whether the can be hit at any point in the future from this time offset. - public bool CanBeHit(double timeOffset) => timeOffset <= HalfWindowFor(HitResult.Meh); + public bool CanBeHit(double timeOffset) => timeOffset <= SuccessfulHitWindow / 2; } }