1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-17 22:52:54 +08:00
osu-lazer/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs
Samuel Cattini-Schultz 442347df8e Fix clockrate adjusted difficulty calculations bug in strain decay
When starting a new section, the starting strain value was calculated using the unadjusted timing value, meaning decay curves were essentially being stretched or squashed according to the clockrate.

This caused incorrect strain peaks for any section where the peak occurs at the start of the section (none of the objects in the section added enough strain after decay to exceed the starting strain).

This bug caused star ratings with clockrates above 1 to be lower than they should and below 1 to be higher than they should.
2021-02-20 20:23:49 +11:00

48 lines
1.9 KiB
C#

// 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.Rulesets.Objects;
namespace osu.Game.Rulesets.Difficulty.Preprocessing
{
/// <summary>
/// Wraps a <see cref="HitObject"/> and provides additional information to be used for difficulty calculation.
/// </summary>
public class DifficultyHitObject
{
/// <summary>
/// The <see cref="HitObject"/> this <see cref="DifficultyHitObject"/> wraps.
/// </summary>
public readonly HitObject BaseObject;
/// <summary>
/// The last <see cref="HitObject"/> which occurs before <see cref="BaseObject"/>.
/// </summary>
public readonly HitObject LastObject;
/// <summary>
/// Amount of time elapsed between <see cref="BaseObject"/> and <see cref="LastObject"/>.
/// </summary>
public readonly double DeltaTime;
/// <summary>
/// Start time of <see cref="BaseObject"/>.
/// </summary>
public readonly double StartTime;
/// <summary>
/// Creates a new <see cref="DifficultyHitObject"/>.
/// </summary>
/// <param name="hitObject">The <see cref="HitObject"/> which this <see cref="DifficultyHitObject"/> wraps.</param>
/// <param name="lastObject">The last <see cref="HitObject"/> which occurs before <paramref name="hitObject"/> in the beatmap.</param>
/// <param name="clockRate">The rate at which the gameplay clock is run at.</param>
public DifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate)
{
BaseObject = hitObject;
LastObject = lastObject;
DeltaTime = (hitObject.StartTime - lastObject.StartTime) / clockRate;
StartTime = hitObject.StartTime / clockRate;
}
}
}