mirror of
https://github.com/ppy/osu
synced 2024-12-26 08:53:10 +00:00
Migrate Rulesets.Taiko to the new judgement system
This commit is contained in:
parent
e825edb6d7
commit
1b7b6f341c
@ -11,11 +11,6 @@ namespace osu.Game.Rulesets.Taiko.Judgements
|
||||
|
||||
public override bool AffectsCombo => false;
|
||||
|
||||
public TaikoIntermediateSwellJudgement()
|
||||
{
|
||||
Final = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Computes the numeric result value for the combo portion of the score.
|
||||
/// </summary>
|
||||
|
@ -6,10 +6,5 @@ namespace osu.Game.Rulesets.Taiko.Judgements
|
||||
public class TaikoStrongHitJudgement : TaikoJudgement
|
||||
{
|
||||
public override bool AffectsCombo => false;
|
||||
|
||||
public TaikoStrongHitJudgement()
|
||||
{
|
||||
Final = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Taiko.Judgements;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
|
||||
@ -85,12 +84,16 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
int countHit = NestedHitObjects.Count(o => o.IsHit);
|
||||
if (countHit >= HitObject.RequiredGoodHits)
|
||||
{
|
||||
AddJudgement(new TaikoJudgement { Result = countHit >= HitObject.RequiredGreatHits ? HitResult.Great : HitResult.Good });
|
||||
ApplyJudgement(HitObject.Judgement, j => j.Result = countHit >= HitObject.RequiredGreatHits ? HitResult.Great : HitResult.Good);
|
||||
if (HitObject.IsStrong)
|
||||
AddJudgement(new TaikoStrongHitJudgement());
|
||||
ApplyJudgement(HitObject.StrongJudgement, j => j.Result = HitResult.Great);
|
||||
}
|
||||
else
|
||||
AddJudgement(new TaikoJudgement { Result = HitResult.Miss });
|
||||
{
|
||||
ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Miss);
|
||||
if (HitObject.IsStrong)
|
||||
ApplyJudgement(HitObject.StrongJudgement, j => j.Result = HitResult.Miss);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void UpdateState(ArmedState state)
|
||||
|
@ -5,7 +5,6 @@ using System;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.Taiko.Judgements;
|
||||
using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
@ -28,14 +27,23 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
protected override void CheckForJudgements(bool userTriggered, double timeOffset)
|
||||
{
|
||||
if (!userTriggered)
|
||||
{
|
||||
if (timeOffset > HitObject.HitWindow)
|
||||
{
|
||||
ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Miss);
|
||||
if (HitObject.IsStrong)
|
||||
ApplyJudgement(HitObject.StrongJudgement, j => j.Result = HitResult.Miss);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (Math.Abs(timeOffset) > HitObject.HitWindow)
|
||||
return;
|
||||
|
||||
if (!(Math.Abs(timeOffset) < HitObject.HitWindow))
|
||||
return;
|
||||
|
||||
AddJudgement(new TaikoDrumRollTickJudgement { Result = HitResult.Great });
|
||||
ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Great);
|
||||
if (HitObject.IsStrong)
|
||||
AddJudgement(new TaikoStrongHitJudgement());
|
||||
ApplyJudgement(HitObject.StrongJudgement, j => j.Result = HitResult.Great);
|
||||
}
|
||||
|
||||
protected override void UpdateState(ArmedState state)
|
||||
|
@ -5,7 +5,6 @@ using System.Linq;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.Taiko.Judgements;
|
||||
using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
@ -17,11 +16,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
/// </summary>
|
||||
protected abstract TaikoAction[] HitActions { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether a second hit is allowed to be processed. This occurs once this hit object has been hit successfully.
|
||||
/// </summary>
|
||||
protected bool SecondHitAllowed { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the last key pressed is a valid hit key.
|
||||
/// </summary>
|
||||
@ -38,7 +32,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
if (!userTriggered)
|
||||
{
|
||||
if (!HitObject.HitWindows.CanBeHit(timeOffset))
|
||||
AddJudgement(new TaikoJudgement { Result = HitResult.Miss });
|
||||
ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Miss);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -47,17 +41,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
return;
|
||||
|
||||
if (!validKeyPressed || result == HitResult.Miss)
|
||||
AddJudgement(new TaikoJudgement { Result = HitResult.Miss });
|
||||
ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Miss);
|
||||
else
|
||||
{
|
||||
AddJudgement(new TaikoJudgement
|
||||
{
|
||||
Result = result,
|
||||
Final = !HitObject.IsStrong
|
||||
});
|
||||
|
||||
SecondHitAllowed = true;
|
||||
}
|
||||
ApplyJudgement(HitObject.Judgement, j => j.Result = result);
|
||||
}
|
||||
|
||||
public override bool OnPressed(TaikoAction action)
|
||||
@ -86,7 +72,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
switch (State.Value)
|
||||
{
|
||||
case ArmedState.Idle:
|
||||
SecondHitAllowed = false;
|
||||
validKeyPressed = false;
|
||||
|
||||
UnproxyContent();
|
||||
|
@ -5,7 +5,6 @@ using System;
|
||||
using System.Linq;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.Taiko.Judgements;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
{
|
||||
@ -28,23 +27,27 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
|
||||
protected override void CheckForJudgements(bool userTriggered, double timeOffset)
|
||||
{
|
||||
if (!SecondHitAllowed)
|
||||
if (!HitObject.Judgement.HasResult)
|
||||
{
|
||||
base.CheckForJudgements(userTriggered, timeOffset);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!HitObject.Judgement.IsHit)
|
||||
{
|
||||
ApplyJudgement(HitObject.StrongJudgement, j => j.Result = HitResult.Miss);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!userTriggered)
|
||||
{
|
||||
if (timeOffset > second_hit_window)
|
||||
AddJudgement(new TaikoStrongHitJudgement { Result = HitResult.None });
|
||||
ApplyJudgement(HitObject.StrongJudgement, j => j.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 { Result = HitResult.Great });
|
||||
ApplyJudgement(HitObject.StrongJudgement, j => j.Result = HitResult.Great);
|
||||
}
|
||||
|
||||
protected override void UpdateState(ArmedState state)
|
||||
@ -73,7 +76,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
return false;
|
||||
|
||||
// Check if we've handled the first key
|
||||
if (!SecondHitAllowed)
|
||||
if (!HitObject.Judgement.HasResult)
|
||||
{
|
||||
// First key hasn't been handled yet, attempt to handle it
|
||||
bool handled = base.OnPressed(action);
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
@ -12,7 +13,6 @@ using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Rulesets.Taiko.Judgements;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
@ -128,9 +128,14 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
{
|
||||
if (userTriggered)
|
||||
{
|
||||
AddJudgement(new TaikoIntermediateSwellJudgement());
|
||||
var nextIntermediate = HitObject.IntermediateJudgements.FirstOrDefault(j => !j.HasResult);
|
||||
|
||||
var completion = (float)Judgements.Count / HitObject.RequiredHits;
|
||||
if (nextIntermediate != null)
|
||||
ApplyJudgement(nextIntermediate, j => j.Result = HitResult.Great);
|
||||
|
||||
var numHits = HitObject.IntermediateJudgements.Count(j => j.HasResult);
|
||||
|
||||
var completion = (float)numHits / HitObject.RequiredHits;
|
||||
|
||||
expandingRing
|
||||
.FadeTo(expandingRing.Alpha + MathHelper.Clamp(completion / 16, 0.1f, 0.6f), 50)
|
||||
@ -141,18 +146,28 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
|
||||
expandingRing.ScaleTo(1f + Math.Min(target_ring_scale - 1f, (target_ring_scale - 1f) * completion * 1.3f), 260, Easing.OutQuint);
|
||||
|
||||
if (Judgements.Count == HitObject.RequiredHits)
|
||||
AddJudgement(new TaikoJudgement { Result = HitResult.Great });
|
||||
if (numHits == HitObject.RequiredHits)
|
||||
ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Great);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (timeOffset < 0)
|
||||
return;
|
||||
|
||||
//TODO: THIS IS SHIT AND CAN'T EXIST POST-TAIKO WORLD CUP
|
||||
AddJudgement(Judgements.Count > HitObject.RequiredHits / 2
|
||||
? new TaikoJudgement { Result = HitResult.Good }
|
||||
: new TaikoJudgement { Result = HitResult.Miss });
|
||||
int numHits = 0;
|
||||
|
||||
foreach (var intermediate in HitObject.IntermediateJudgements)
|
||||
{
|
||||
if (intermediate.HasResult)
|
||||
{
|
||||
numHits++;
|
||||
continue;
|
||||
}
|
||||
|
||||
ApplyJudgement(intermediate, j => j.Result = HitResult.Miss);
|
||||
}
|
||||
|
||||
ApplyJudgement(HitObject.Judgement, j => j.Result = numHits > HitObject.RequiredHits / 2 ? HitResult.Good : HitResult.Miss);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,8 +3,11 @@
|
||||
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Taiko.Judgements;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Objects
|
||||
{
|
||||
@ -81,5 +84,16 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
|
||||
public TaikoJudgement Judgement { get; private set; }
|
||||
public TaikoStrongHitJudgement StrongJudgement { get; private set; }
|
||||
|
||||
protected override IEnumerable<Judgement> CreateJudgements()
|
||||
{
|
||||
yield return Judgement = new TaikoJudgement();
|
||||
|
||||
if (IsStrong)
|
||||
yield return StrongJudgement = new TaikoStrongHitJudgement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,10 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Taiko.Judgements;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Objects
|
||||
{
|
||||
public class DrumRollTick : TaikoHitObject
|
||||
@ -20,5 +24,16 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
||||
/// The time allowed to hit this tick.
|
||||
/// </summary>
|
||||
public double HitWindow => TickSpacing / 2;
|
||||
|
||||
public TaikoDrumRollTickJudgement Judgement { get; private set; }
|
||||
public TaikoStrongHitJudgement StrongJudgement { get; private set; }
|
||||
|
||||
protected override IEnumerable<Judgement> CreateJudgements()
|
||||
{
|
||||
yield return Judgement = new TaikoDrumRollTickJudgement();
|
||||
|
||||
if (IsStrong)
|
||||
yield return StrongJudgement = new TaikoStrongHitJudgement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,23 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Taiko.Judgements;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Objects
|
||||
{
|
||||
public class Hit : TaikoHitObject
|
||||
{
|
||||
public TaikoJudgement Judgement { get; private set; }
|
||||
public TaikoStrongHitJudgement StrongJudgement { get; private set; }
|
||||
|
||||
protected override IEnumerable<Judgement> CreateJudgements()
|
||||
{
|
||||
yield return Judgement = new TaikoJudgement();
|
||||
|
||||
if (IsStrong)
|
||||
yield return StrongJudgement = new TaikoStrongHitJudgement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osu.Game.Rulesets.Taiko.Judgements;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Objects
|
||||
{
|
||||
@ -15,5 +18,23 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
||||
/// The number of hits required to complete the swell successfully.
|
||||
/// </summary>
|
||||
public int RequiredHits = 10;
|
||||
|
||||
public TaikoJudgement Judgement { get; private set; }
|
||||
|
||||
private readonly List<TaikoIntermediateSwellJudgement> intermediateJudgements = new List<TaikoIntermediateSwellJudgement>();
|
||||
public IReadOnlyList<TaikoIntermediateSwellJudgement> IntermediateJudgements => intermediateJudgements;
|
||||
|
||||
protected override IEnumerable<Judgement> CreateJudgements()
|
||||
{
|
||||
yield return Judgement = new TaikoJudgement();
|
||||
|
||||
for (int i = 0; i < RequiredHits; i++)
|
||||
{
|
||||
var intermediate = new TaikoIntermediateSwellJudgement();
|
||||
intermediateJudgements.Add(intermediate);
|
||||
|
||||
yield return intermediate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user