Use HitWindows for taiko

This commit is contained in:
smoogipoo 2018-02-02 18:53:30 +09:00
parent 15fe1a7966
commit 9bc4bf33a6
2 changed files with 7 additions and 36 deletions

View File

@ -38,30 +38,27 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{ {
if (!userTriggered) if (!userTriggered)
{ {
if (timeOffset > HitObject.HitWindowGood) if (!HitObject.HitWindows.CanBeHit(timeOffset))
AddJudgement(new TaikoJudgement { Result = HitResult.Miss }); AddJudgement(new TaikoJudgement { Result = HitResult.Miss });
return; return;
} }
double hitOffset = Math.Abs(timeOffset); var result = HitObject.HitWindows.ResultFor(Math.Abs(timeOffset));
if (result == null)
if (hitOffset > HitObject.HitWindowMiss)
return; return;
if (!validKeyPressed) if (!validKeyPressed || result == HitResult.Miss)
AddJudgement(new TaikoJudgement { Result = HitResult.Miss }); AddJudgement(new TaikoJudgement { Result = HitResult.Miss });
else if (hitOffset < HitObject.HitWindowGood) else
{ {
AddJudgement(new TaikoJudgement AddJudgement(new TaikoJudgement
{ {
Result = hitOffset < HitObject.HitWindowGreat ? HitResult.Great : HitResult.Good, Result = result.Value,
Final = !HitObject.IsStrong Final = !HitObject.IsStrong
}); });
SecondHitAllowed = true; SecondHitAllowed = true;
} }
else
AddJudgement(new TaikoJudgement { Result = HitResult.Miss });
} }
public override bool OnPressed(TaikoAction action) public override bool OnPressed(TaikoAction action)
@ -90,7 +87,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
switch (State.Value) switch (State.Value)
{ {
case ArmedState.Idle: case ArmedState.Idle:
this.Delay(HitObject.HitWindowMiss).Expire(); this.Delay(HitObject.HitWindows.Miss / 2).Expire();
break; break;
case ArmedState.Miss: case ArmedState.Miss:
this.FadeOut(100) this.FadeOut(100)

View File

@ -1,35 +1,9 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
namespace osu.Game.Rulesets.Taiko.Objects namespace osu.Game.Rulesets.Taiko.Objects
{ {
public class Hit : TaikoHitObject public class Hit : TaikoHitObject
{ {
/// <summary>
/// The hit window that results in a "GREAT" hit.
/// </summary>
public double HitWindowGreat = 35;
/// <summary>
/// The hit window that results in a "GOOD" hit.
/// </summary>
public double HitWindowGood = 80;
/// <summary>
/// The hit window that results in a "MISS".
/// </summary>
public double HitWindowMiss = 95;
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
{
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
HitWindowGreat = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 50, 35, 20);
HitWindowGood = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 120, 80, 50);
HitWindowMiss = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 135, 95, 70);
}
} }
} }