Rename BaseDifficulty -> Difficulty / BeatmapDifficulty.

This commit is contained in:
smoogipooo 2017-03-16 23:18:02 +09:00
parent 28e006eeb9
commit e0a8c3b1e5
12 changed files with 19 additions and 36 deletions

View File

@ -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",

View File

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

View File

@ -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",

View File

@ -69,7 +69,7 @@ namespace osu.Game.Modes.Osu.Objects
public virtual void SetDefaultsFromBeatmap(Beatmap<OsuHitObject> 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;
}
}
}

View File

@ -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);

View File

@ -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);

View File

@ -51,30 +51,13 @@ namespace osu.Game.Beatmaps
/// <returns>The slider velocity in positional length units.</returns>
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;
}
/// <summary>
/// Maps a difficulty value [0, 10] to a two-piece linear range of values.
/// </summary>
/// <param name="difficulty">The difficulty value to be mapped.</param>
/// <param name="min">Minimum of the resulting range which will be achieved by a difficulty value of 0.</param>
/// <param name="mid">Midpoint of the resulting range which will be achieved by a difficulty value of 5.</param>
/// <param name="max">Maximum of the resulting range which will be achieved by a difficulty value of 10.</param>
/// <returns>Value to which the difficulty value maps in the specified range.</returns>
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;
}
}
/// <summary>

View File

@ -45,7 +45,7 @@ namespace osu.Game.Beatmaps.Formats
BeatmapInfo = new BeatmapInfo
{
Metadata = new BeatmapMetadata(),
BaseDifficulty = new BaseDifficulty(),
Difficulty = new BeatmapDifficulty(),
},
};
ParseFile(stream, beatmap);

View File

@ -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":

View File

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

View File

@ -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<BeatmapMetadata>();
conn.CreateTable<BaseDifficulty>();
conn.CreateTable<BeatmapDifficulty>();
conn.CreateTable<BeatmapSetInfo>();
conn.CreateTable<BeatmapInfo>();
}
@ -112,7 +112,7 @@ namespace osu.Game.Database
}
connection.DeleteAll<BeatmapMetadata>();
connection.DeleteAll<BaseDifficulty>();
connection.DeleteAll<BeatmapDifficulty>();
connection.DeleteAll<BeatmapSetInfo>();
connection.DeleteAll<BeatmapInfo>();
}
@ -329,7 +329,7 @@ namespace osu.Game.Database
typeof(BeatmapSetInfo),
typeof(BeatmapInfo),
typeof(BeatmapMetadata),
typeof(BaseDifficulty),
typeof(BeatmapDifficulty),
};
public void Update<T>(T record, bool cascade = true) where T : class

View File

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