mirror of
https://github.com/ppy/osu
synced 2024-12-11 09:27:08 +00:00
31 lines
1.1 KiB
C#
31 lines
1.1 KiB
C#
// 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.
|
|
|
|
using System;
|
|
using osu.Framework.Bindables;
|
|
using osu.Game.Configuration;
|
|
using osu.Game.Rulesets.Judgements;
|
|
using osu.Game.Rulesets.Scoring;
|
|
|
|
namespace osu.Game.Rulesets.Mods
|
|
{
|
|
public abstract class ModFailCondition : Mod, IApplicableToHealthProcessor, IApplicableFailOverride
|
|
{
|
|
public override Type[] IncompatibleMods => new[] { typeof(ModNoFail), typeof(ModRelax), typeof(ModAutoplay) };
|
|
|
|
[SettingSource("Restart on fail", "Automatically restarts when failed.")]
|
|
public BindableBool Restart { get; } = new BindableBool();
|
|
|
|
public virtual bool PerformFail() => true;
|
|
|
|
public virtual bool RestartOnFail => Restart.Value;
|
|
|
|
public void ApplyToHealthProcessor(HealthProcessor healthProcessor)
|
|
{
|
|
healthProcessor.FailConditions += FailCondition;
|
|
}
|
|
|
|
protected abstract bool FailCondition(HealthProcessor healthProcessor, JudgementResult result);
|
|
}
|
|
}
|