Replace comparison references to HitResult.Miss with IsHit

This commit is contained in:
Bartłomiej Dach 2020-10-02 22:57:49 +02:00
parent 36dbb1b70a
commit 2b1ef16f89
15 changed files with 17 additions and 17 deletions

View File

@ -36,7 +36,7 @@ public void OnNewResult(DrawableCatchHitObject judgedObject, JudgementResult res
if (!result.Type.AffectsCombo() || !result.HasResult)
return;
if (result.Type == HitResult.Miss)
if (!result.IsHit)
{
updateCombo(0, null);
return;

View File

@ -243,7 +243,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)
endHold();
}
if (Tail.Result.Type == HitResult.Miss)
if (Tail.Judged && !Tail.IsHit)
HasBroken = true;
}

View File

@ -40,7 +40,7 @@ public void TestMissViaEarlyHit()
{
HitObjects = { new HitCircle { Position = new Vector2(256, 192) } }
},
PassCondition = () => Player.Results.Count > 0 && Player.Results[0].TimeOffset < -hitWindows.WindowFor(HitResult.Meh) && Player.Results[0].Type == HitResult.Miss
PassCondition = () => Player.Results.Count > 0 && Player.Results[0].TimeOffset < -hitWindows.WindowFor(HitResult.Meh) && !Player.Results[0].IsHit
});
}
@ -59,7 +59,7 @@ public void TestMissViaNotHitting()
{
Autoplay = false,
Beatmap = beatmap,
PassCondition = () => Player.Results.Count > 0 && Player.Results[0].TimeOffset >= hitWindows.WindowFor(HitResult.Meh) && Player.Results[0].Type == HitResult.Miss
PassCondition = () => Player.Results.Count > 0 && Player.Results[0].TimeOffset >= hitWindows.WindowFor(HitResult.Meh) && !Player.Results[0].IsHit
});
}

View File

@ -314,7 +314,7 @@ public void TestTrackingAreaOutsideEdge()
private bool assertMaxJudge() => judgementResults.Any() && judgementResults.All(t => t.Type == t.Judgement.MaxResult);
private bool assertHeadMissTailTracked() => judgementResults[^2].Type == HitResult.IgnoreHit && judgementResults.First().Type == HitResult.Miss;
private bool assertHeadMissTailTracked() => judgementResults[^2].Type == HitResult.IgnoreHit && !judgementResults.First().IsHit;
private bool assertMidSliderJudgements() => judgementResults[^2].Type == HitResult.IgnoreHit;

View File

@ -143,7 +143,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)
var circleResult = (OsuHitCircleJudgementResult)r;
// Todo: This should also consider misses, but they're a little more interesting to handle, since we don't necessarily know the position at the time of a miss.
if (result != HitResult.Miss)
if (result.IsHit())
{
var localMousePosition = ToLocalSpace(inputManager.CurrentState.Mouse.Position);
circleResult.CursorPositionAtHit = HitObject.StackedPosition + (localMousePosition - DrawSize / 2);

View File

@ -67,7 +67,7 @@ protected override void PrepareForUse()
if (JudgedObject != null)
{
lightingColour = JudgedObject.AccentColour.GetBoundCopy();
lightingColour.BindValueChanged(colour => Lighting.Colour = Result.Type == HitResult.Miss ? Color4.Transparent : colour.NewValue, true);
lightingColour.BindValueChanged(colour => Lighting.Colour = Result.IsHit ? colour.NewValue : Color4.Transparent, true);
}
else
{

View File

@ -250,7 +250,7 @@ public override void PlaySamples()
{
// rather than doing it this way, we should probably attach the sample to the tail circle.
// this can only be done after we stop using LegacyLastTick.
if (TailCircle.Result.Type != HitResult.Miss)
if (TailCircle.IsHit)
base.PlaySamples();
}

View File

@ -107,7 +107,7 @@ private void onNewResult(DrawableHitObject obj, JudgementResult result)
if (!(obj is DrawableDrumRollTick))
return;
if (result.Type > HitResult.Miss)
if (result.IsHit)
rollingHits++;
else
rollingHits--;

View File

@ -27,7 +27,7 @@ public class TaikoHealthProcessor : AccumulatingHealthProcessor
private double hpMultiplier;
/// <summary>
/// HP multiplier for a <see cref="HitResult.Miss"/>.
/// HP multiplier for a <see cref="HitResult"/> that does not satisfy <see cref="HitResultExtensions.IsHit"/>.
/// </summary>
private double hpMissMultiplier;
@ -45,6 +45,6 @@ public override void ApplyBeatmap(IBeatmap beatmap)
}
protected override double GetHealthIncreaseFor(JudgementResult result)
=> base.GetHealthIncreaseFor(result) * (result.Type == HitResult.Miss ? hpMissMultiplier : hpMultiplier);
=> base.GetHealthIncreaseFor(result) * (result.IsHit ? hpMultiplier : hpMissMultiplier);
}
}

View File

@ -45,7 +45,7 @@ protected override void LoadComplete()
if (r?.Type.AffectsCombo() == false)
return;
passing = r == null || r.Type > HitResult.Miss;
passing = r == null || r.IsHit;
foreach (var sprite in InternalChildren.OfType<ScrollerSprite>())
sprite.Passing = passing;

View File

@ -37,7 +37,7 @@ private void load(OsuColour colours)
Alpha = 0.15f;
Masking = true;
if (result == HitResult.Miss)
if (!result.IsHit())
return;
bool isRim = (judgedObject.HitObject as Hit)?.Type == HitType.Rim;

View File

@ -511,7 +511,7 @@ protected void ApplyResult(Action<JudgementResult> application)
case HitResult.None:
break;
case HitResult.Miss:
case { } result when !result.IsHit():
updateState(ArmedState.Miss);
break;

View File

@ -106,7 +106,7 @@ private void load(OsuColour colours)
public void Flash(JudgementResult result)
{
if (result.Type == HitResult.Miss)
if (!result.IsHit)
return;
Scheduler.AddOnce(flash);

View File

@ -48,7 +48,7 @@ public class HitEventTimingDistributionGraph : CompositeDrawable
/// <param name="hitEvents">The <see cref="HitEvent"/>s to display the timing distribution of.</param>
public HitEventTimingDistributionGraph(IReadOnlyList<HitEvent> hitEvents)
{
this.hitEvents = hitEvents.Where(e => !(e.HitObject.HitWindows is HitWindows.EmptyHitWindows) && e.Result != HitResult.Miss).ToList();
this.hitEvents = hitEvents.Where(e => !(e.HitObject.HitWindows is HitWindows.EmptyHitWindows) && e.Result.IsHit()).ToList();
}
[BackgroundDependencyLoader]

View File

@ -20,7 +20,7 @@ public class UnstableRate : SimpleStatisticItem<double>
public UnstableRate(IEnumerable<HitEvent> hitEvents)
: base("Unstable Rate")
{
var timeOffsets = hitEvents.Where(e => !(e.HitObject.HitWindows is HitWindows.EmptyHitWindows) && e.Result != HitResult.Miss)
var timeOffsets = hitEvents.Where(e => !(e.HitObject.HitWindows is HitWindows.EmptyHitWindows) && e.Result.IsHit())
.Select(ev => ev.TimeOffset).ToArray();
Value = 10 * standardDeviation(timeOffsets);
}