1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 14:12:56 +08:00

Make sure unimplemented auto mods aren't consumable

This commit is contained in:
Dean Herbert 2018-01-12 14:26:23 +09:00
parent 057efa24c7
commit 9a77005d2e
2 changed files with 11 additions and 9 deletions

View File

@ -10,6 +10,7 @@ using osu.Game.Rulesets.UI;
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Game.Rulesets.Catch.Objects;
namespace osu.Game.Rulesets.Catch namespace osu.Game.Rulesets.Catch
{ {
@ -80,7 +81,7 @@ namespace osu.Game.Rulesets.Catch
{ {
Mods = new Mod[] Mods = new Mod[]
{ {
new ModAutoplay(), new ModAutoplay<CatchHitObject>(),
new ModCinema(), new ModCinema(),
}, },
}, },

View File

@ -5,23 +5,25 @@ using System;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Replays;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Mods namespace osu.Game.Rulesets.Mods
{ {
public abstract class ModAutoplay<T> : ModAutoplay, IApplicableToRulesetContainer<T> public class ModAutoplay<T> : ModAutoplay, IApplicableToRulesetContainer<T>, IApplicableFailOverride
where T : HitObject where T : HitObject
{ {
protected abstract Score CreateReplayScore(Beatmap<T> beatmap); protected virtual Score CreateReplayScore(Beatmap<T> beatmap) => new Score { Replay = new Replay() };
public virtual void ApplyToRulesetContainer(RulesetContainer<T> rulesetContainer) public override bool HasImplementation => GetType().GenericTypeArguments.Length == 0;
{
rulesetContainer.SetReplay(CreateReplayScore(rulesetContainer.Beatmap)?.Replay); public bool AllowFail => false;
}
public virtual void ApplyToRulesetContainer(RulesetContainer<T> rulesetContainer) => rulesetContainer.SetReplay(CreateReplayScore(rulesetContainer.Beatmap)?.Replay);
} }
public class ModAutoplay : Mod, IApplicableFailOverride public abstract class ModAutoplay : Mod
{ {
public override string Name => "Autoplay"; public override string Name => "Autoplay";
public override string ShortenedName => "AT"; public override string ShortenedName => "AT";
@ -29,6 +31,5 @@ namespace osu.Game.Rulesets.Mods
public override string Description => "Watch a perfect automated play through the song"; public override string Description => "Watch a perfect automated play through the song";
public override double ScoreMultiplier => 0; public override double ScoreMultiplier => 0;
public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail) }; public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail) };
public bool AllowFail => false;
} }
} }