1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 20:22:55 +08:00

Fix taiko weird difficulty multiplier failing on double convert

This commit is contained in:
Dean Herbert 2021-10-06 15:10:42 +09:00
parent b339c149d8
commit 0ab8dcc2a0
3 changed files with 43 additions and 21 deletions

View File

@ -10,6 +10,7 @@ using System.Collections.Generic;
using System.Linq;
using osu.Framework.Utils;
using System.Threading;
using JetBrains.Annotations;
using osu.Game.Audio;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Beatmaps.Formats;
@ -49,7 +50,6 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
if (!(original.Difficulty is TaikoMutliplierAppliedDifficulty))
{
// Rewrite the beatmap info to add the slider velocity multiplier
original.BeatmapInfo = original.BeatmapInfo.Clone();
original.Difficulty = new TaikoMutliplierAppliedDifficulty(original.Difficulty);
}
@ -196,9 +196,30 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
public TaikoMutliplierAppliedDifficulty(IBeatmapDifficultyInfo difficulty)
{
CopyFrom(difficulty);
SliderMultiplier *= LegacyBeatmapEncoder.LEGACY_TAIKO_VELOCITY_MULTIPLIER;
}
[UsedImplicitly]
public TaikoMutliplierAppliedDifficulty()
{
}
#region Overrides of BeatmapDifficulty
public override void CopyTo(BeatmapDifficulty other)
{
base.CopyTo(other);
if (!(other is TaikoMutliplierAppliedDifficulty))
SliderMultiplier /= LegacyBeatmapEncoder.LEGACY_TAIKO_VELOCITY_MULTIPLIER;
}
public override void CopyFrom(IBeatmapDifficultyInfo other)
{
base.CopyFrom(other);
if (!(other is TaikoMutliplierAppliedDifficulty))
SliderMultiplier *= LegacyBeatmapEncoder.LEGACY_TAIKO_VELOCITY_MULTIPLIER;
}
#endregion
}
}
}

View File

@ -28,7 +28,7 @@ namespace osu.Game.Beatmaps
difficulty = value;
if (beatmapInfo != null)
beatmapInfo.BaseDifficulty = new BeatmapDifficulty(difficulty);
beatmapInfo.BaseDifficulty = difficulty.Clone();
}
}
@ -41,8 +41,8 @@ namespace osu.Game.Beatmaps
{
beatmapInfo = value;
if (beatmapInfo != null)
Difficulty = new BeatmapDifficulty(beatmapInfo.BaseDifficulty);
if (beatmapInfo?.BaseDifficulty != null)
Difficulty = beatmapInfo.BaseDifficulty.Clone();
}
}

View File

@ -1,6 +1,7 @@
// 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 System;
using osu.Game.Database;
namespace osu.Game.Beatmaps
@ -43,31 +44,31 @@ namespace osu.Game.Beatmaps
/// </summary>
public BeatmapDifficulty Clone()
{
var diff = new BeatmapDifficulty();
var diff = (BeatmapDifficulty)Activator.CreateInstance(GetType());
CopyTo(diff);
return diff;
}
public void CopyFrom(IBeatmapDifficultyInfo difficulty)
public virtual void CopyFrom(IBeatmapDifficultyInfo other)
{
ApproachRate = difficulty.ApproachRate;
DrainRate = difficulty.DrainRate;
CircleSize = difficulty.CircleSize;
OverallDifficulty = difficulty.OverallDifficulty;
ApproachRate = other.ApproachRate;
DrainRate = other.DrainRate;
CircleSize = other.CircleSize;
OverallDifficulty = other.OverallDifficulty;
SliderMultiplier = difficulty.SliderMultiplier;
SliderTickRate = difficulty.SliderTickRate;
SliderMultiplier = other.SliderMultiplier;
SliderTickRate = other.SliderTickRate;
}
public void CopyTo(BeatmapDifficulty difficulty)
public virtual void CopyTo(BeatmapDifficulty other)
{
difficulty.ApproachRate = ApproachRate;
difficulty.DrainRate = DrainRate;
difficulty.CircleSize = CircleSize;
difficulty.OverallDifficulty = OverallDifficulty;
other.ApproachRate = ApproachRate;
other.DrainRate = DrainRate;
other.CircleSize = CircleSize;
other.OverallDifficulty = OverallDifficulty;
difficulty.SliderMultiplier = SliderMultiplier;
difficulty.SliderTickRate = SliderTickRate;
other.SliderMultiplier = SliderMultiplier;
other.SliderTickRate = SliderTickRate;
}
}
}