mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 10:02:59 +08:00
Move MapDifficultyRange into BaseDifficulty.
This commit is contained in:
parent
60fc782e93
commit
28e006eeb9
@ -15,6 +15,23 @@ namespace osu.Game.Database
|
|||||||
public float ApproachRate { get; set; }
|
public float ApproachRate { get; set; }
|
||||||
public float SliderMultiplier { get; set; }
|
public float SliderMultiplier { get; set; }
|
||||||
public float SliderTickRate { get; set; }
|
public float SliderTickRate { get; set; }
|
||||||
|
|
||||||
|
/// <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 DifficultyRange(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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user