2018-01-05 19:21:19 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2017-03-15 20:32:47 +08:00
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2017-04-18 15:05:58 +08:00
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
2017-12-31 04:23:18 +08:00
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
2017-03-15 15:07:40 +08:00
|
|
|
|
|
2017-04-18 15:05:58 +08:00
|
|
|
|
namespace osu.Game.Rulesets.Judgements
|
2017-03-15 15:07:40 +08:00
|
|
|
|
{
|
2017-09-05 18:44:59 +08:00
|
|
|
|
public class Judgement
|
2017-03-15 15:07:40 +08:00
|
|
|
|
{
|
2017-03-23 11:21:09 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether this judgement is the result of a hit or a miss.
|
|
|
|
|
/// </summary>
|
2017-03-29 16:57:36 +08:00
|
|
|
|
public HitResult Result;
|
2017-03-23 11:21:09 +08:00
|
|
|
|
|
2017-09-05 18:44:59 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The maximum <see cref="HitResult"/> that can be achieved.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual HitResult MaxResult => HitResult.Perfect;
|
|
|
|
|
|
2017-11-02 20:21:07 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The combo prior to this judgement occurring.
|
|
|
|
|
/// </summary>
|
2017-11-21 10:49:42 +08:00
|
|
|
|
public int ComboAtJudgement;
|
2017-11-02 20:21:07 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The highest combo achieved prior to this judgement occurring.
|
|
|
|
|
/// </summary>
|
2017-11-21 10:49:42 +08:00
|
|
|
|
public int HighestComboAtJudgement;
|
2017-11-02 20:21:07 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether a successful hit occurred.
|
|
|
|
|
/// </summary>
|
2017-09-05 18:44:59 +08:00
|
|
|
|
public bool IsHit => Result > HitResult.Miss;
|
|
|
|
|
|
2017-11-02 20:54:28 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether this judgement is the final judgement for the hit object.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool Final = true;
|
|
|
|
|
|
2017-03-23 11:21:09 +08:00
|
|
|
|
/// <summary>
|
2017-09-12 17:00:41 +08:00
|
|
|
|
/// The offset from a perfect hit at which this judgement occurred.
|
2017-09-12 16:36:46 +08:00
|
|
|
|
/// Populated when added via <see cref="DrawableHitObject{TObject}.AddJudgement"/>.
|
2017-03-23 11:21:09 +08:00
|
|
|
|
/// </summary>
|
2017-11-21 11:11:29 +08:00
|
|
|
|
public double TimeOffset { get; set; }
|
2017-03-23 11:21:09 +08:00
|
|
|
|
|
2017-09-12 21:27:27 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether the <see cref="Result"/> should affect the combo portion of the score.
|
|
|
|
|
/// If false, the <see cref="Result"/> will be considered for the bonus portion of the score.
|
|
|
|
|
/// </summary>
|
2017-04-06 13:37:13 +08:00
|
|
|
|
public virtual bool AffectsCombo => true;
|
2017-03-23 11:21:09 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2017-09-05 18:44:59 +08:00
|
|
|
|
/// The numeric representation for the result achieved.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int NumericResult => NumericResultFor(Result);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The numeric representation for the maximum achievable result.
|
2017-03-23 11:21:09 +08:00
|
|
|
|
/// </summary>
|
2017-09-05 18:44:59 +08:00
|
|
|
|
public int MaxNumericResult => NumericResultFor(MaxResult);
|
2017-03-23 11:21:09 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2017-09-05 18:44:59 +08:00
|
|
|
|
/// Convert a <see cref="HitResult"/> to a numeric score representation.
|
2017-03-23 11:21:09 +08:00
|
|
|
|
/// </summary>
|
2017-09-05 18:44:59 +08:00
|
|
|
|
/// <param name="result">The value to convert.</param>
|
|
|
|
|
/// <returns>The number.</returns>
|
|
|
|
|
protected virtual int NumericResultFor(HitResult result) => result > HitResult.Miss ? 1 : 0;
|
2017-03-15 15:07:40 +08:00
|
|
|
|
}
|
2017-09-06 16:02:13 +08:00
|
|
|
|
}
|