mirror of
https://github.com/ppy/osu
synced 2025-01-19 20:40:52 +00:00
Combine RestartOnFail into FailOverride
This commit is contained in:
parent
52b9a3f5e9
commit
007dfedbb7
@ -19,6 +19,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModAutopilot)).ToArray();
|
||||
|
||||
public bool AllowFail => false;
|
||||
public bool RestartOnFail => false;
|
||||
|
||||
public void Update(Playfield playfield)
|
||||
{
|
||||
|
@ -12,5 +12,10 @@ namespace osu.Game.Rulesets.Mods
|
||||
/// Whether we should allow failing at the current point in time.
|
||||
/// </summary>
|
||||
bool AllowFail { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether we want to restart on fail. Only used if AllowFail is true.
|
||||
/// </summary>
|
||||
bool RestartOnFail { get; }
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +0,0 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a mod which can request to restart on fail.
|
||||
/// </summary>
|
||||
public interface IApplicableRestartOnFail : IApplicableMod
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether we allow restarting
|
||||
/// </summary>
|
||||
bool AllowRestart { get; }
|
||||
}
|
||||
}
|
@ -30,6 +30,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override string Description => "Watch a perfect automated play through the song.";
|
||||
public override double ScoreMultiplier => 1;
|
||||
public bool AllowFail => false;
|
||||
public bool RestartOnFail => false;
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail) };
|
||||
}
|
||||
}
|
||||
|
@ -21,5 +21,6 @@ namespace osu.Game.Rulesets.Mods
|
||||
/// We never fail, 'yo.
|
||||
/// </summary>
|
||||
public bool AllowFail => false;
|
||||
public bool RestartOnFail => false;
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public abstract class ModSuddenDeath : Mod, IApplicableToScoreProcessor, IApplicableRestartOnFail
|
||||
public abstract class ModSuddenDeath : Mod, IApplicableToScoreProcessor, IApplicableFailOverride
|
||||
{
|
||||
public override string Name => "Sudden Death";
|
||||
public override string ShortenedName => "SD";
|
||||
@ -18,7 +18,8 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override bool Ranked => true;
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModNoFail), typeof(ModRelax), typeof(ModAutoplay) };
|
||||
|
||||
public bool AllowRestart => true;
|
||||
public bool AllowFail => true;
|
||||
public bool RestartOnFail => true;
|
||||
|
||||
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
|
||||
{
|
||||
|
@ -289,7 +289,7 @@ namespace osu.Game.Screens.Play
|
||||
if (Beatmap.Value.Mods.Value.OfType<IApplicableFailOverride>().Any(m => !m.AllowFail))
|
||||
return false;
|
||||
|
||||
if (Beatmap.Value.Mods.Value.OfType<IApplicableRestartOnFail>().Any(m => m.AllowRestart))
|
||||
if (Beatmap.Value.Mods.Value.OfType<IApplicableFailOverride>().Any(m => m.RestartOnFail))
|
||||
{
|
||||
Restart();
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user