mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 01:43:20 +08:00
Add auto-restart functionality to sudden death and perfect mods (#6159)
Add auto-restart functionality to sudden death and perfect mods Co-authored-by: Paul Teng <plankp@outlook.com> Co-authored-by: Dan Balasescu <smoogipoo@smgi.me>
This commit is contained in:
commit
28342baa8f
@ -25,6 +25,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
public override Type[] IncompatibleMods => new[] { typeof(OsuModSpunOut), typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail), typeof(ModAutoplay) };
|
||||
|
||||
public bool AllowFail => false;
|
||||
public bool RestartOnFail => false;
|
||||
|
||||
private OsuInputManager inputManager;
|
||||
|
||||
|
@ -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 <see cref="AllowFail"/> is true.
|
||||
/// </summary>
|
||||
bool RestartOnFail { get; }
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,10 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override ModType Type => ModType.Automation;
|
||||
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) };
|
||||
|
||||
public override bool HasImplementation => GetType().GenericTypeArguments.Length == 0;
|
||||
|
@ -16,6 +16,8 @@ namespace osu.Game.Rulesets.Mods
|
||||
/// </summary>
|
||||
public bool AllowFail => false;
|
||||
|
||||
public bool RestartOnFail => false;
|
||||
|
||||
public void ReadFromConfig(OsuConfigManager config)
|
||||
{
|
||||
showHealthBar = config.GetBindable<bool>(OsuSetting.ShowHealthDisplayWhenCantFail);
|
||||
|
@ -10,7 +10,7 @@ using osu.Game.Scoring;
|
||||
|
||||
namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public abstract class ModSuddenDeath : Mod, IApplicableToScoreProcessor
|
||||
public abstract class ModSuddenDeath : Mod, IApplicableToScoreProcessor, IApplicableFailOverride
|
||||
{
|
||||
public override string Name => "Sudden Death";
|
||||
public override string Acronym => "SD";
|
||||
@ -21,6 +21,9 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override bool Ranked => true;
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModNoFail), typeof(ModRelax), typeof(ModAutoplay) };
|
||||
|
||||
public bool AllowFail => true;
|
||||
public bool RestartOnFail => true;
|
||||
|
||||
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
|
||||
{
|
||||
scoreProcessor.FailConditions += FailCondition;
|
||||
|
@ -378,6 +378,10 @@ namespace osu.Game.Screens.Play
|
||||
PauseOverlay.Hide();
|
||||
|
||||
failAnimation.Start();
|
||||
|
||||
if (Mods.Value.OfType<IApplicableFailOverride>().Any(m => m.RestartOnFail))
|
||||
Restart();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user