1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-16 03:03:01 +08:00

Merge pull request #17327 from frenzibyte/simplify-extension-methods

Simplify `IncreasesCombo`/`BreaksCombo` helper method implementation
This commit is contained in:
Dean Herbert 2022-03-19 20:23:09 +09:00 committed by GitHub
commit 9aa902785c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -125,30 +125,28 @@ namespace osu.Game.Rulesets.Scoring
/// Whether a <see cref="HitResult"/> increases the combo.
/// </summary>
public static bool IncreasesCombo(this HitResult result)
=> AffectsCombo(result) && IsHit(result);
/// <summary>
/// Whether a <see cref="HitResult"/> breaks the combo and resets it back to zero.
/// </summary>
public static bool BreaksCombo(this HitResult result)
=> AffectsCombo(result) && !IsHit(result);
/// <summary>
/// Whether a <see cref="HitResult"/> increases/breaks the combo, and affects the combo portion of the score.
/// </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:
return true;
default:
return false;
}
}
/// <summary>
/// Whether a <see cref="HitResult"/> breaks the combo and resets it back to zero.
/// </summary>
public static bool BreaksCombo(this HitResult result)
{
switch (result)
{
case HitResult.Miss:
case HitResult.LargeTickMiss:
return true;
@ -157,12 +155,6 @@ namespace osu.Game.Rulesets.Scoring
}
}
/// <summary>
/// Whether a <see cref="HitResult"/> increases/breaks the combo, and affects the combo portion of the score.
/// </summary>
public static bool AffectsCombo(this HitResult result)
=> IncreasesCombo(result) || BreaksCombo(result);
/// <summary>
/// Whether a <see cref="HitResult"/> affects the accuracy portion of the score.
/// </summary>