Male NoFail use an applicable interface

This commit is contained in:
Dean Herbert
2017-12-31 04:10:25 +09:00
parent fea4e1ff68
commit d9a80dae5d
5 changed files with 21 additions and 9 deletions

View File

@ -0,0 +1,16 @@
// Copyright (c) 2007-2017 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 override (and block) a fail.
/// </summary>
public interface IApplicableFailOverride : IApplicableMod
{
/// <summary>
/// Whether we should allow failing at the current point in time.
/// </summary>
bool AllowFail { get; }
}
}

View File

@ -55,10 +55,5 @@ namespace osu.Game.Rulesets.Mods
/// The mods this mod cannot be enabled with. /// The mods this mod cannot be enabled with.
/// </summary> /// </summary>
public virtual Type[] IncompatibleMods => new Type[] { }; public virtual Type[] IncompatibleMods => new Type[] { };
/// <summary>
/// Whether we should allow failing at the current point in time.
/// </summary>
public virtual bool AllowFail => true;
} }
} }

View File

@ -6,7 +6,7 @@ using osu.Game.Graphics;
namespace osu.Game.Rulesets.Mods namespace osu.Game.Rulesets.Mods
{ {
public abstract class ModNoFail : Mod public abstract class ModNoFail : Mod, IApplicableFailOverride
{ {
public override string Name => "NoFail"; public override string Name => "NoFail";
public override string ShortenedName => "NF"; public override string ShortenedName => "NF";
@ -20,6 +20,6 @@ namespace osu.Game.Rulesets.Mods
/// <summary> /// <summary>
/// We never fail, 'yo. /// We never fail, 'yo.
/// </summary> /// </summary>
public override bool AllowFail => false; public bool AllowFail => false;
} }
} }

View File

@ -298,7 +298,7 @@ namespace osu.Game.Screens.Play
private bool onFail() private bool onFail()
{ {
if (Beatmap.Value.Mods.Value.Any(m => !m.AllowFail)) if (Beatmap.Value.Mods.Value.OfType<IApplicableFailOverride>().Any(m => !m.AllowFail))
return false; return false;
decoupledClock.Stop(); decoupledClock.Stop();

View File

@ -310,6 +310,7 @@
<Compile Include="Overlays\Profile\Sections\Ranks\DrawableTotalScore.cs" /> <Compile Include="Overlays\Profile\Sections\Ranks\DrawableTotalScore.cs" />
<Compile Include="Overlays\Profile\Sections\Ranks\ScoreModsContainer.cs" /> <Compile Include="Overlays\Profile\Sections\Ranks\ScoreModsContainer.cs" />
<Compile Include="Overlays\Settings\Sections\Maintenance\DeleteAllBeatmapsDialog.cs" /> <Compile Include="Overlays\Settings\Sections\Maintenance\DeleteAllBeatmapsDialog.cs" />
<Compile Include="Rulesets\Mods\IApplicableFailOverride.cs" />
<Compile Include="Rulesets\Mods\IApplicableMod.cs" /> <Compile Include="Rulesets\Mods\IApplicableMod.cs" />
<Compile Include="Rulesets\Mods\IApplicableToDrawableHitObject.cs" /> <Compile Include="Rulesets\Mods\IApplicableToDrawableHitObject.cs" />
<Compile Include="Screens\Select\ImportFromStablePopup.cs" /> <Compile Include="Screens\Select\ImportFromStablePopup.cs" />