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

throw math.max(N, 1) into straintime

This commit is contained in:
apollo-dw 2021-09-15 11:24:48 +01:00
parent 4017598af0
commit 7f6722e43f
3 changed files with 19 additions and 12 deletions

View File

@ -16,6 +16,11 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
protected new OsuHitObject BaseObject => (OsuHitObject)base.BaseObject; protected new OsuHitObject BaseObject => (OsuHitObject)base.BaseObject;
/// <summary>
/// Milliseconds elapsed since the start time of the previous <see cref="OsuDifficultyHitObject"/>, with a minimum of 1ms to account for simultaneous <see cref="OsuDifficultyHitObject"/>s.
/// </summary>
public double StrainTime { get; private set; }
/// <summary> /// <summary>
/// Normalized distance from the end position of the previous <see cref="OsuDifficultyHitObject"/> to the start position of this <see cref="OsuDifficultyHitObject"/>. /// Normalized distance from the end position of the previous <see cref="OsuDifficultyHitObject"/> to the start position of this <see cref="OsuDifficultyHitObject"/>.
/// </summary> /// </summary>
@ -42,6 +47,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
this.lastObject = (OsuHitObject)lastObject; this.lastObject = (OsuHitObject)lastObject;
setDistances(); setDistances();
// Capped to 1ms to prevent difficulty calculation breaking from simulatenous objects.
StrainTime = Math.Max(DeltaTime, 1);
} }
private void setDistances() private void setDistances()

View File

@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
Math.Max(osuPrevious.JumpDistance - scale, 0) Math.Max(osuPrevious.JumpDistance - scale, 0)
* Math.Pow(Math.Sin(osuCurrent.Angle.Value - angle_bonus_begin), 2) * Math.Pow(Math.Sin(osuCurrent.Angle.Value - angle_bonus_begin), 2)
* Math.Max(osuCurrent.JumpDistance - scale, 0)); * Math.Max(osuCurrent.JumpDistance - scale, 0));
result = 1.4 * applyDiminishingExp(Math.Max(0, angleBonus)) / Math.Max(timing_threshold, osuPrevious.DeltaTime); result = 1.4 * applyDiminishingExp(Math.Max(0, angleBonus)) / Math.Max(timing_threshold, osuPrevious.StrainTime);
} }
} }
@ -54,8 +54,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
double travelDistanceExp = applyDiminishingExp(osuCurrent.TravelDistance); double travelDistanceExp = applyDiminishingExp(osuCurrent.TravelDistance);
return Math.Max( return Math.Max(
result + (jumpDistanceExp + travelDistanceExp + Math.Sqrt(travelDistanceExp * jumpDistanceExp)) / Math.Max(osuCurrent.DeltaTime, timing_threshold), result + (jumpDistanceExp + travelDistanceExp + Math.Sqrt(travelDistanceExp * jumpDistanceExp)) / Math.Max(osuCurrent.StrainTime, timing_threshold),
(Math.Sqrt(travelDistanceExp * jumpDistanceExp) + jumpDistanceExp + travelDistanceExp) / Math.Max(osuCurrent.DeltaTime, 1) (Math.Sqrt(travelDistanceExp * jumpDistanceExp) + jumpDistanceExp + travelDistanceExp) / osuCurrent.StrainTime
); );
} }

View File

@ -47,25 +47,24 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
var osuCurrent = (OsuDifficultyHitObject)current; var osuCurrent = (OsuDifficultyHitObject)current;
double distance = Math.Min(single_spacing_threshold, osuCurrent.TravelDistance + osuCurrent.JumpDistance); double distance = Math.Min(single_spacing_threshold, osuCurrent.TravelDistance + osuCurrent.JumpDistance);
double deltaTime = current.DeltaTime; double strainTime = osuCurrent.StrainTime;
double greatWindowFull = greatWindow * 2; double greatWindowFull = greatWindow * 2;
double speedWindowRatio = deltaTime / greatWindowFull; double speedWindowRatio = strainTime / greatWindowFull;
// Aim to nerf cheesy rhythms (Very fast consecutive doubles with large deltatimes between) // Aim to nerf cheesy rhythms (Very fast consecutive doubles with large deltatimes between)
if (Previous.Count > 0 && deltaTime < greatWindowFull && Previous[0].DeltaTime > deltaTime) if (Previous.Count > 0 && strainTime < greatWindowFull && (Previous[0] as OsuDifficultyHitObject).StrainTime > strainTime)
{ {
strainTime = Interpolation.Lerp(Previous[0].DeltaTime, strainTime, speedWindowRatio);
deltaTime = Interpolation.Lerp(Previous[0].DeltaTime, deltaTime, speedWindowRatio);
} }
// Cap deltatime to the OD 300 hitwindow. // Cap deltatime to the OD 300 hitwindow.
// 0.93 is derived from making sure 260bpm OD8 streams aren't nerfed harshly, // 0.93 is derived from making sure 260bpm OD8 streams aren't nerfed harshly,
deltaTime /= Math.Clamp(speedWindowRatio / 0.93, 0.92, 1); strainTime /= Math.Clamp(speedWindowRatio / 0.93, 0.92, 1);
double speedBonus = 1.0; double speedBonus = 1.0;
if (deltaTime < min_speed_bonus) if (strainTime < min_speed_bonus)
speedBonus = 1 + Math.Pow((min_speed_bonus - deltaTime) / speed_balancing_factor, 2); speedBonus = 1 + Math.Pow((min_speed_bonus - strainTime) / speed_balancing_factor, 2);
double angleBonus = 1.0; double angleBonus = 1.0;
@ -86,7 +85,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
return (1 + (speedBonus - 1) * 0.75) return (1 + (speedBonus - 1) * 0.75)
* angleBonus * angleBonus
* (0.95 + speedBonus * Math.Pow(distance / single_spacing_threshold, 3.5)) * (0.95 + speedBonus * Math.Pow(distance / single_spacing_threshold, 3.5))
/ Math.Max(deltaTime, 1); / strainTime;
} }
} }
} }