mirror of
https://github.com/ppy/osu
synced 2025-02-19 03:47:01 +00:00
Fixed precision and updated AdvancedStats
This commit is contained in:
parent
a04f9aaef7
commit
26d493986c
@ -204,8 +204,8 @@ namespace osu.Game.Overlays.Mods
|
||||
if (haveRateChangedValues)
|
||||
{
|
||||
return $"One or more values are being adjusted by mods that change speed." +
|
||||
$" (AR {originalDifficulty?.ApproachRate ?? 0}→{adjustedDifficulty?.ApproachRate ?? 0}, " +
|
||||
$"OD {originalDifficulty?.OverallDifficulty ?? 0}→{adjustedDifficulty?.OverallDifficulty ?? 0})";
|
||||
$" (AR {originalDifficulty?.ApproachRate ?? 0}→{(adjustedDifficulty?.ApproachRate ?? 0):0.0#}, " +
|
||||
$"OD {originalDifficulty?.OverallDifficulty ?? 0}→{(adjustedDifficulty?.OverallDifficulty ?? 0):0.0#})";
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
|
@ -46,6 +46,7 @@ namespace osu.Game.Screens.Select.Details
|
||||
private readonly StatisticRow starDifficulty;
|
||||
|
||||
private BeatmapDifficulty originalDifficulty;
|
||||
private BeatmapDifficulty adjustedDifficulty;
|
||||
private bool haveRateChangedValues;
|
||||
|
||||
private IBeatmapInfo beatmapInfo;
|
||||
@ -120,24 +121,25 @@ namespace osu.Game.Screens.Select.Details
|
||||
private void updateStatistics()
|
||||
{
|
||||
IBeatmapDifficultyInfo baseDifficulty = BeatmapInfo?.Difficulty;
|
||||
BeatmapDifficulty adjustedDifficulty = null;
|
||||
|
||||
if (baseDifficulty != null)
|
||||
{
|
||||
adjustedDifficulty = new BeatmapDifficulty(baseDifficulty);
|
||||
originalDifficulty = new BeatmapDifficulty(baseDifficulty);
|
||||
|
||||
foreach (var mod in mods.Value.OfType<IApplicableToDifficulty>())
|
||||
mod.ApplyToDifficulty(adjustedDifficulty);
|
||||
mod.ApplyToDifficulty(originalDifficulty);
|
||||
|
||||
originalDifficulty = adjustedDifficulty;
|
||||
if (gameRuleset != null)
|
||||
{
|
||||
Ruleset ruleset = gameRuleset.Value.CreateInstance();
|
||||
|
||||
Ruleset ruleset = gameRuleset.Value.CreateInstance();
|
||||
double rate = 1;
|
||||
foreach (var mod in mods.Value.OfType<IApplicableToRate>())
|
||||
rate = mod.ApplyToRate(0, rate);
|
||||
adjustedDifficulty = ruleset.GetRateAdjustedDifficulty(adjustedDifficulty, rate);
|
||||
double rate = 1;
|
||||
foreach (var mod in mods.Value.OfType<IApplicableToRate>())
|
||||
rate = mod.ApplyToRate(0, rate);
|
||||
|
||||
haveRateChangedValues = isDifferentArOd(originalDifficulty, adjustedDifficulty);
|
||||
adjustedDifficulty = ruleset.GetRateAdjustedDifficulty(originalDifficulty, rate);
|
||||
haveRateChangedValues = hasRateAdjustedProperties(originalDifficulty, adjustedDifficulty);
|
||||
}
|
||||
}
|
||||
|
||||
switch (BeatmapInfo?.Ruleset.OnlineID)
|
||||
@ -202,31 +204,29 @@ namespace osu.Game.Screens.Select.Details
|
||||
starDifficultyCancellationSource?.Cancel();
|
||||
}
|
||||
|
||||
private bool isDifferentArOd(BeatmapDifficulty a, BeatmapDifficulty b)
|
||||
{
|
||||
if (a == null && b == null) return false;
|
||||
if (a == null || b == null) return true;
|
||||
|
||||
if (!Precision.AlmostEquals(a.ApproachRate, b.ApproachRate, 0.01)) return true;
|
||||
if (!Precision.AlmostEquals(a.OverallDifficulty, b.OverallDifficulty, 0.01)) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public LocalisableString TooltipText
|
||||
{
|
||||
get
|
||||
{
|
||||
if (haveRateChangedValues)
|
||||
{
|
||||
return LocalisableString.Format("Values are changed by mods that change speed.\n" +
|
||||
"Original values: AR = {0}, OD = {1}", originalDifficulty?.ApproachRate ?? 0, originalDifficulty?.OverallDifficulty ?? 0);
|
||||
return $"One or more values are being adjusted by mods that change speed." +
|
||||
$" (AR {originalDifficulty?.ApproachRate ?? 0}→{(adjustedDifficulty?.ApproachRate ?? 0):0.0#}, " +
|
||||
$"OD {originalDifficulty?.OverallDifficulty ?? 0}→{(adjustedDifficulty?.OverallDifficulty ?? 0):0.0#})";
|
||||
}
|
||||
|
||||
return "";
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool hasRateAdjustedProperties(BeatmapDifficulty a, BeatmapDifficulty b)
|
||||
{
|
||||
if (!Precision.AlmostEquals(a.ApproachRate, b.ApproachRate)) return true;
|
||||
if (!Precision.AlmostEquals(a.OverallDifficulty, b.OverallDifficulty)) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public partial class StatisticRow : Container, IHasAccentColour
|
||||
{
|
||||
private const float value_width = 25;
|
||||
|
Loading…
Reference in New Issue
Block a user