1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 16:52:54 +08:00

Fix bug causing the star rating to change when Random is enabled

This commit is contained in:
Pasi4K5 2021-04-26 22:26:13 +02:00
parent 19fc224348
commit 1dfe028c02
4 changed files with 27 additions and 1 deletions

View File

@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Osu.Mods
/// <summary>
/// Mod that randomises the positions of the <see cref="HitObject"/>s
/// </summary>
public class OsuModRandom : ModRandom, IApplicableToBeatmap
public class OsuModRandom : ModRandom, IApplicableToBeatmapKeepStarRating
{
public override string Description => "It never gets boring!";
public override bool Ranked => false;

View File

@ -32,6 +32,11 @@ namespace osu.Game.Beatmaps
public readonly BeatmapMetadata Metadata;
/// <summary>
/// Only if this is set to true, changes made by mods that implement <see cref="IApplicableToBeatmapKeepStarRating"/> will be applied.
/// </summary>
public bool ApplyChangesToBeatmap;
protected AudioManager AudioManager { get; }
protected WorkingBeatmap(BeatmapInfo beatmapInfo, AudioManager audioManager)
@ -166,10 +171,15 @@ namespace osu.Game.Beatmaps
foreach (var mod in mods.OfType<IApplicableToBeatmap>())
{
if (mod is IApplicableToBeatmapKeepStarRating && !ApplyChangesToBeatmap)
continue;
cancellationSource.Token.ThrowIfCancellationRequested();
mod.ApplyToBeatmap(converted);
}
ApplyChangesToBeatmap = false;
return converted;
}
}

View File

@ -0,0 +1,14 @@
// 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.
using osu.Game.Beatmaps;
namespace osu.Game.Rulesets.Mods
{
/// <summary>
/// Interface for a <see cref="Mod"/> that applies changes to a <see cref="Beatmap"/> after conversion and post-processing has completed without changing its difficulty
/// </summary>
public interface IApplicableToBeatmapKeepStarRating : IApplicableToBeatmap
{
}
}

View File

@ -455,6 +455,8 @@ namespace osu.Game.Screens.Play
rulesetInfo = Ruleset.Value ?? Beatmap.Value.BeatmapInfo.Ruleset;
ruleset = rulesetInfo.CreateInstance();
Beatmap.Value.ApplyChangesToBeatmap = true;
try
{
playable = Beatmap.Value.GetPlayableBeatmap(ruleset.RulesetInfo, Mods.Value);