1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

make ModDifficultyAdjust abstract

This commit is contained in:
unknown 2019-12-20 18:30:23 +08:00
parent ea661fce21
commit 08b477ed52
9 changed files with 193 additions and 50 deletions

View File

@ -109,7 +109,7 @@ namespace osu.Game.Rulesets.Catch
case ModType.Conversion:
return new Mod[]
{
new ModDifficultyAdjust(),
new CatchModDifficultyAdjust(),
};
case ModType.Automation:

View File

@ -0,0 +1,52 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Game.Configuration;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Rulesets.Catch.Mods
{
public class CatchModDifficultyAdjust : ModDifficultyAdjust
{
[SettingSource("Drain Rate", "Override a beatmap's set HP.")]
public override BindableNumber<float> DrainRate { get; } = new BindableFloat()
{
Precision = 0.1f,
MinValue = 1,
MaxValue = 10,
Default = 5,
Value = 5,
};
[SettingSource("Fruit Size", "Override a beatmap's set CS.")]
public override BindableNumber<float> CircleSize { get; } = new BindableFloat()
{
Precision = 0.1f,
MinValue = 1,
MaxValue = 10,
Default = 5,
Value = 5,
};
[SettingSource("Approach Rate", "Override a beatmap's set AR.")]
public override BindableNumber<float> ApproachRate { get; } = new BindableFloat()
{
Precision = 0.1f,
MinValue = 1,
MaxValue = 10,
Default = 5,
Value = 5,
};
[SettingSource("Overall Difficulty", "Override a beatmap's set OD.")]
public override BindableNumber<float> OverallDifficulty { get; } = new BindableFloat()
{
Precision = 0.1f,
MinValue = 1,
MaxValue = 10,
Default = 5,
Value = 5,
};
}
}

View File

@ -151,7 +151,7 @@ namespace osu.Game.Rulesets.Mania
new ManiaModRandom(),
new ManiaModDualStages(),
new ManiaModMirror(),
new ModDifficultyAdjust(),
new ManiaModDifficultyAdjust(),
};
case ModType.Automation:

View File

@ -0,0 +1,32 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Game.Configuration;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Rulesets.Mania.Mods
{
public class ManiaModDifficultyAdjust : ModDifficultyAdjust
{
[SettingSource("Drain Rate", "Override a beatmap's set HP.")]
public override BindableNumber<float> DrainRate { get; } = new BindableFloat()
{
Precision = 0.1f,
MinValue = 1,
MaxValue = 10,
Default = 5,
Value = 5,
};
[SettingSource("Overall Difficulty", "Override a beatmap's set OD.")]
public override BindableNumber<float> OverallDifficulty { get; } = new BindableFloat()
{
Precision = 0.1f,
MinValue = 1,
MaxValue = 10,
Default = 5,
Value = 5,
};
}
}

View File

@ -0,0 +1,52 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Game.Configuration;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Rulesets.Osu.Mods
{
public class OsuModDifficultyAdjust : ModDifficultyAdjust
{
[SettingSource("Drain Rate", "Override a beatmap's set HP.")]
public override BindableNumber<float> DrainRate { get; } = new BindableFloat()
{
Precision = 0.1f,
MinValue = 1,
MaxValue = 10,
Default = 5,
Value = 5,
};
[SettingSource("Circle Size", "Override a beatmap's set CS.")]
public override BindableNumber<float> CircleSize { get; } = new BindableFloat()
{
Precision = 0.1f,
MinValue = 1,
MaxValue = 10,
Default = 5,
Value = 5,
};
[SettingSource("Approach Rate", "Override a beatmap's set AR.")]
public override BindableNumber<float> ApproachRate { get; } = new BindableFloat()
{
Precision = 0.1f,
MinValue = 1,
MaxValue = 10,
Default = 5,
Value = 5,
};
[SettingSource("Overall Difficulty", "Override a beatmap's set OD.")]
public override BindableNumber<float> OverallDifficulty { get; } = new BindableFloat()
{
Precision = 0.1f,
MinValue = 1,
MaxValue = 10,
Default = 5,
Value = 5,
};
}
}

View File

@ -130,7 +130,7 @@ namespace osu.Game.Rulesets.Osu
return new Mod[]
{
new OsuModTarget(),
new ModDifficultyAdjust(),
new OsuModDifficultyAdjust(),
};
case ModType.Automation:

View File

@ -0,0 +1,32 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Game.Configuration;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Rulesets.Taiko.Mods
{
public class TaikoModDifficultyAdjust : ModDifficultyAdjust
{
[SettingSource("Drain Rate", "Override a beatmap's set HP.")]
public override BindableNumber<float> DrainRate { get; } = new BindableFloat()
{
Precision = 0.1f,
MinValue = 1,
MaxValue = 10,
Default = 5,
Value = 5,
};
[SettingSource("Overall Difficulty", "Override a beatmap's set OD.")]
public override BindableNumber<float> OverallDifficulty { get; } = new BindableFloat()
{
Precision = 0.1f,
MinValue = 1,
MaxValue = 10,
Default = 5,
Value = 5,
};
}
}

View File

@ -108,7 +108,7 @@ namespace osu.Game.Rulesets.Taiko
case ModType.Conversion:
return new Mod[]
{
new ModDifficultyAdjust(),
new TaikoModDifficultyAdjust(),
};
case ModType.Automation:

View File

@ -5,11 +5,10 @@ using osu.Game.Beatmaps;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites;
using System;
using osu.Game.Configuration;
namespace osu.Game.Rulesets.Mods
{
public class ModDifficultyAdjust : Mod, IApplicableToDifficulty
public abstract class ModDifficultyAdjust : Mod, IApplicableToDifficulty
{
public override string Name => @"Difficulty Adjust";
@ -25,45 +24,13 @@ namespace osu.Game.Rulesets.Mods
public override Type[] IncompatibleMods => new[] { typeof(ModEasy), typeof(ModHardRock) };
[SettingSource("Drain Rate", "Override the beatmap's set HP")]
public BindableNumber<float> DrainRate { get; } = new BindableFloat
{
MinValue = 1,
MaxValue = 10,
Default = 5,
Value = 5,
Precision = 0.1F,
};
public virtual BindableNumber<float> DrainRate { get; }
[SettingSource("Circle Size", "Override the beatmap's set CS")]
public BindableNumber<float> CircleSize { get; } = new BindableFloat
{
MinValue = 1,
MaxValue = 10,
Default = 5,
Value = 5,
Precision = 0.1F,
};
public virtual BindableNumber<float> CircleSize { get; }
[SettingSource("Approach Rate", "Override the beatmap's set AR")]
public BindableNumber<float> ApproachRate { get; } = new BindableFloat
{
MinValue = 1,
MaxValue = 10,
Default = 5,
Value = 5,
Precision = 0.1F,
};
public virtual BindableNumber<float> ApproachRate { get; }
[SettingSource("Overall Difficulty", "Override the beatmap's set OD")]
public BindableNumber<float> OverallDifficulty { get; } = new BindableFloat
{
MinValue = 1,
MaxValue = 10,
Default = 5,
Value = 5,
Precision = 0.1F,
};
public virtual BindableNumber<float> OverallDifficulty { get; }
private BeatmapDifficulty difficulty;
@ -72,17 +39,25 @@ namespace osu.Game.Rulesets.Mods
if (this.difficulty == null || this.difficulty.ID != difficulty.ID)
{
this.difficulty = difficulty;
DrainRate.Value = DrainRate.Default = difficulty.DrainRate;
CircleSize.Value = CircleSize.Default = difficulty.CircleSize;
ApproachRate.Value = ApproachRate.Default = difficulty.ApproachRate;
OverallDifficulty.Value = OverallDifficulty.Default = difficulty.OverallDifficulty;
if (DrainRate != null)
DrainRate.Value = DrainRate.Default = difficulty.DrainRate;
if (CircleSize != null)
CircleSize.Value = CircleSize.Default = difficulty.CircleSize;
if (ApproachRate != null)
ApproachRate.Value = ApproachRate.Default = difficulty.ApproachRate;
if (OverallDifficulty != null)
OverallDifficulty.Value = OverallDifficulty.Default = difficulty.OverallDifficulty;
}
else
{
difficulty.DrainRate = DrainRate.Value;
difficulty.CircleSize = CircleSize.Value;
difficulty.ApproachRate = ApproachRate.Value;
difficulty.OverallDifficulty = OverallDifficulty.Value;
difficulty.DrainRate = DrainRate?.Value ?? difficulty.DrainRate;
difficulty.CircleSize = CircleSize?.Value ?? difficulty.CircleSize;
difficulty.ApproachRate = ApproachRate?.Value ?? difficulty.ApproachRate;
difficulty.OverallDifficulty = OverallDifficulty?.Value ?? difficulty.OverallDifficulty;
}
}
}