1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-17 18:13:22 +08:00
osu-lazer/osu.Game/Modes/Mods/Mod.cs

175 lines
6.5 KiB
C#
Raw Normal View History

2017-02-17 04:05:03 +08:00
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
2017-03-13 20:05:09 +08:00
using osu.Game.Beatmaps;
2017-02-17 04:05:03 +08:00
using osu.Game.Graphics;
2017-03-13 20:05:09 +08:00
using osu.Game.Modes.Objects;
using osu.Game.Modes.UI;
using System;
2017-02-17 04:05:03 +08:00
namespace osu.Game.Modes.Mods
2017-02-17 04:05:03 +08:00
{
2017-02-23 19:59:27 +08:00
/// <summary>
/// The base class for gameplay modifiers.
/// </summary>
public abstract class Mod
2017-02-17 04:05:03 +08:00
{
2017-02-23 19:57:58 +08:00
/// <summary>
/// The name of this mod.
/// </summary>
public abstract string Name { get; }
2017-02-23 19:57:58 +08:00
/// <summary>
/// The icon of this mod.
/// </summary>
public virtual FontAwesome Icon => FontAwesome.fa_question;
2017-02-23 19:57:58 +08:00
/// <summary>
2017-03-02 08:57:33 +08:00
/// The user readable description of this mod.
2017-02-23 19:57:58 +08:00
/// </summary>
public virtual string Description => string.Empty;
2017-02-23 19:57:58 +08:00
/// <summary>
2017-03-02 08:57:33 +08:00
/// The score multiplier of this mod.
2017-02-23 19:57:58 +08:00
/// </summary>
2017-03-02 08:57:33 +08:00
public abstract double ScoreMultiplier { get; }
2017-02-23 19:57:58 +08:00
/// <summary>
2017-03-02 08:57:33 +08:00
/// Returns if this mod is ranked.
2017-02-23 19:57:58 +08:00
/// </summary>
public virtual bool Ranked => false;
2017-02-23 19:57:58 +08:00
/// <summary>
2017-03-02 08:57:33 +08:00
/// The mods this mod cannot be enabled with.
2017-02-23 19:57:58 +08:00
/// </summary>
public virtual Type[] IncompatibleMods => new Type[] { };
}
2017-02-17 04:05:03 +08:00
public class MultiMod : Mod
{
public override string Name => string.Empty;
public override string Description => string.Empty;
public override double ScoreMultiplier => 0.0;
public Mod[] Mods;
}
2017-03-02 08:57:33 +08:00
public abstract class ModNoFail : Mod
2017-02-17 04:05:03 +08:00
{
public override string Name => "NoFail";
2017-02-17 04:05:03 +08:00
public override FontAwesome Icon => FontAwesome.fa_osu_mod_nofail;
public override string Description => "You can't fail, no matter what.";
2017-03-02 08:57:33 +08:00
public override double ScoreMultiplier => 0.5;
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModAutoplay) };
2017-02-17 04:05:03 +08:00
}
2017-03-02 08:57:33 +08:00
public abstract class ModEasy : Mod
2017-02-17 04:05:03 +08:00
{
public override string Name => "Easy";
2017-02-17 04:05:03 +08:00
public override FontAwesome Icon => FontAwesome.fa_osu_mod_easy;
public override string Description => "Reduces overall difficulty - larger circles, more forgiving HP drain, less accuracy required.";
2017-03-02 08:57:33 +08:00
public override double ScoreMultiplier => 0.5;
public override bool Ranked => true;
2017-03-07 08:16:47 +08:00
public override Type[] IncompatibleMods => new[] { typeof(ModHardRock) };
2017-02-17 04:05:03 +08:00
}
2017-03-02 08:57:33 +08:00
public abstract class ModHidden : Mod
2017-02-17 04:05:03 +08:00
{
public override string Name => "Hidden";
2017-02-17 04:05:03 +08:00
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hidden;
2017-03-02 08:57:33 +08:00
public override bool Ranked => true;
2017-02-17 04:05:03 +08:00
}
2017-03-02 08:57:33 +08:00
public abstract class ModHardRock : Mod
2017-02-17 04:05:03 +08:00
{
public override string Name => "Hard Rock";
2017-02-17 04:05:03 +08:00
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hardrock;
public override string Description => "Everything just got a bit harder...";
public override Type[] IncompatibleMods => new[] { typeof(ModEasy) };
2017-02-17 04:05:03 +08:00
}
2017-03-02 08:57:33 +08:00
public abstract class ModSuddenDeath : Mod
2017-02-17 04:05:03 +08:00
{
public override string Name => "Sudden Death";
2017-02-17 04:05:03 +08:00
public override FontAwesome Icon => FontAwesome.fa_osu_mod_suddendeath;
public override string Description => "Miss a note and fail.";
2017-03-02 08:57:33 +08:00
public override double ScoreMultiplier => 1;
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModNoFail), typeof(ModRelax), typeof(ModAutoplay) };
2017-02-17 04:05:03 +08:00
}
2017-03-02 08:57:33 +08:00
public abstract class ModDoubleTime : Mod
2017-02-17 04:05:03 +08:00
{
public override string Name => "Double Time";
2017-02-17 04:05:03 +08:00
public override FontAwesome Icon => FontAwesome.fa_osu_mod_doubletime;
public override string Description => "Zoooooooooom";
2017-03-02 08:57:33 +08:00
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModHalfTime) };
2017-02-17 04:05:03 +08:00
}
2017-03-02 08:57:33 +08:00
public abstract class ModRelax : Mod
2017-02-17 04:05:03 +08:00
{
public override string Name => "Relax";
2017-02-17 04:05:03 +08:00
public override FontAwesome Icon => FontAwesome.fa_osu_mod_relax;
2017-03-02 08:57:33 +08:00
public override double ScoreMultiplier => 0;
public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(ModNoFail), typeof(ModSuddenDeath) };
2017-02-17 04:05:03 +08:00
}
2017-03-02 08:57:33 +08:00
public abstract class ModHalfTime : Mod
2017-02-17 04:05:03 +08:00
{
public override string Name => "Half Time";
2017-02-17 04:05:03 +08:00
public override FontAwesome Icon => FontAwesome.fa_osu_mod_halftime;
public override string Description => "Less zoom";
2017-03-02 08:57:33 +08:00
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime) };
2017-02-17 04:05:03 +08:00
}
2017-03-02 08:57:33 +08:00
public abstract class ModNightcore : ModDoubleTime
2017-02-17 04:05:03 +08:00
{
public override string Name => "Nightcore";
2017-02-17 04:05:03 +08:00
public override FontAwesome Icon => FontAwesome.fa_osu_mod_nightcore;
public override string Description => "uguuuuuuuu";
2017-02-17 04:05:03 +08:00
}
2017-03-02 08:57:33 +08:00
public abstract class ModFlashlight : Mod
2017-02-17 04:05:03 +08:00
{
public override string Name => "Flashlight";
2017-02-17 04:05:03 +08:00
public override FontAwesome Icon => FontAwesome.fa_osu_mod_flashlight;
public override string Description => "Restricted view area.";
2017-03-02 08:57:33 +08:00
public override bool Ranked => true;
2017-02-17 04:05:03 +08:00
}
public class ModAutoplay : Mod
{
public override string Name => "Autoplay";
2017-02-17 04:05:03 +08:00
public override FontAwesome Icon => FontAwesome.fa_osu_mod_auto;
public override string Description => "Watch a perfect automated play through the song";
2017-03-02 08:57:33 +08:00
public override double ScoreMultiplier => 0;
public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail) };
2017-03-13 20:05:09 +08:00
}
2017-03-14 11:32:31 +08:00
public abstract class ModAutoplay<T> : ModAutoplay, IApplicableMod<T>
2017-03-13 20:05:09 +08:00
where T : HitObject
{
protected abstract Score CreateReplayScore(Beatmap<T> beatmap);
2017-03-13 20:05:09 +08:00
public void Apply(HitRenderer<T> hitRenderer)
{
2017-03-13 20:05:09 +08:00
hitRenderer.InputManager.ReplayInputHandler = CreateReplayScore(hitRenderer.Beatmap)?.Replay?.GetInputHandler();
}
2017-02-17 04:05:03 +08:00
}
public abstract class ModPerfect : ModSuddenDeath
2017-02-17 04:05:03 +08:00
{
public override string Name => "Perfect";
public override string Description => "SS or quit.";
2017-02-17 04:05:03 +08:00
}
2017-02-22 23:34:22 +08:00
public class ModCinema : ModAutoplay
2017-02-17 04:05:03 +08:00
{
public override string Name => "Cinema";
2017-02-17 04:05:03 +08:00
public override FontAwesome Icon => FontAwesome.fa_osu_mod_cinema;
}
2017-03-02 08:57:33 +08:00
}