1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 03:27:24 +08:00

Add bonus hit results and orderings

This commit is contained in:
smoogipoo 2020-09-25 20:11:27 +09:00
parent 8c45786841
commit 1c4baa4e2a

View File

@ -2,17 +2,23 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.ComponentModel; using System.ComponentModel;
using osu.Game.Utils;
namespace osu.Game.Rulesets.Scoring namespace osu.Game.Rulesets.Scoring
{ {
[HasOrderedElements]
public enum HitResult public enum HitResult
{ {
/// <summary> /// <summary>
/// Indicates that the object has not been judged yet. /// Indicates that the object has not been judged yet.
/// </summary> /// </summary>
[Description(@"")] [Description(@"")]
[Order(13)]
None, None,
[Order(12)]
Ignore,
/// <summary> /// <summary>
/// Indicates that the object has been judged as a miss. /// Indicates that the object has been judged as a miss.
/// </summary> /// </summary>
@ -21,47 +27,142 @@ namespace osu.Game.Rulesets.Scoring
/// "too far in the future). It should also define when a forced miss should be triggered (as a result of no user input in time). /// "too far in the future). It should also define when a forced miss should be triggered (as a result of no user input in time).
/// </remarks> /// </remarks>
[Description(@"Miss")] [Description(@"Miss")]
[Order(5)]
Miss, Miss,
[Description(@"Meh")] [Description(@"Meh")]
[Order(4)]
Meh, Meh,
/// <summary> /// <summary>
/// Optional judgement. /// Optional judgement.
/// </summary> /// </summary>
[Description(@"OK")] [Description(@"OK")]
[Order(3)]
Ok, Ok,
[Description(@"Good")] [Description(@"Good")]
[Order(2)]
Good, Good,
[Description(@"Great")] [Description(@"Great")]
[Order(1)]
Great, Great,
/// <summary> /// <summary>
/// Optional judgement. /// Optional judgement.
/// </summary> /// </summary>
[Description(@"Perfect")] [Description(@"Perfect")]
[Order(0)]
Perfect, Perfect,
/// <summary> /// <summary>
/// Indicates small tick miss. /// Indicates small tick miss.
/// </summary> /// </summary>
[Order(11)]
SmallTickMiss, SmallTickMiss,
/// <summary> /// <summary>
/// Indicates a small tick hit. /// Indicates a small tick hit.
/// </summary> /// </summary>
[Description(@"S Tick")]
[Order(7)]
SmallTickHit, SmallTickHit,
/// <summary> /// <summary>
/// Indicates a large tick miss. /// Indicates a large tick miss.
/// </summary> /// </summary>
[Order(10)]
LargeTickMiss, LargeTickMiss,
/// <summary> /// <summary>
/// Indicates a large tick hit. /// Indicates a large tick hit.
/// </summary> /// </summary>
LargeTickHit [Description(@"L Tick")]
[Order(6)]
LargeTickHit,
/// <summary>
/// Indicates a small bonus.
/// </summary>
[Description("S Bonus")]
[Order(9)]
SmallBonus,
/// <summary>
/// Indicate a large bonus.
/// </summary>
[Description("L Bonus")]
[Order(8)]
LargeBonus,
}
public static class HitResultExtensions
{
/// <summary>
/// Whether a <see cref="HitResult"/> affects the combo.
/// </summary>
public static bool AffectsCombo(this HitResult result)
{
switch (result)
{
case HitResult.Miss:
case HitResult.Meh:
case HitResult.Ok:
case HitResult.Good:
case HitResult.Great:
case HitResult.Perfect:
case HitResult.LargeTickHit:
case HitResult.LargeTickMiss:
return true;
default:
return false;
}
}
/// <summary>
/// Whether a <see cref="HitResult"/> should be counted as combo score.
/// </summary>
/// <remarks>
/// This is not the reciprocal of <see cref="AffectsCombo"/>, as <see cref="HitResult.SmallTickHit"/> and <see cref="HitResult.SmallTickMiss"/> do not affect combo
/// but are still considered as part of the accuracy (not bonus) portion of the score.
/// </remarks>
public static bool IsBonus(this HitResult result)
{
switch (result)
{
case HitResult.SmallBonus:
case HitResult.LargeBonus:
return true;
default:
return false;
}
}
/// <summary>
/// Whether a <see cref="HitResult"/> represents a successful hit.
/// </summary>
public static bool IsHit(this HitResult result)
{
switch (result)
{
case HitResult.None:
case HitResult.Ignore:
case HitResult.Miss:
case HitResult.SmallTickMiss:
case HitResult.LargeTickMiss:
return false;
default:
return true;
}
}
/// <summary>
/// Whether a <see cref="HitResult"/> is scorable.
/// </summary>
public static bool IsScorable(this HitResult result) => result > HitResult.Ignore;
} }
} }