1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 05:32:56 +08:00

Merge pull request #14986 from peppy/fix-wind-mods

Fix rate mods not working if pp counter is displayed
This commit is contained in:
Dean Herbert 2021-10-06 22:29:44 +09:00 committed by GitHub
commit acaef26af7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 4 deletions

View File

@ -110,10 +110,11 @@ namespace osu.Game.Rulesets.Difficulty
private void preProcess(Mod[] mods)
{
playableMods = mods.Select(m => m.DeepClone()).ToArray();
Beatmap = beatmap.GetPlayableBeatmap(ruleset.RulesetInfo, mods);
Beatmap = beatmap.GetPlayableBeatmap(ruleset.RulesetInfo, playableMods);
var track = new TrackVirtual(10000);
mods.OfType<IApplicableToTrack>().ForEach(m => m.ApplyToTrack(track));
playableMods.OfType<IApplicableToTrack>().ForEach(m => m.ApplyToTrack(track));
clockRate = track.Rate;
}

View File

@ -60,6 +60,8 @@ namespace osu.Game.Screens.Play.HUD
Current.Value = DisplayedCount = 0;
}
private Mod[] clonedMods;
[BackgroundDependencyLoader]
private void load(OsuColour colours, BeatmapDifficultyCache difficultyCache)
{
@ -67,8 +69,10 @@ namespace osu.Game.Screens.Play.HUD
if (gameplayState != null)
{
clonedMods = gameplayState.Mods.Select(m => m.DeepClone()).ToArray();
var gameplayWorkingBeatmap = new GameplayWorkingBeatmap(gameplayState.Beatmap);
difficultyCache.GetTimedDifficultyAttributesAsync(gameplayWorkingBeatmap, gameplayState.Ruleset, gameplayState.Mods.ToArray(), loadCancellationSource.Token)
difficultyCache.GetTimedDifficultyAttributesAsync(gameplayWorkingBeatmap, gameplayState.Ruleset, clonedMods, loadCancellationSource.Token)
.ContinueWith(r => Schedule(() =>
{
timedAttributes = r.Result;
@ -116,7 +120,11 @@ namespace osu.Game.Screens.Play.HUD
return;
}
var calculator = gameplayState.Ruleset.CreatePerformanceCalculator(attrib, gameplayState.Score.ScoreInfo);
// awkward but we need to make sure the true mods are not passed to PerformanceCalculator as it makes a mess of track applications.
var scoreInfo = gameplayState.Score.ScoreInfo.DeepClone();
scoreInfo.Mods = clonedMods;
var calculator = gameplayState.Ruleset.CreatePerformanceCalculator(attrib, scoreInfo);
Current.Value = (int)Math.Round(calculator?.Calculate() ?? 0, MidpointRounding.AwayFromZero);
IsValid = true;