1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 01:42:55 +08:00

add difficulty adjustment mods

This commit is contained in:
unknown 2019-12-11 19:43:16 +08:00
parent 5624b9fd3f
commit b795532aa5
9 changed files with 224 additions and 0 deletions

View File

@ -98,6 +98,12 @@ namespace osu.Game.Rulesets.Catch
new CatchModFlashlight(),
};
case ModType.Conversion:
return new Mod[]
{
new CatchModDifficultyAdjust(),
};
case ModType.Automation:
return new Mod[]
{

View File

@ -0,0 +1,51 @@
// 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;
}
}
}

View File

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

View File

@ -0,0 +1,22 @@
// 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,
};
}
}

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 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,
};
}
}

View File

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

View File

@ -0,0 +1,42 @@
// 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("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,
};
}
}

View File

@ -97,6 +97,12 @@ namespace osu.Game.Rulesets.Taiko
new TaikoModFlashlight(),
};
case ModType.Conversion:
return new Mod[]
{
new TaikoModDifficultyAdjust(),
};
case ModType.Automation:
return new Mod[]
{

View File

@ -0,0 +1,43 @@
// 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.Game.Beatmaps;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites;
using System;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModDifficultyAdjust : Mod, IApplicableToDifficulty
{
public override string Name => @"Difficulty Adjust";
public override string Description => @"Override a beatmap's difficulty settings";
public override string Acronym => "DA";
public override ModType Type => ModType.Conversion;
public override IconUsage Icon => FontAwesome.Solid.Hammer;
public override double ScoreMultiplier => 1.0;
public override Type[] IncompatibleMods => new[] { typeof(ModEasy), typeof(ModHardRock) };
public virtual BindableNumber<float> DrainRate { get; }
public virtual BindableNumber<float> CircleSize { get; }
public virtual BindableNumber<float> ApproachRate { get; }
public virtual BindableNumber<float> OverallDifficulty { get; }
public virtual void ApplyToDifficulty(BeatmapDifficulty difficulty)
{
difficulty.DrainRate = DrainRate != null ? DrainRate.Value : difficulty.DrainRate;
difficulty.CircleSize = CircleSize != null ? CircleSize.Value : difficulty.CircleSize;
difficulty.ApproachRate = ApproachRate != null ? ApproachRate.Value : difficulty.ApproachRate;
difficulty.OverallDifficulty = OverallDifficulty != null ? OverallDifficulty.Value: difficulty.OverallDifficulty;
}
}
}