2019-12-25 12:16:40 +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.
|
|
|
|
|
|
2024-02-14 13:21:48 +00:00
|
|
|
|
using osu.Game.Rulesets.Judgements;
|
|
|
|
|
|
2019-12-25 12:16:40 +00:00
|
|
|
|
namespace osu.Game.Rulesets.Scoring
|
|
|
|
|
{
|
2019-12-25 12:22:46 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// A <see cref="HealthProcessor"/> that accumulates health and causes a fail if the final health
|
|
|
|
|
/// is less than a value required to pass the beatmap.
|
|
|
|
|
/// </summary>
|
2019-12-25 12:16:40 +00:00
|
|
|
|
public partial class AccumulatingHealthProcessor : HealthProcessor
|
|
|
|
|
{
|
2024-02-14 13:21:48 +00:00
|
|
|
|
protected override bool CheckDefaultFailCondition(JudgementResult _) => JudgedHits == MaxHits && Health.Value < requiredHealth;
|
2019-12-25 12:22:46 +00:00
|
|
|
|
|
|
|
|
|
private readonly double requiredHealth;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Creates a new <see cref="AccumulatingHealthProcessor"/>.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="requiredHealth">The minimum amount of health required to beatmap.</param>
|
2019-12-27 07:14:49 +00:00
|
|
|
|
public AccumulatingHealthProcessor(double requiredHealth)
|
2019-12-25 12:16:40 +00:00
|
|
|
|
{
|
2019-12-25 12:22:46 +00:00
|
|
|
|
this.requiredHealth = requiredHealth;
|
2019-12-25 12:16:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Reset(bool storeResults)
|
|
|
|
|
{
|
|
|
|
|
base.Reset(storeResults);
|
|
|
|
|
|
|
|
|
|
Health.Value = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|