2019-01-24 16:43:03 +08: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 17:19:50 +08:00
|
|
|
|
|
2018-08-06 09:55:38 +08:00
|
|
|
|
using osu.Game.Rulesets.Objects;
|
2017-12-31 04:23:18 +08:00
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-04-18 15:05:58 +08:00
|
|
|
|
namespace osu.Game.Rulesets.Judgements
|
2017-03-15 15:07:40 +08:00
|
|
|
|
{
|
2018-08-06 09:55:38 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The scoring information provided by a <see cref="HitObject"/>.
|
|
|
|
|
/// </summary>
|
2017-09-05 18:44:59 +08:00
|
|
|
|
public class Judgement
|
2017-03-15 15:07:40 +08:00
|
|
|
|
{
|
2020-09-29 13:26:12 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The default health increase for a maximum judgement, as a proportion of total health.
|
|
|
|
|
/// By default, each maximum judgement restores 5% of total health.
|
|
|
|
|
/// </summary>
|
|
|
|
|
protected const double DEFAULT_MAX_HEALTH_INCREASE = 0.05;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2020-09-29 13:26:12 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The maximum <see cref="HitResult"/> that can be achieved.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual HitResult MaxResult => HitResult.Perfect;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The minimum <see cref="HitResult"/> that can be achieved - the inverse of <see cref="MaxResult"/>.
|
|
|
|
|
/// </summary>
|
2023-10-09 08:47:00 +08:00
|
|
|
|
/// <remarks>
|
|
|
|
|
/// Defaults to a sane value for the given <see cref="MaxResult"/>. May be overridden to provide a supported custom value:
|
|
|
|
|
/// <list type="table">
|
|
|
|
|
/// <listheader>
|
2023-10-10 16:04:21 +08:00
|
|
|
|
/// <term><see cref="MaxResult"/>s</term>
|
2023-10-09 08:47:00 +08:00
|
|
|
|
/// <description>Valid <see cref="MinResult"/>s</description>
|
|
|
|
|
/// </listheader>
|
|
|
|
|
/// <item>
|
|
|
|
|
/// <term><see cref="HitResult.Perfect"/>, <see cref="HitResult.Great"/>, <see cref="HitResult.Good"/>, <see cref="HitResult.Ok"/>, <see cref="HitResult.Meh"/></term>
|
2023-10-10 09:03:37 +08:00
|
|
|
|
/// <description><see cref="HitResult.Miss"/></description>
|
2023-10-09 08:47:00 +08:00
|
|
|
|
/// </item>
|
|
|
|
|
/// <item>
|
|
|
|
|
/// <term><see cref="HitResult.LargeBonus"/></term>
|
|
|
|
|
/// <description><see cref="HitResult.IgnoreMiss"/></description>
|
|
|
|
|
/// </item>
|
|
|
|
|
/// <item>
|
|
|
|
|
/// <term><see cref="HitResult.SmallBonus"/></term>
|
|
|
|
|
/// <description><see cref="HitResult.IgnoreMiss"/></description>
|
|
|
|
|
/// </item>
|
|
|
|
|
/// <item>
|
|
|
|
|
/// <term><see cref="HitResult.SmallTickHit"/></term>
|
2023-10-10 09:03:37 +08:00
|
|
|
|
/// <description><see cref="HitResult.SmallTickMiss"/></description>
|
2023-10-09 08:47:00 +08:00
|
|
|
|
/// </item>
|
|
|
|
|
/// <item>
|
|
|
|
|
/// <term><see cref="HitResult.LargeTickHit"/></term>
|
2023-10-10 09:03:37 +08:00
|
|
|
|
/// <description><see cref="HitResult.LargeTickMiss"/></description>
|
2023-10-09 08:47:00 +08:00
|
|
|
|
/// </item>
|
|
|
|
|
/// <item>
|
|
|
|
|
/// <term><see cref="HitResult.IgnoreHit"/></term>
|
|
|
|
|
/// <description><see cref="HitResult.IgnoreMiss"/>, <see cref="HitResult.ComboBreak"/></description>
|
|
|
|
|
/// </item>
|
|
|
|
|
/// </list>
|
|
|
|
|
/// </remarks>
|
|
|
|
|
public virtual HitResult MinResult
|
2020-09-29 13:26:12 +08:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
switch (MaxResult)
|
|
|
|
|
{
|
|
|
|
|
case HitResult.SmallBonus:
|
|
|
|
|
case HitResult.LargeBonus:
|
|
|
|
|
case HitResult.IgnoreHit:
|
|
|
|
|
return HitResult.IgnoreMiss;
|
|
|
|
|
|
|
|
|
|
case HitResult.SmallTickHit:
|
|
|
|
|
return HitResult.SmallTickMiss;
|
|
|
|
|
|
|
|
|
|
case HitResult.LargeTickHit:
|
2023-12-30 09:21:59 +08:00
|
|
|
|
case HitResult.SliderTailHit:
|
2020-09-29 13:26:12 +08:00
|
|
|
|
return HitResult.LargeTickMiss;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return HitResult.Miss;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-22 15:51:38 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The health increase for the maximum achievable result.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public double MaxHealthIncrease => HealthIncreaseFor(MaxResult);
|
|
|
|
|
|
2018-12-06 16:09:42 +08: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>
|
2019-12-25 18:58:23 +08:00
|
|
|
|
protected virtual double HealthIncreaseFor(HitResult result)
|
|
|
|
|
{
|
|
|
|
|
switch (result)
|
|
|
|
|
{
|
2020-09-29 13:26:12 +08:00
|
|
|
|
default:
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
case HitResult.SmallTickHit:
|
2020-10-03 17:10:08 +08:00
|
|
|
|
return DEFAULT_MAX_HEALTH_INCREASE * 0.5;
|
2020-09-29 13:26:12 +08:00
|
|
|
|
|
|
|
|
|
case HitResult.SmallTickMiss:
|
2020-10-03 17:10:08 +08:00
|
|
|
|
return -DEFAULT_MAX_HEALTH_INCREASE * 0.5;
|
2020-09-29 13:26:12 +08:00
|
|
|
|
|
2023-12-30 09:21:59 +08:00
|
|
|
|
case HitResult.SliderTailHit:
|
2020-09-29 13:26:12 +08:00
|
|
|
|
case HitResult.LargeTickHit:
|
2020-10-03 17:10:08 +08:00
|
|
|
|
return DEFAULT_MAX_HEALTH_INCREASE;
|
2020-09-29 13:26:12 +08:00
|
|
|
|
|
|
|
|
|
case HitResult.LargeTickMiss:
|
2020-10-03 17:10:08 +08:00
|
|
|
|
return -DEFAULT_MAX_HEALTH_INCREASE;
|
2020-09-29 13:26:12 +08:00
|
|
|
|
|
2019-12-25 18:58:23 +08:00
|
|
|
|
case HitResult.Miss:
|
2022-05-19 18:55:51 +08:00
|
|
|
|
return -DEFAULT_MAX_HEALTH_INCREASE * 2;
|
2019-12-25 18:58:23 +08:00
|
|
|
|
|
|
|
|
|
case HitResult.Meh:
|
2022-05-17 14:11:22 +08:00
|
|
|
|
return DEFAULT_MAX_HEALTH_INCREASE * 0.05;
|
2019-12-25 18:58:23 +08:00
|
|
|
|
|
|
|
|
|
case HitResult.Ok:
|
2020-10-03 17:08:51 +08:00
|
|
|
|
return DEFAULT_MAX_HEALTH_INCREASE * 0.5;
|
2019-12-25 18:58:23 +08:00
|
|
|
|
|
|
|
|
|
case HitResult.Good:
|
2020-10-03 17:08:51 +08:00
|
|
|
|
return DEFAULT_MAX_HEALTH_INCREASE * 0.75;
|
2019-12-25 18:58:23 +08:00
|
|
|
|
|
|
|
|
|
case HitResult.Great:
|
2020-10-03 17:08:51 +08:00
|
|
|
|
return DEFAULT_MAX_HEALTH_INCREASE;
|
2019-12-25 18:58:23 +08:00
|
|
|
|
|
|
|
|
|
case HitResult.Perfect:
|
2020-10-03 17:08:51 +08:00
|
|
|
|
return DEFAULT_MAX_HEALTH_INCREASE * 1.05;
|
2019-12-25 18:58:23 +08:00
|
|
|
|
|
2020-09-29 13:26:12 +08:00
|
|
|
|
case HitResult.SmallBonus:
|
2020-10-03 17:10:08 +08:00
|
|
|
|
return DEFAULT_MAX_HEALTH_INCREASE * 0.5;
|
2020-09-29 13:26:12 +08:00
|
|
|
|
|
|
|
|
|
case HitResult.LargeBonus:
|
2020-10-03 17:10:08 +08:00
|
|
|
|
return DEFAULT_MAX_HEALTH_INCREASE;
|
2019-12-25 18:58:23 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-12-06 16:09:42 +08:00
|
|
|
|
|
|
|
|
|
/// <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 20:22:16 +08:00
|
|
|
|
|
2023-12-20 19:23:43 +08:00
|
|
|
|
public override string ToString() => $"MaxResult:{MaxResult}";
|
2017-03-15 15:07:40 +08:00
|
|
|
|
}
|
2017-09-06 16:02:13 +08:00
|
|
|
|
}
|