1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 05:22:54 +08:00

Merge pull request #16505 from peppy/remove-base-difficulty-usage

Remove all usage of `BaseDifficulty` (and access `Difficulty` instead)
This commit is contained in:
Dan Balasescu 2022-01-19 13:53:55 +09:00 committed by GitHub
commit 3e5d29ed00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 45 additions and 44 deletions

View File

@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Catch.Tests
{
BeatmapInfo = new BeatmapInfo
{
BaseDifficulty = new BeatmapDifficulty { CircleSize = 6, SliderMultiplier = 3 },
Difficulty = new BeatmapDifficulty { CircleSize = 6, SliderMultiplier = 3 },
Ruleset = ruleset
}
};

View File

@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Catch.Tests
{
BeatmapInfo = new BeatmapInfo
{
BaseDifficulty = new BeatmapDifficulty { CircleSize = 6 },
Difficulty = new BeatmapDifficulty { CircleSize = 6 },
Ruleset = ruleset
}
};

View File

@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Catch.Tests
{
BeatmapInfo = new BeatmapInfo
{
BaseDifficulty = new BeatmapDifficulty { CircleSize = 6 },
Difficulty = new BeatmapDifficulty { CircleSize = 6 },
Ruleset = ruleset
}
};

View File

@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Catch.Tests
HitObjects = new List<HitObject> { new Fruit() },
BeatmapInfo = new BeatmapInfo
{
BaseDifficulty = new BeatmapDifficulty(),
Difficulty = new BeatmapDifficulty(),
Metadata = new BeatmapMetadata
{
Artist = @"Unknown",

View File

@ -63,7 +63,7 @@ namespace osu.Game.Rulesets.Catch.Tests
BeatmapInfo =
{
Ruleset = ruleset,
BaseDifficulty = new BeatmapDifficulty { CircleSize = 3.6f }
Difficulty = new BeatmapDifficulty { CircleSize = 3.6f }
}
};

View File

@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Catch.Tests
{
BeatmapInfo = new BeatmapInfo
{
BaseDifficulty = new BeatmapDifficulty { CircleSize = 5, SliderMultiplier = 2 },
Difficulty = new BeatmapDifficulty { CircleSize = 5, SliderMultiplier = 2 },
Ruleset = ruleset
},
HitObjects = new List<HitObject>

View File

@ -264,7 +264,7 @@ namespace osu.Game.Rulesets.Mania.Tests
},
BeatmapInfo =
{
BaseDifficulty = new BeatmapDifficulty
Difficulty = new BeatmapDifficulty
{
SliderTickRate = 4,
OverallDifficulty = 10,
@ -306,7 +306,7 @@ namespace osu.Game.Rulesets.Mania.Tests
},
BeatmapInfo =
{
BaseDifficulty = new BeatmapDifficulty { SliderTickRate = tick_rate },
Difficulty = new BeatmapDifficulty { SliderTickRate = tick_rate },
Ruleset = new ManiaRuleset().RulesetInfo
},
};
@ -383,7 +383,7 @@ namespace osu.Game.Rulesets.Mania.Tests
},
BeatmapInfo =
{
BaseDifficulty = new BeatmapDifficulty { SliderTickRate = 4 },
Difficulty = new BeatmapDifficulty { SliderTickRate = 4 },
Ruleset = new ManiaRuleset().RulesetInfo
},
};

View File

@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
public static int GetColumnCountForNonConvert(BeatmapInfo beatmapInfo)
{
double roundedCircleSize = Math.Round(beatmapInfo.BaseDifficulty.CircleSize);
double roundedCircleSize = Math.Round(beatmapInfo.Difficulty.CircleSize);
return (int)Math.Max(1, roundedCircleSize);
}

View File

@ -107,7 +107,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor.Checks
var beatmap = new Beatmap<HitObject>
{
HitObjects = hitObjects,
BeatmapInfo = new BeatmapInfo { BaseDifficulty = new BeatmapDifficulty(beatmapDifficulty) }
BeatmapInfo = new BeatmapInfo { Difficulty = new BeatmapDifficulty(beatmapDifficulty) }
};
return new BeatmapVerifierContext(beatmap, new TestWorkingBeatmap(beatmap));

View File

@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
{
BeatmapInfo = new BeatmapInfo
{
BaseDifficulty = new BeatmapDifficulty
Difficulty = new BeatmapDifficulty
{
CircleSize = 8
}

View File

@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Osu.Tests
{
BeatmapInfo = new BeatmapInfo
{
BaseDifficulty = new BeatmapDifficulty { CircleSize = 6 },
Difficulty = new BeatmapDifficulty { CircleSize = 6 },
Ruleset = ruleset
}
};

View File

@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Osu.Tests
{
BeatmapInfo = new BeatmapInfo
{
BaseDifficulty = new BeatmapDifficulty { OverallDifficulty = 10 },
Difficulty = new BeatmapDifficulty { OverallDifficulty = 10 },
Ruleset = ruleset
}
};

View File

@ -358,7 +358,7 @@ namespace osu.Game.Rulesets.Osu.Tests
},
BeatmapInfo =
{
BaseDifficulty = new BeatmapDifficulty { SliderTickRate = 3 },
Difficulty = new BeatmapDifficulty { SliderTickRate = 3 },
Ruleset = new OsuRuleset().RulesetInfo
},
});

View File

@ -364,7 +364,7 @@ namespace osu.Game.Rulesets.Osu.Tests
HitObjects = hitObjects,
BeatmapInfo =
{
BaseDifficulty = new BeatmapDifficulty { SliderTickRate = 3 },
Difficulty = new BeatmapDifficulty { SliderTickRate = 3 },
Ruleset = new OsuRuleset().RulesetInfo
},
});

View File

@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
HitObjects = new List<HitObject> { new Hit { Type = HitType.Centre } },
BeatmapInfo = new BeatmapInfo
{
BaseDifficulty = new BeatmapDifficulty(),
Difficulty = new BeatmapDifficulty(),
Metadata = new BeatmapMetadata
{
Artist = @"Unknown",

View File

@ -158,7 +158,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
HitObjects = new List<HitObject> { new Hit { Type = HitType.Centre } },
BeatmapInfo = new BeatmapInfo
{
BaseDifficulty = new BeatmapDifficulty(),
Difficulty = new BeatmapDifficulty(),
Metadata = new BeatmapMetadata
{
Artist = "Unknown",

View File

@ -128,7 +128,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
{
MD5Hash = md5Hash,
Ruleset = new OsuRuleset().RulesetInfo,
BaseDifficulty = new BeatmapDifficulty()
Difficulty = new BeatmapDifficulty()
}
});
}

View File

@ -18,7 +18,7 @@ namespace osu.Game.Tests.NonVisual.Filtering
{
Ruleset = new RulesetInfo { OnlineID = 0 },
StarRating = 4.0d,
BaseDifficulty = new BeatmapDifficulty
Difficulty = new BeatmapDifficulty
{
ApproachRate = 5.0f,
DrainRate = 3.0f,

View File

@ -133,7 +133,7 @@ namespace osu.Game.Tests.Resources
Hash = Guid.NewGuid().ToString().ComputeMD5Hash(),
Ruleset = rulesetInfo,
Metadata = metadata,
BaseDifficulty = new BeatmapDifficulty
Difficulty = new BeatmapDifficulty
{
OverallDifficulty = diff,
}

View File

@ -29,7 +29,7 @@ namespace osu.Game.Tests.Visual.Gameplay
{
BeatmapInfo = new BeatmapInfo
{
BaseDifficulty = new BeatmapDifficulty { CircleSize = 6, SliderMultiplier = 3 },
Difficulty = new BeatmapDifficulty { CircleSize = 6, SliderMultiplier = 3 },
Ruleset = ruleset
}
};

View File

@ -76,7 +76,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
Length = length,
BPM = bpm,
Metadata = metadata,
BaseDifficulty = new BeatmapDifficulty()
Difficulty = new BeatmapDifficulty()
};
beatmaps.Add(beatmap);

View File

@ -114,14 +114,14 @@ namespace osu.Game.Tests.Visual.Navigation
{
OnlineID = i * 1024,
Metadata = metadata,
BaseDifficulty = new BeatmapDifficulty(),
Difficulty = new BeatmapDifficulty(),
Ruleset = ruleset ?? new OsuRuleset().RulesetInfo
},
new BeatmapInfo
{
OnlineID = i * 2048,
Metadata = metadata,
BaseDifficulty = new BeatmapDifficulty(),
Difficulty = new BeatmapDifficulty(),
Ruleset = ruleset ?? new OsuRuleset().RulesetInfo
},
}

View File

@ -44,7 +44,7 @@ namespace osu.Game.Tests.Visual.Navigation
Author = { Username = "SomeAuthor" },
Title = "import"
},
BaseDifficulty = new BeatmapDifficulty(),
Difficulty = new BeatmapDifficulty(),
Ruleset = new OsuRuleset().RulesetInfo
},
new BeatmapInfo
@ -56,7 +56,7 @@ namespace osu.Game.Tests.Visual.Navigation
Author = { Username = "SomeAuthor" },
Title = "import"
},
BaseDifficulty = new BeatmapDifficulty(),
Difficulty = new BeatmapDifficulty(),
Ruleset = new OsuRuleset().RulesetInfo
},
}

View File

@ -38,7 +38,7 @@ namespace osu.Game.Tests.Visual.SongSelect
private BeatmapInfo exampleBeatmapInfo => new BeatmapInfo
{
Ruleset = rulesets.AvailableRulesets.First(),
BaseDifficulty = new BeatmapDifficulty
Difficulty = new BeatmapDifficulty
{
CircleSize = 7.2f,
DrainRate = 3,
@ -68,7 +68,7 @@ namespace osu.Game.Tests.Visual.SongSelect
AddStep("set beatmap", () => advancedStats.BeatmapInfo = new BeatmapInfo
{
Ruleset = rulesets.GetRuleset(3) ?? throw new InvalidOperationException(),
BaseDifficulty = new BeatmapDifficulty
Difficulty = new BeatmapDifficulty
{
CircleSize = 5,
DrainRate = 4.3f,

View File

@ -216,7 +216,7 @@ namespace osu.Game.Tests.Visual.SongSelect
Ruleset = ruleset,
StarRating = 6,
DifficultyName = $"{ruleset.ShortName}Version",
BaseDifficulty = new BeatmapDifficulty()
Difficulty = new BeatmapDifficulty()
},
HitObjects = objects
};

View File

@ -267,7 +267,7 @@ namespace osu.Game.Tests.Visual.UserInterface
{
BeatmapInfo = new BeatmapInfo
{
BaseDifficulty = new BeatmapDifficulty
Difficulty = new BeatmapDifficulty
{
OverallDifficulty = value,
CircleSize = value,

View File

@ -28,7 +28,7 @@ namespace osu.Game.Beatmaps
difficulty = value;
if (beatmapInfo != null)
beatmapInfo.BaseDifficulty = difficulty.Clone();
beatmapInfo.Difficulty = difficulty.Clone();
}
}
@ -41,8 +41,8 @@ namespace osu.Game.Beatmaps
{
beatmapInfo = value;
if (beatmapInfo?.BaseDifficulty != null)
Difficulty = beatmapInfo.BaseDifficulty.Clone();
if (beatmapInfo?.Difficulty != null)
Difficulty = beatmapInfo.Difficulty.Clone();
}
}
@ -57,7 +57,7 @@ namespace osu.Game.Beatmaps
Author = { Username = @"Unknown Creator" },
},
DifficultyName = @"Normal",
BaseDifficulty = Difficulty,
Difficulty = Difficulty,
};
}

View File

@ -167,6 +167,7 @@ namespace osu.Game.Beatmaps
}
[Ignored]
[Obsolete("Use BeatmapInfo.Difficulty instead.")] // can be removed 20220719
public BeatmapDifficulty BaseDifficulty
{
get => Difficulty;

View File

@ -93,7 +93,7 @@ namespace osu.Game.Beatmaps
{
new BeatmapInfo
{
BaseDifficulty = new BeatmapDifficulty(),
Difficulty = new BeatmapDifficulty(),
Ruleset = ruleset,
Metadata = metadata,
WidescreenStoryboard = true,

View File

@ -58,7 +58,7 @@ namespace osu.Game.Beatmaps
// Warning: The directionality here is important. Changes have to be copied *from* beatmapContent (which comes from editor and is being saved)
// *to* the beatmapInfo (which is a database model and needs to receive values without the taiko slider velocity multiplier for correct operation).
// CopyTo() will undo such adjustments, while CopyFrom() will not.
beatmapContent.Difficulty.CopyTo(beatmapInfo.BaseDifficulty);
beatmapContent.Difficulty.CopyTo(beatmapInfo.Difficulty);
// All changes to metadata are made in the provided beatmapInfo, so this should be copied to the `IBeatmap` before encoding.
beatmapContent.BeatmapInfo = beatmapInfo;

View File

@ -32,7 +32,7 @@ namespace osu.Game.Beatmaps
Title = "no beatmaps available!"
},
BeatmapSet = new BeatmapSetInfo(),
BaseDifficulty = new BeatmapDifficulty
Difficulty = new BeatmapDifficulty
{
DrainRate = 0,
CircleSize = 0,

View File

@ -74,7 +74,7 @@ namespace osu.Game.Rulesets.Mods
return;
}
var difficulty = beatmap.Value.BeatmapInfo.BaseDifficulty;
var difficulty = beatmap.Value.BeatmapInfo.Difficulty;
// generally should always be implemented, else the slider will have a zero default.
if (difficultyBindable.ReadCurrentFromDifficulty == null)

View File

@ -39,10 +39,10 @@ namespace osu.Game.Screens.Select.Carousel
}
match &= !criteria.StarDifficulty.HasFilter || criteria.StarDifficulty.IsInRange(BeatmapInfo.StarRating);
match &= !criteria.ApproachRate.HasFilter || criteria.ApproachRate.IsInRange(BeatmapInfo.BaseDifficulty.ApproachRate);
match &= !criteria.DrainRate.HasFilter || criteria.DrainRate.IsInRange(BeatmapInfo.BaseDifficulty.DrainRate);
match &= !criteria.CircleSize.HasFilter || criteria.CircleSize.IsInRange(BeatmapInfo.BaseDifficulty.CircleSize);
match &= !criteria.OverallDifficulty.HasFilter || criteria.OverallDifficulty.IsInRange(BeatmapInfo.BaseDifficulty.OverallDifficulty);
match &= !criteria.ApproachRate.HasFilter || criteria.ApproachRate.IsInRange(BeatmapInfo.Difficulty.ApproachRate);
match &= !criteria.DrainRate.HasFilter || criteria.DrainRate.IsInRange(BeatmapInfo.Difficulty.DrainRate);
match &= !criteria.CircleSize.HasFilter || criteria.CircleSize.IsInRange(BeatmapInfo.Difficulty.CircleSize);
match &= !criteria.OverallDifficulty.HasFilter || criteria.OverallDifficulty.IsInRange(BeatmapInfo.Difficulty.OverallDifficulty);
match &= !criteria.Length.HasFilter || criteria.Length.IsInRange(BeatmapInfo.Length);
match &= !criteria.BPM.HasFilter || criteria.BPM.IsInRange(BeatmapInfo.BPM);

View File

@ -218,7 +218,7 @@ namespace osu.Game.Stores
}
var decodedInfo = decoded.BeatmapInfo;
var decodedDifficulty = decodedInfo.BaseDifficulty;
var decodedDifficulty = decodedInfo.Difficulty;
var ruleset = realm.All<RulesetInfo>().FirstOrDefault(r => r.OnlineID == decodedInfo.RulesetID);