diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs index aff2903078..c2e33f7f32 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs @@ -48,7 +48,7 @@ namespace osu.Desktop.VisualTests.Tests HitObjects = objects, BeatmapInfo = new BeatmapInfo { - BaseDifficulty = new BaseDifficulty(), + Difficulty = new BeatmapDifficulty(), Metadata = new BeatmapMetadata { Artist = @"Unknown", diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index a4995d2320..c97ea929f3 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -80,7 +80,7 @@ namespace osu.Desktop.VisualTests.Tests Mode = PlayMode.Osu, Path = "normal.osu", Version = "Normal", - BaseDifficulty = new BaseDifficulty + Difficulty = new BeatmapDifficulty { OverallDifficulty = 3.5f, } @@ -91,7 +91,7 @@ namespace osu.Desktop.VisualTests.Tests Mode = PlayMode.Osu, Path = "hard.osu", Version = "Hard", - BaseDifficulty = new BaseDifficulty + Difficulty = new BeatmapDifficulty { OverallDifficulty = 5, } @@ -102,7 +102,7 @@ namespace osu.Desktop.VisualTests.Tests Mode = PlayMode.Osu, Path = "insane.osu", Version = "Insane", - BaseDifficulty = new BaseDifficulty + Difficulty = new BeatmapDifficulty { OverallDifficulty = 7, } diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index 0d32532f09..41bd24b900 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -65,7 +65,7 @@ namespace osu.Desktop.VisualTests.Tests HitObjects = objects, BeatmapInfo = new BeatmapInfo { - BaseDifficulty = new BaseDifficulty(), + Difficulty = new BeatmapDifficulty(), Metadata = new BeatmapMetadata { Artist = @"Unknown", diff --git a/osu.Game.Modes.Osu/Objects/OsuHitObject.cs b/osu.Game.Modes.Osu/Objects/OsuHitObject.cs index a3f2222fbb..cee55a281c 100644 --- a/osu.Game.Modes.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Modes.Osu/Objects/OsuHitObject.cs @@ -69,7 +69,7 @@ namespace osu.Game.Modes.Osu.Objects public virtual void SetDefaultsFromBeatmap(Beatmap beatmap) { - Scale = (1.0f - 0.7f * (beatmap.BeatmapInfo.BaseDifficulty.CircleSize - 5) / 5) / 2; + Scale = (1.0f - 0.7f * (beatmap.BeatmapInfo.Difficulty.CircleSize - 5) / 5) / 2; } } } diff --git a/osu.Game.Modes.Osu/Objects/Slider.cs b/osu.Game.Modes.Osu/Objects/Slider.cs index 6c00af89b3..fdf3658d44 100644 --- a/osu.Game.Modes.Osu/Objects/Slider.cs +++ b/osu.Game.Modes.Osu/Objects/Slider.cs @@ -51,7 +51,7 @@ namespace osu.Game.Modes.Osu.Objects { base.SetDefaultsFromBeatmap(beatmap); - var baseDifficulty = beatmap.BeatmapInfo.BaseDifficulty; + var baseDifficulty = beatmap.BeatmapInfo.Difficulty; ControlPoint overridePoint; ControlPoint timingPoint = beatmap.TimingInfo.TimingPointAt(StartTime, out overridePoint); diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs index 61638ef25e..356fa5a6c1 100644 --- a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs @@ -94,7 +94,7 @@ namespace osu.Game.Tests.Beatmaps.Formats using (var stream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu")) { var beatmap = decoder.Decode(new StreamReader(stream)); - var difficulty = beatmap.BeatmapInfo.BaseDifficulty; + var difficulty = beatmap.BeatmapInfo.Difficulty; Assert.AreEqual(6.5f, difficulty.DrainRate); Assert.AreEqual(4, difficulty.CircleSize); Assert.AreEqual(8, difficulty.OverallDifficulty); diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index bf86aeea83..fc8bb751f9 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -51,30 +51,13 @@ namespace osu.Game.Beatmaps /// The slider velocity in positional length units. public double SliderVelocityAt(double time) { - double scoringDistance = 100 * BeatmapInfo.BaseDifficulty.SliderMultiplier; + double scoringDistance = 100 * BeatmapInfo.Difficulty.SliderMultiplier; double beatDistance = TimingInfo.BeatDistanceAt(time); if (beatDistance > 0) return scoringDistance / beatDistance * 1000; return scoringDistance; } - - /// - /// Maps a difficulty value [0, 10] to a two-piece linear range of values. - /// - /// The difficulty value to be mapped. - /// Minimum of the resulting range which will be achieved by a difficulty value of 0. - /// Midpoint of the resulting range which will be achieved by a difficulty value of 5. - /// Maximum of the resulting range which will be achieved by a difficulty value of 10. - /// Value to which the difficulty value maps in the specified range. - public static double MapDifficultyRange(double difficulty, double min, double mid, double max) - { - if (difficulty > 5) - return mid + (max - mid) * (difficulty - 5) / 5; - if (difficulty < 5) - return mid - (mid - min) * (5 - difficulty) / 5; - return mid; - } } /// diff --git a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs index 88cc977f1d..425c6cc5dc 100644 --- a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs @@ -45,7 +45,7 @@ namespace osu.Game.Beatmaps.Formats BeatmapInfo = new BeatmapInfo { Metadata = new BeatmapMetadata(), - BaseDifficulty = new BaseDifficulty(), + Difficulty = new BeatmapDifficulty(), }, }; ParseFile(stream, beatmap); diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 86f75de794..e7ede36b4b 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -144,7 +144,7 @@ namespace osu.Game.Beatmaps.Formats private void handleDifficulty(Beatmap beatmap, string key, string val) { - var difficulty = beatmap.BeatmapInfo.BaseDifficulty; + var difficulty = beatmap.BeatmapInfo.Difficulty; switch (key) { case @"HPDrainRate": diff --git a/osu.Game/Database/BaseDifficulty.cs b/osu.Game/Database/BaseDifficulty.cs index ea7511315f..3db8b29644 100644 --- a/osu.Game/Database/BaseDifficulty.cs +++ b/osu.Game/Database/BaseDifficulty.cs @@ -5,7 +5,7 @@ using SQLite.Net.Attributes; namespace osu.Game.Database { - public class BaseDifficulty + public class BeatmapDifficulty { [PrimaryKey, AutoIncrement] public int ID { get; set; } diff --git a/osu.Game/Database/BeatmapDatabase.cs b/osu.Game/Database/BeatmapDatabase.cs index 871251b882..b3d48c152f 100644 --- a/osu.Game/Database/BeatmapDatabase.cs +++ b/osu.Game/Database/BeatmapDatabase.cs @@ -64,7 +64,7 @@ namespace osu.Game.Database foreach (var i in b.Beatmaps) { if (i.Metadata != null) connection.Delete(i.Metadata); - if (i.BaseDifficulty != null) connection.Delete(i.BaseDifficulty); + if (i.Difficulty != null) connection.Delete(i.Difficulty); connection.Delete(i); } @@ -90,7 +90,7 @@ namespace osu.Game.Database try { conn.CreateTable(); - conn.CreateTable(); + conn.CreateTable(); conn.CreateTable(); conn.CreateTable(); } @@ -112,7 +112,7 @@ namespace osu.Game.Database } connection.DeleteAll(); - connection.DeleteAll(); + connection.DeleteAll(); connection.DeleteAll(); connection.DeleteAll(); } @@ -329,7 +329,7 @@ namespace osu.Game.Database typeof(BeatmapSetInfo), typeof(BeatmapInfo), typeof(BeatmapMetadata), - typeof(BaseDifficulty), + typeof(BeatmapDifficulty), }; public void Update(T record, bool cascade = true) where T : class diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index 017f34726b..5f9c0baee8 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -31,11 +31,11 @@ namespace osu.Game.Database [OneToOne(CascadeOperations = CascadeOperation.All)] public BeatmapMetadata Metadata { get; set; } - [ForeignKey(typeof(BaseDifficulty)), NotNull] + [ForeignKey(typeof(BeatmapDifficulty)), NotNull] public int BaseDifficultyID { get; set; } [OneToOne(CascadeOperations = CascadeOperation.All)] - public BaseDifficulty BaseDifficulty { get; set; } + public BeatmapDifficulty Difficulty { get; set; } public string Path { get; set; } @@ -80,7 +80,7 @@ namespace osu.Game.Database { get { - return starDifficulty < 0 ? (BaseDifficulty?.OverallDifficulty ?? 5) : starDifficulty; + return starDifficulty < 0 ? (Difficulty?.OverallDifficulty ?? 5) : starDifficulty; } set { starDifficulty = value; }