2019-01-24 08:43:03 +00:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2018-08-06 01:55:38 +00:00
|
|
|
|
using osu.Game.Rulesets.Objects;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Judgements
|
|
|
|
|
{
|
2018-08-06 01:55:38 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The scoring information provided by a <see cref="HitObject"/>.
|
|
|
|
|
/// </summary>
|
2018-04-13 09:19:50 +00:00
|
|
|
|
public class Judgement
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The maximum <see cref="HitResult"/> that can be achieved.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual HitResult MaxResult => HitResult.Perfect;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2018-08-02 11:35:54 +00:00
|
|
|
|
/// Whether this <see cref="Judgement"/> should affect the current combo.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual bool AffectsCombo => true;
|
|
|
|
|
|
2018-06-10 01:14:33 +00:00
|
|
|
|
/// <summary>
|
2018-08-02 11:35:54 +00:00
|
|
|
|
/// Whether this <see cref="Judgement"/> should be counted as base (combo) or bonus score.
|
2018-06-10 01:14:33 +00:00
|
|
|
|
/// </summary>
|
2018-06-29 08:07:08 +00:00
|
|
|
|
public virtual bool IsBonus => !AffectsCombo;
|
2018-06-10 01:14:33 +00:00
|
|
|
|
|
2018-04-13 09:19:50 +00:00
|
|
|
|
/// <summary>
|
2018-08-02 11:35:54 +00:00
|
|
|
|
/// The numeric score representation for the maximum achievable result.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
/// </summary>
|
2018-08-02 11:35:54 +00:00
|
|
|
|
public int MaxNumericResult => NumericResultFor(MaxResult);
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2019-04-22 07:51:38 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The health increase for the maximum achievable result.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public double MaxHealthIncrease => HealthIncreaseFor(MaxResult);
|
|
|
|
|
|
2018-04-13 09:19:50 +00:00
|
|
|
|
/// <summary>
|
2018-08-02 11:35:54 +00:00
|
|
|
|
/// Retrieves the numeric score representation of a <see cref="HitResult"/>.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
/// </summary>
|
2018-08-02 11:35:54 +00:00
|
|
|
|
/// <param name="result">The <see cref="HitResult"/> to find the numeric score representation for.</param>
|
|
|
|
|
/// <returns>The numeric score representation of <paramref name="result"/>.</returns>
|
|
|
|
|
protected virtual int NumericResultFor(HitResult result) => result > HitResult.Miss ? 1 : 0;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2018-08-02 11:35:54 +00:00
|
|
|
|
/// Retrieves the numeric score representation of a <see cref="JudgementResult"/>.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
/// </summary>
|
2018-08-02 11:35:54 +00:00
|
|
|
|
/// <param name="result">The <see cref="JudgementResult"/> to find the numeric score representation for.</param>
|
|
|
|
|
/// <returns>The numeric score representation of <paramref name="result"/>.</returns>
|
|
|
|
|
public int NumericResultFor(JudgementResult result) => NumericResultFor(result.Type);
|
2018-12-06 08:09:42 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Retrieves the numeric health increase of a <see cref="HitResult"/>.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="result">The <see cref="HitResult"/> to find the numeric health increase for.</param>
|
|
|
|
|
/// <returns>The numeric health increase of <paramref name="result"/>.</returns>
|
|
|
|
|
protected virtual double HealthIncreaseFor(HitResult result) => 0;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Retrieves the numeric health increase of a <see cref="JudgementResult"/>.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="result">The <see cref="JudgementResult"/> to find the numeric health increase for.</param>
|
|
|
|
|
/// <returns>The numeric health increase of <paramref name="result"/>.</returns>
|
|
|
|
|
public double HealthIncreaseFor(JudgementResult result) => HealthIncreaseFor(result.Type);
|
2019-02-21 12:22:16 +00:00
|
|
|
|
|
|
|
|
|
public override string ToString() => $"AffectsCombo:{AffectsCombo} MaxResult:{MaxResult} MaxScore:{MaxNumericResult}";
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|