// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Judgements { /// /// The scoring information provided by a . /// public class Judgement { /// /// The default health increase for a maximum judgement, as a proportion of total health. /// By default, each maximum judgement restores 5% of total health. /// protected const double DEFAULT_MAX_HEALTH_INCREASE = 0.05; /// /// The maximum that can be achieved. /// public virtual HitResult MaxResult => HitResult.Perfect; /// /// The minimum that can be achieved - the inverse of . /// /// /// Defaults to a sane value for the given . May be overridden to provide a supported custom value: /// /// /// s /// Valid s /// /// /// , , , , /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// , /// /// /// public virtual HitResult MinResult { get { switch (MaxResult) { case HitResult.SmallBonus: case HitResult.LargeBonus: case HitResult.IgnoreHit: return HitResult.IgnoreMiss; case HitResult.SmallTickHit: return HitResult.SmallTickMiss; case HitResult.LargeTickHit: case HitResult.SliderTailHit: return HitResult.LargeTickMiss; default: return HitResult.Miss; } } } /// /// The health increase for the maximum achievable result. /// public double MaxHealthIncrease => HealthIncreaseFor(MaxResult); /// /// Retrieves the numeric health increase of a . /// /// The to find the numeric health increase for. /// The numeric health increase of . protected virtual double HealthIncreaseFor(HitResult result) { switch (result) { default: return 0; case HitResult.SmallTickHit: return DEFAULT_MAX_HEALTH_INCREASE * 0.5; case HitResult.SmallTickMiss: return -DEFAULT_MAX_HEALTH_INCREASE * 0.5; case HitResult.SliderTailHit: case HitResult.LargeTickHit: return DEFAULT_MAX_HEALTH_INCREASE; case HitResult.LargeTickMiss: return -DEFAULT_MAX_HEALTH_INCREASE; case HitResult.Miss: return -DEFAULT_MAX_HEALTH_INCREASE * 2; case HitResult.Meh: return DEFAULT_MAX_HEALTH_INCREASE * 0.05; case HitResult.Ok: return DEFAULT_MAX_HEALTH_INCREASE * 0.5; case HitResult.Good: return DEFAULT_MAX_HEALTH_INCREASE * 0.75; case HitResult.Great: return DEFAULT_MAX_HEALTH_INCREASE; case HitResult.Perfect: return DEFAULT_MAX_HEALTH_INCREASE * 1.05; case HitResult.SmallBonus: return DEFAULT_MAX_HEALTH_INCREASE * 0.5; case HitResult.LargeBonus: return DEFAULT_MAX_HEALTH_INCREASE; } } /// /// Retrieves the numeric health increase of a . /// /// The to find the numeric health increase for. /// The numeric health increase of . public double HealthIncreaseFor(JudgementResult result) => HealthIncreaseFor(result.Type); public override string ToString() => $"MaxResult:{MaxResult}"; } }