1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-23 22:54:56 +08:00

Merge pull request #4496 from smoogipoo/reinstantiate-mods

Fix mods being reused for difficulty calculation
This commit is contained in:
Dean Herbert
2019-03-20 19:10:52 +09:00
committed by GitHub
Unverified
2 changed files with 7 additions and 0 deletions
@@ -37,6 +37,8 @@ namespace osu.Game.Rulesets.Difficulty
/// <returns>A structure describing the difficulty of the beatmap.</returns>
public DifficultyAttributes Calculate(params Mod[] mods)
{
mods = mods.Select(m => m.CreateCopy()).ToArray();
beatmap.Mods.Value = mods;
IBeatmap playableBeatmap = beatmap.GetPlayableBeatmap(ruleset.RulesetInfo);
+5
View File
@@ -65,5 +65,10 @@ namespace osu.Game.Rulesets.Mods
/// </summary>
[JsonIgnore]
public virtual Type[] IncompatibleMods => new Type[] { };
/// <summary>
/// Creates a copy of this <see cref="Mod"/> initialised to a default state.
/// </summary>
public virtual Mod CreateCopy() => (Mod)Activator.CreateInstance(GetType());
}
}