mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 03:25:11 +08:00
Make Rulesets.Mania use the new judgement result structure
This commit is contained in:
parent
4548d2c87f
commit
807794d512
@ -1,27 +0,0 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Judgements
|
||||
{
|
||||
public class HoldNoteTailJudgement : ManiaJudgement
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether the hold note has been released too early and shouldn't give full score for the release.
|
||||
/// </summary>
|
||||
public bool HasBroken;
|
||||
|
||||
protected override int NumericResultFor(HitResult result)
|
||||
{
|
||||
switch (result)
|
||||
{
|
||||
default:
|
||||
return base.NumericResultFor(result);
|
||||
case HitResult.Great:
|
||||
case HitResult.Perfect:
|
||||
return base.NumericResultFor(HasBroken ? HitResult.Good : result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -7,7 +7,6 @@ using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Mania.Judgements;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.UI.Scrolling;
|
||||
@ -100,7 +99,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
protected override void CheckForJudgements(bool userTriggered, double timeOffset)
|
||||
{
|
||||
if (tail.AllJudged)
|
||||
ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Perfect);
|
||||
ApplyResult(Results.Single(), r => r.Type = HitResult.Perfect);
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
@ -166,7 +165,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
return false;
|
||||
|
||||
// If the key has been released too early, the user should not receive full score for the release
|
||||
if (HitObject.Judgement.Result == HitResult.Miss)
|
||||
if (Results.Single().Type == HitResult.Miss)
|
||||
holdNote.hasBroken = true;
|
||||
|
||||
// The head note also handles early hits before the body, but we want accurate early hits to count as the body being held
|
||||
@ -205,13 +204,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
if (!userTriggered)
|
||||
{
|
||||
if (!HitObject.HitWindows.CanBeHit(timeOffset))
|
||||
{
|
||||
ApplyJudgement(holdNote.HitObject.Tail.Judgement, j =>
|
||||
{
|
||||
j.Result = HitResult.Miss;
|
||||
((HoldNoteTailJudgement)j).HasBroken = holdNote.hasBroken;
|
||||
});
|
||||
}
|
||||
ApplyResult(Results.Single(), r => r.Type = HitResult.Miss);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -220,10 +213,12 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
if (result == HitResult.None)
|
||||
return;
|
||||
|
||||
ApplyJudgement(holdNote.HitObject.Tail.Judgement, j =>
|
||||
ApplyResult(Results.Single(), r =>
|
||||
{
|
||||
j.Result = result;
|
||||
((HoldNoteTailJudgement)j).HasBroken = holdNote.hasBroken;
|
||||
if (holdNote.hasBroken && (result == HitResult.Perfect || result == HitResult.Perfect))
|
||||
result = HitResult.Good;
|
||||
|
||||
r.Type = result;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
@ -79,9 +80,9 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
var startTime = HoldStartTime?.Invoke();
|
||||
|
||||
if (startTime == null || startTime > HitObject.StartTime)
|
||||
ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Miss);
|
||||
ApplyResult(Results.Single(), r => r.Type = HitResult.Miss);
|
||||
else
|
||||
ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Perfect);
|
||||
ApplyResult(Results.Single(), r => r.Type = HitResult.Perfect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
// 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.Linq;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics;
|
||||
@ -60,7 +61,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
if (!userTriggered)
|
||||
{
|
||||
if (!HitObject.HitWindows.CanBeHit(timeOffset))
|
||||
ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Miss);
|
||||
ApplyResult(Results.Single(), r => r.Type = HitResult.Miss);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -68,7 +69,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
if (result == HitResult.None)
|
||||
return;
|
||||
|
||||
ApplyJudgement(HitObject.Judgement, j => j.Result = result);
|
||||
ApplyResult(Results.Single(), r => r.Type = result);
|
||||
}
|
||||
|
||||
public virtual bool OnPressed(ManiaAction action)
|
||||
|
@ -98,8 +98,6 @@ namespace osu.Game.Rulesets.Mania.Objects
|
||||
}
|
||||
}
|
||||
|
||||
public HoldNoteJudgement Judgement { get; private set; }
|
||||
|
||||
protected override IEnumerable<Judgement> CreateJudgements() => new[] { Judgement = new HoldNoteJudgement() };
|
||||
protected override IEnumerable<Judgement> CreateJudgements() => new[] { new HoldNoteJudgement() };
|
||||
}
|
||||
}
|
||||
|
@ -12,8 +12,6 @@ namespace osu.Game.Rulesets.Mania.Objects
|
||||
/// </summary>
|
||||
public class HoldNoteTick : ManiaHitObject
|
||||
{
|
||||
public HoldNoteTickJudgement Judgement { get; private set; }
|
||||
|
||||
protected override IEnumerable<Judgement> CreateJudgements() => new[] { Judgement = new HoldNoteTickJudgement() };
|
||||
protected override IEnumerable<Judgement> CreateJudgements() => new[] { new HoldNoteTickJudgement() };
|
||||
}
|
||||
}
|
||||
|
@ -12,8 +12,6 @@ namespace osu.Game.Rulesets.Mania.Objects
|
||||
/// </summary>
|
||||
public class Note : ManiaHitObject
|
||||
{
|
||||
public virtual ManiaJudgement Judgement { get; } = new ManiaJudgement();
|
||||
|
||||
protected override IEnumerable<Judgement> CreateJudgements() => new[] { Judgement };
|
||||
protected override IEnumerable<Judgement> CreateJudgements() => new[] { new ManiaJudgement() };
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,14 @@
|
||||
// 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.Mania.Judgements;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Objects
|
||||
{
|
||||
public class TailNote : Note
|
||||
{
|
||||
public override ManiaJudgement Judgement { get; } = new HoldNoteTailJudgement();
|
||||
protected override IEnumerable<Judgement> CreateJudgements() => new[] { new ManiaJudgement() };
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.Linq;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Mania.Judgements;
|
||||
@ -97,31 +96,20 @@ namespace osu.Game.Rulesets.Mania.Scoring
|
||||
{
|
||||
}
|
||||
|
||||
protected override void SimulateAutoplay(Beatmap<ManiaHitObject> beatmap)
|
||||
protected override void ApplyBeatmap(Beatmap<ManiaHitObject> beatmap)
|
||||
{
|
||||
base.ApplyBeatmap(beatmap);
|
||||
|
||||
BeatmapDifficulty difficulty = beatmap.BeatmapInfo.BaseDifficulty;
|
||||
hpMultiplier = BeatmapDifficulty.DifficultyRange(difficulty.DrainRate, hp_multiplier_min, hp_multiplier_mid, hp_multiplier_max);
|
||||
hpMissMultiplier = BeatmapDifficulty.DifficultyRange(difficulty.DrainRate, hp_multiplier_miss_min, hp_multiplier_miss_mid, hp_multiplier_miss_max);
|
||||
}
|
||||
|
||||
protected override void SimulateAutoplay(Beatmap<ManiaHitObject> beatmap)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
foreach (var obj in beatmap.HitObjects)
|
||||
{
|
||||
var holdNote = obj as HoldNote;
|
||||
|
||||
if (holdNote != null)
|
||||
{
|
||||
// Head
|
||||
AddJudgement(new ManiaJudgement { Result = HitResult.Perfect });
|
||||
|
||||
// Ticks
|
||||
int tickCount = holdNote.NestedHitObjects.OfType<HoldNoteTick>().Count();
|
||||
for (int i = 0; i < tickCount; i++)
|
||||
AddJudgement(new HoldNoteTickJudgement { Result = HitResult.Perfect });
|
||||
}
|
||||
|
||||
AddJudgement(new ManiaJudgement { Result = HitResult.Perfect });
|
||||
}
|
||||
base.SimulateAutoplay(beatmap);
|
||||
|
||||
if (!HasFailed)
|
||||
break;
|
||||
@ -133,20 +121,20 @@ namespace osu.Game.Rulesets.Mania.Scoring
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnNewJudgement(Judgement judgement)
|
||||
protected override void OnNewJudgement(JudgementResult result)
|
||||
{
|
||||
base.OnNewJudgement(judgement);
|
||||
base.OnNewJudgement(result);
|
||||
|
||||
bool isTick = judgement is HoldNoteTickJudgement;
|
||||
bool isTick = result.Judgement is HoldNoteTickJudgement;
|
||||
|
||||
if (isTick)
|
||||
{
|
||||
if (judgement.IsHit)
|
||||
if (result.IsHit)
|
||||
Health.Value += hpMultiplier * hp_increase_tick;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (judgement.Result)
|
||||
switch (result.Type)
|
||||
{
|
||||
case HitResult.Miss:
|
||||
Health.Value += hpMissMultiplier * hp_increase_miss;
|
||||
|
@ -136,9 +136,9 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
HitObjects.Add(hitObject);
|
||||
}
|
||||
|
||||
internal void OnJudgement(DrawableHitObject judgedObject, Judgement judgement)
|
||||
internal void OnJudgement(DrawableHitObject judgedObject, JudgementResult result)
|
||||
{
|
||||
if (!judgement.IsHit || !judgedObject.DisplayJudgement || !DisplayJudgements)
|
||||
if (!result.IsHit || !judgedObject.DisplayJudgement || !DisplayJudgements)
|
||||
return;
|
||||
|
||||
explosionContainer.Add(new HitExplosion(judgedObject)
|
||||
|
@ -10,8 +10,8 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
{
|
||||
internal class DrawableManiaJudgement : DrawableJudgement
|
||||
{
|
||||
public DrawableManiaJudgement(Judgement judgement, DrawableHitObject judgedObject)
|
||||
: base(judgement, judgedObject)
|
||||
public DrawableManiaJudgement(JudgementResult result, DrawableHitObject judgedObject)
|
||||
: base(result, judgedObject)
|
||||
{
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
|
||||
this.FadeInFromZero(50, Easing.OutQuint);
|
||||
|
||||
if (Judgement.IsHit)
|
||||
if (Result.IsHit)
|
||||
{
|
||||
this.ScaleTo(0.8f);
|
||||
this.ScaleTo(1, 250, Easing.OutElastic);
|
||||
|
@ -161,13 +161,13 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
|
||||
public void Add(BarLine barline) => base.Add(new DrawableBarLine(barline));
|
||||
|
||||
internal void OnJudgement(DrawableHitObject judgedObject, Judgement judgement)
|
||||
internal void OnJudgement(DrawableHitObject judgedObject, JudgementResult result)
|
||||
{
|
||||
if (!judgedObject.DisplayJudgement || !DisplayJudgements)
|
||||
return;
|
||||
|
||||
judgements.Clear();
|
||||
judgements.Add(new DrawableManiaJudgement(judgement, judgedObject)
|
||||
judgements.Add(new DrawableManiaJudgement(result, judgedObject)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
Loading…
Reference in New Issue
Block a user