mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 12:53:11 +08:00
make ModDifficultyAdjust generic
This commit is contained in:
parent
472fa9822c
commit
002a125b4a
@ -101,7 +101,7 @@ namespace osu.Game.Rulesets.Catch
|
|||||||
case ModType.Conversion:
|
case ModType.Conversion:
|
||||||
return new Mod[]
|
return new Mod[]
|
||||||
{
|
{
|
||||||
new CatchModDifficultyAdjust(),
|
new ModDifficultyAdjust(),
|
||||||
};
|
};
|
||||||
|
|
||||||
case ModType.Automation:
|
case ModType.Automation:
|
||||||
|
@ -1,51 +0,0 @@
|
|||||||
// 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.Beatmaps;
|
|
||||||
using osu.Game.Configuration;
|
|
||||||
using osu.Game.Rulesets.Mods;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Mods
|
|
||||||
{
|
|
||||||
public class CatchModDifficultyAdjust : ModDifficultyAdjust
|
|
||||||
{
|
|
||||||
[SettingSource("Drain Rate", "Override the beatmap's set HP")]
|
|
||||||
public override BindableNumber<float> DrainRate { get; } = new BindableFloat
|
|
||||||
{
|
|
||||||
MinValue = 1,
|
|
||||||
MaxValue = 10,
|
|
||||||
Default = 5,
|
|
||||||
Value = 5,
|
|
||||||
Precision = 1F,
|
|
||||||
};
|
|
||||||
|
|
||||||
[SettingSource("Fruit Size", "Override the beatmap's set CS")]
|
|
||||||
public override BindableNumber<float> CircleSize { get; } = new BindableFloat
|
|
||||||
{
|
|
||||||
MinValue = 1,
|
|
||||||
MaxValue = 10,
|
|
||||||
Default = 5,
|
|
||||||
Value = 5,
|
|
||||||
Precision = 0.1F,
|
|
||||||
};
|
|
||||||
|
|
||||||
[SettingSource("Approach Rate", "Override the beatmap's set AR")]
|
|
||||||
public override BindableNumber<float> ApproachRate { get; } = new BindableFloat
|
|
||||||
{
|
|
||||||
MinValue = 1,
|
|
||||||
MaxValue = 10,
|
|
||||||
Default = 5,
|
|
||||||
Value = 5,
|
|
||||||
Precision = 0.1F,
|
|
||||||
};
|
|
||||||
|
|
||||||
public override void ApplyToDifficulty(BeatmapDifficulty difficulty)
|
|
||||||
{
|
|
||||||
difficulty.DrainRate = DrainRate.Value;
|
|
||||||
difficulty.CircleSize = CircleSize.Value;
|
|
||||||
difficulty.ApproachRate = ApproachRate.Value;
|
|
||||||
difficulty.OverallDifficulty = ApproachRate.Value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -143,7 +143,7 @@ namespace osu.Game.Rulesets.Mania
|
|||||||
new ManiaModRandom(),
|
new ManiaModRandom(),
|
||||||
new ManiaModDualStages(),
|
new ManiaModDualStages(),
|
||||||
new ManiaModMirror(),
|
new ManiaModMirror(),
|
||||||
new ManiaModDifficultyAdjust(),
|
new ModDifficultyAdjust(),
|
||||||
};
|
};
|
||||||
|
|
||||||
case ModType.Automation:
|
case ModType.Automation:
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
// 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("Overall Difficulty", "Override the beatmap's set OD")]
|
|
||||||
public override BindableNumber<float> OverallDifficulty { get; } = new BindableFloat
|
|
||||||
{
|
|
||||||
MinValue = 1,
|
|
||||||
MaxValue = 10,
|
|
||||||
Default = 5,
|
|
||||||
Value = 5,
|
|
||||||
Precision = 0.1F,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
// 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 the beatmap's set HP")]
|
|
||||||
public override BindableNumber<float> DrainRate { get; } = new BindableFloat
|
|
||||||
{
|
|
||||||
MinValue = 1,
|
|
||||||
MaxValue = 10,
|
|
||||||
Default = 5,
|
|
||||||
Value = 5,
|
|
||||||
Precision = 0.1F,
|
|
||||||
};
|
|
||||||
|
|
||||||
[SettingSource("Circle Size", "Override the beatmap's set CS")]
|
|
||||||
public override BindableNumber<float> CircleSize { get; } = new BindableFloat
|
|
||||||
{
|
|
||||||
MinValue = 1,
|
|
||||||
MaxValue = 10,
|
|
||||||
Default = 5,
|
|
||||||
Value = 5,
|
|
||||||
Precision = 0.1F,
|
|
||||||
};
|
|
||||||
|
|
||||||
[SettingSource("Approach Rate", "Override the beatmap's set AR")]
|
|
||||||
public override BindableNumber<float> ApproachRate { get; } = new BindableFloat
|
|
||||||
{
|
|
||||||
MinValue = 1,
|
|
||||||
MaxValue = 10,
|
|
||||||
Default = 5,
|
|
||||||
Value = 5,
|
|
||||||
Precision = 0.1F,
|
|
||||||
};
|
|
||||||
|
|
||||||
[SettingSource("Overall Difficulty", "Override the beatmap's set OD")]
|
|
||||||
public override BindableNumber<float> OverallDifficulty { get; } = new BindableFloat
|
|
||||||
{
|
|
||||||
MinValue = 1,
|
|
||||||
MaxValue = 10,
|
|
||||||
Default = 5,
|
|
||||||
Value = 5,
|
|
||||||
Precision = 0.1F,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@ -121,7 +121,7 @@ namespace osu.Game.Rulesets.Osu
|
|||||||
return new Mod[]
|
return new Mod[]
|
||||||
{
|
{
|
||||||
new OsuModTarget(),
|
new OsuModTarget(),
|
||||||
new OsuModDifficultyAdjust(),
|
new ModDifficultyAdjust(),
|
||||||
};
|
};
|
||||||
|
|
||||||
case ModType.Automation:
|
case ModType.Automation:
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
// 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 the beatmap's set HP")]
|
|
||||||
public override BindableNumber<float> DrainRate { get; } = new BindableFloat
|
|
||||||
{
|
|
||||||
MinValue = 1,
|
|
||||||
MaxValue = 10,
|
|
||||||
Default = 5,
|
|
||||||
Value = 5,
|
|
||||||
Precision = 0.1F,
|
|
||||||
};
|
|
||||||
|
|
||||||
[SettingSource("Overall Difficulty", "Override the beatmap's set OD")]
|
|
||||||
public override BindableNumber<float> OverallDifficulty { get; } = new BindableFloat
|
|
||||||
{
|
|
||||||
MinValue = 1,
|
|
||||||
MaxValue = 10,
|
|
||||||
Default = 5,
|
|
||||||
Value = 5,
|
|
||||||
Precision = 0.1F,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@ -100,7 +100,7 @@ namespace osu.Game.Rulesets.Taiko
|
|||||||
case ModType.Conversion:
|
case ModType.Conversion:
|
||||||
return new Mod[]
|
return new Mod[]
|
||||||
{
|
{
|
||||||
new TaikoModDifficultyAdjust(),
|
new ModDifficultyAdjust(),
|
||||||
};
|
};
|
||||||
|
|
||||||
case ModType.Automation:
|
case ModType.Automation:
|
||||||
|
@ -5,10 +5,11 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using System;
|
using System;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mods
|
namespace osu.Game.Rulesets.Mods
|
||||||
{
|
{
|
||||||
public abstract class ModDifficultyAdjust : Mod, IApplicableToDifficulty
|
public class ModDifficultyAdjust : Mod, IApplicableToDifficulty
|
||||||
{
|
{
|
||||||
public override string Name => @"Difficulty Adjust";
|
public override string Name => @"Difficulty Adjust";
|
||||||
|
|
||||||
@ -24,20 +25,52 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
|
|
||||||
public override Type[] IncompatibleMods => new[] { typeof(ModEasy), typeof(ModHardRock) };
|
public override Type[] IncompatibleMods => new[] { typeof(ModEasy), typeof(ModHardRock) };
|
||||||
|
|
||||||
public virtual BindableNumber<float> DrainRate { get; }
|
[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> CircleSize { 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> ApproachRate { 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> OverallDifficulty { 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 void ApplyToDifficulty(BeatmapDifficulty difficulty)
|
public virtual void ApplyToDifficulty(BeatmapDifficulty difficulty)
|
||||||
{
|
{
|
||||||
difficulty.DrainRate = DrainRate != null ? DrainRate.Value : difficulty.DrainRate;
|
difficulty.DrainRate = DrainRate.Value;
|
||||||
difficulty.CircleSize = CircleSize != null ? CircleSize.Value : difficulty.CircleSize;
|
difficulty.CircleSize = CircleSize.Value;
|
||||||
difficulty.ApproachRate = ApproachRate != null ? ApproachRate.Value : difficulty.ApproachRate;
|
difficulty.ApproachRate = ApproachRate.Value;
|
||||||
difficulty.OverallDifficulty = OverallDifficulty != null ? OverallDifficulty.Value : difficulty.OverallDifficulty;
|
difficulty.OverallDifficulty = OverallDifficulty.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user