Make taiko use the new "Final" field

Ensures that the first hit on HitStrongs is _always_ non-final unless it was a miss. The second hit is always final.
This commit is contained in:
smoogipoo 2017-11-02 21:55:50 +09:00
parent 326891f51c
commit e2b6003f98
3 changed files with 26 additions and 17 deletions

View File

@ -11,9 +11,7 @@ public class TaikoStrongHitJudgement : TaikoJudgement
public TaikoStrongHitJudgement()
{
base.Result = HitResult.Perfect;
Final = true;
}
public new HitResult Result => base.Result;
}
}

View File

@ -17,6 +17,11 @@ public abstract class DrawableHit : DrawableTaikoHitObject<Hit>
/// </summary>
protected abstract TaikoAction[] HitActions { get; }
/// <summary>
/// Whether a second hit is allowed to be processed.
/// </summary>
protected bool SecondHitAllowed { get; private set; }
/// <summary>
/// Whether the last key pressed is a valid hit key.
/// </summary>
@ -45,7 +50,15 @@ protected override void CheckForJudgements(bool userTriggered, double timeOffset
if (!validKeyPressed)
AddJudgement(new TaikoJudgement { Result = HitResult.Miss });
else if (hitOffset < HitObject.HitWindowGood)
AddJudgement(new TaikoJudgement { Result = hitOffset < HitObject.HitWindowGreat ? HitResult.Great : HitResult.Good });
{
AddJudgement(new TaikoJudgement
{
Result = hitOffset < HitObject.HitWindowGreat ? HitResult.Great : HitResult.Good,
Final = !HitObject.IsStrong
});
SecondHitAllowed = true;
}
else
AddJudgement(new TaikoJudgement { Result = HitResult.Miss });
}

View File

@ -3,6 +3,7 @@
using System;
using System.Linq;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Judgements;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
@ -24,27 +25,25 @@ protected DrawableHitStrong(Hit hit)
{
}
private bool processedSecondHit;
public override bool AllJudged => processedSecondHit && base.AllJudged;
protected override void CheckForJudgements(bool userTriggered, double timeOffset)
{
if (!base.AllJudged)
if (!SecondHitAllowed)
{
base.CheckForJudgements(userTriggered, timeOffset);
return;
}
if (!userTriggered)
{
if (timeOffset > second_hit_window)
AddJudgement(new TaikoStrongHitJudgement { Result = HitResult.Miss });
return;
}
// If we get here, we're assured that the key pressed is the correct secondary key
if (Math.Abs(firstHitTime - Time.Current) < second_hit_window)
{
AddJudgement(new TaikoStrongHitJudgement());
processedSecondHit = true;
}
AddJudgement(new TaikoStrongHitJudgement { Result = HitResult.Great });
}
public override bool OnReleased(TaikoAction action)
@ -56,8 +55,11 @@ public override bool OnReleased(TaikoAction action)
public override bool OnPressed(TaikoAction action)
{
if (AllJudged)
return false;
// Check if we've handled the first key
if (!base.AllJudged)
if (!SecondHitAllowed)
{
// First key hasn't been handled yet, attempt to handle it
bool handled = base.OnPressed(action);
@ -72,10 +74,6 @@ public override bool OnPressed(TaikoAction action)
return handled;
}
// If we've already hit the second key, don't handle this object any further
if (processedSecondHit)
return false;
// Don't handle represses of the first key
if (firstHitAction == action)
return false;