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:
parent
19fc224348
commit
1dfe028c02
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
14
osu.Game/Rulesets/Mods/IApplicableToBeatmapKeepStarRating.cs
Normal file
14
osu.Game/Rulesets/Mods/IApplicableToBeatmapKeepStarRating.cs
Normal 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
|
||||
{
|
||||
}
|
||||
}
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user