1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:47:27 +08:00

Add perfect and ok values, move to base Judgement

This commit is contained in:
smoogipoo 2019-12-25 19:58:23 +09:00
parent 0454c5022d
commit 3b07c3913d
2 changed files with 32 additions and 27 deletions

View File

@ -8,11 +8,6 @@ namespace osu.Game.Rulesets.Osu.Judgements
{
public class OsuJudgement : Judgement
{
/// <summary>
/// The health increase for a maximum judgement result.
/// </summary>
protected const double MAX_HEALTH_INCREASE = 0.05;
public override HitResult MaxResult => HitResult.Great;
protected override int NumericResultFor(HitResult result)
@ -32,26 +27,5 @@ namespace osu.Game.Rulesets.Osu.Judgements
return 300;
}
}
protected override double HealthIncreaseFor(HitResult result)
{
switch (result)
{
case HitResult.Miss:
return -MAX_HEALTH_INCREASE;
case HitResult.Meh:
return -MAX_HEALTH_INCREASE * 0.05;
case HitResult.Good:
return MAX_HEALTH_INCREASE * 0.3;
case HitResult.Great:
return MAX_HEALTH_INCREASE;
default:
return 0;
}
}
}
}

View File

@ -11,6 +11,12 @@ namespace osu.Game.Rulesets.Judgements
/// </summary>
public class Judgement
{
/// <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;
/// <summary>
/// The maximum <see cref="HitResult"/> that can be achieved.
/// </summary>
@ -55,7 +61,32 @@ namespace osu.Game.Rulesets.Judgements
/// </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;
protected virtual double HealthIncreaseFor(HitResult result)
{
switch (result)
{
case HitResult.Miss:
return -DEFAULT_MAX_HEALTH_INCREASE;
case HitResult.Meh:
return -DEFAULT_MAX_HEALTH_INCREASE * 0.05;
case HitResult.Ok:
return -DEFAULT_MAX_HEALTH_INCREASE * 0.01;
case HitResult.Good:
return DEFAULT_MAX_HEALTH_INCREASE * 0.3;
case HitResult.Great:
return DEFAULT_MAX_HEALTH_INCREASE;
case HitResult.Perfect:
return DEFAULT_MAX_HEALTH_INCREASE * 1.05;
default:
return 0;
}
}
/// <summary>
/// Retrieves the numeric health increase of a <see cref="JudgementResult"/>.