2019-01-24 08:43:03 +00:00
|
|
|
|
// 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.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2021-10-06 06:10:42 +00:00
|
|
|
|
using System;
|
2021-12-14 15:31:35 +00:00
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
2018-11-28 04:19:23 +00:00
|
|
|
|
using osu.Game.Database;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Beatmaps
|
|
|
|
|
{
|
2021-12-14 15:31:35 +00:00
|
|
|
|
[Table(@"BeatmapDifficulty")]
|
2021-11-19 09:59:14 +00:00
|
|
|
|
public class EFBeatmapDifficulty : IHasPrimaryKey, IBeatmapDifficultyInfo
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The default value used for all difficulty settings except <see cref="SliderMultiplier"/> and <see cref="SliderTickRate"/>.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public const float DEFAULT_DIFFICULTY = 5;
|
|
|
|
|
|
|
|
|
|
public int ID { get; set; }
|
|
|
|
|
|
2021-11-19 12:53:40 +00:00
|
|
|
|
public bool IsManaged => ID > 0;
|
|
|
|
|
|
2018-04-13 09:19:50 +00:00
|
|
|
|
public float DrainRate { get; set; } = DEFAULT_DIFFICULTY;
|
|
|
|
|
public float CircleSize { get; set; } = DEFAULT_DIFFICULTY;
|
|
|
|
|
public float OverallDifficulty { get; set; } = DEFAULT_DIFFICULTY;
|
|
|
|
|
|
|
|
|
|
private float? approachRate;
|
|
|
|
|
|
2021-11-19 09:59:14 +00:00
|
|
|
|
public EFBeatmapDifficulty()
|
2021-10-01 05:56:42 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-19 09:59:14 +00:00
|
|
|
|
public EFBeatmapDifficulty(IBeatmapDifficultyInfo source)
|
2021-10-01 05:56:42 +00:00
|
|
|
|
{
|
|
|
|
|
CopyFrom(source);
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-13 09:19:50 +00:00
|
|
|
|
public float ApproachRate
|
|
|
|
|
{
|
|
|
|
|
get => approachRate ?? OverallDifficulty;
|
|
|
|
|
set => approachRate = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public double SliderMultiplier { get; set; } = 1;
|
|
|
|
|
public double SliderTickRate { get; set; } = 1;
|
|
|
|
|
|
2018-05-17 03:59:48 +00:00
|
|
|
|
/// <summary>
|
2021-11-19 09:59:14 +00:00
|
|
|
|
/// Returns a shallow-clone of this <see cref="EFBeatmapDifficulty"/>.
|
2018-05-17 03:59:48 +00:00
|
|
|
|
/// </summary>
|
2021-11-19 09:59:14 +00:00
|
|
|
|
public EFBeatmapDifficulty Clone()
|
2021-08-30 06:30:17 +00:00
|
|
|
|
{
|
2021-11-19 09:59:14 +00:00
|
|
|
|
var diff = (EFBeatmapDifficulty)Activator.CreateInstance(GetType());
|
2021-08-30 06:30:17 +00:00
|
|
|
|
CopyTo(diff);
|
|
|
|
|
return diff;
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-06 06:10:42 +00:00
|
|
|
|
public virtual void CopyFrom(IBeatmapDifficultyInfo other)
|
2021-10-01 05:56:42 +00:00
|
|
|
|
{
|
2021-10-06 06:10:42 +00:00
|
|
|
|
ApproachRate = other.ApproachRate;
|
|
|
|
|
DrainRate = other.DrainRate;
|
|
|
|
|
CircleSize = other.CircleSize;
|
|
|
|
|
OverallDifficulty = other.OverallDifficulty;
|
2021-10-01 05:56:42 +00:00
|
|
|
|
|
2021-10-06 06:10:42 +00:00
|
|
|
|
SliderMultiplier = other.SliderMultiplier;
|
|
|
|
|
SliderTickRate = other.SliderTickRate;
|
2021-10-01 05:56:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-19 09:59:14 +00:00
|
|
|
|
public virtual void CopyTo(EFBeatmapDifficulty other)
|
2021-08-30 06:30:17 +00:00
|
|
|
|
{
|
2021-10-06 06:10:42 +00:00
|
|
|
|
other.ApproachRate = ApproachRate;
|
|
|
|
|
other.DrainRate = DrainRate;
|
|
|
|
|
other.CircleSize = CircleSize;
|
|
|
|
|
other.OverallDifficulty = OverallDifficulty;
|
2021-08-30 06:30:17 +00:00
|
|
|
|
|
2021-10-06 06:10:42 +00:00
|
|
|
|
other.SliderMultiplier = SliderMultiplier;
|
|
|
|
|
other.SliderTickRate = SliderTickRate;
|
2021-08-30 06:30:17 +00:00
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|