2019-01-24 16:43:03 +08:00
|
|
|
|
// 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.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-12-18 08:38:02 +08:00
|
|
|
|
using System;
|
2019-02-12 15:03:28 +08:00
|
|
|
|
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
2021-02-06 12:06:16 +08:00
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2018-05-15 16:36:29 +08:00
|
|
|
|
using osu.Game.Rulesets.Osu.Difficulty.Preprocessing;
|
2019-02-18 13:58:33 +08:00
|
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
2021-09-03 09:39:21 +08:00
|
|
|
|
using osu.Framework.Utils;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-05-15 16:36:29 +08:00
|
|
|
|
namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Represents the skill required to press keys with regards to keeping up with the speed at which objects need to be hit.
|
|
|
|
|
/// </summary>
|
2021-06-15 01:18:49 +08:00
|
|
|
|
public class Speed : OsuStrainSkill
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2019-02-12 15:03:28 +08:00
|
|
|
|
private const double single_spacing_threshold = 125;
|
|
|
|
|
|
2018-12-24 11:41:04 +08:00
|
|
|
|
private const double angle_bonus_begin = 5 * Math.PI / 6;
|
2018-12-08 14:52:12 +08:00
|
|
|
|
private const double pi_over_4 = Math.PI / 4;
|
2018-12-22 08:56:33 +08:00
|
|
|
|
private const double pi_over_2 = Math.PI / 2;
|
2018-12-08 14:52:12 +08:00
|
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
|
protected override double SkillMultiplier => 1400;
|
|
|
|
|
protected override double StrainDecayBase => 0.3;
|
2021-06-16 21:13:46 +08:00
|
|
|
|
protected override int ReducedSectionCount => 5;
|
|
|
|
|
protected override double DifficultyMultiplier => 1.04;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-12-18 08:51:49 +08:00
|
|
|
|
private const double min_speed_bonus = 75; // ~200BPM
|
|
|
|
|
private const double speed_balancing_factor = 40;
|
2021-09-15 17:29:30 +08:00
|
|
|
|
|
|
|
|
|
private readonly double greatWindow;
|
2018-12-18 08:51:49 +08:00
|
|
|
|
|
2021-09-15 17:52:50 +08:00
|
|
|
|
public Speed(Mod[] mods, double hitWindowGreat)
|
2021-02-06 12:06:16 +08:00
|
|
|
|
: base(mods)
|
|
|
|
|
{
|
2021-09-15 17:52:50 +08:00
|
|
|
|
greatWindow = hitWindowGreat;
|
2021-02-06 12:06:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-12 15:03:28 +08:00
|
|
|
|
protected override double StrainValueOf(DifficultyHitObject current)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2019-02-18 13:58:33 +08:00
|
|
|
|
if (current.BaseObject is Spinner)
|
|
|
|
|
return 0;
|
|
|
|
|
|
2019-02-12 15:03:28 +08:00
|
|
|
|
var osuCurrent = (OsuDifficultyHitObject)current;
|
|
|
|
|
|
|
|
|
|
double distance = Math.Min(single_spacing_threshold, osuCurrent.TravelDistance + osuCurrent.JumpDistance);
|
2021-09-15 18:24:48 +08:00
|
|
|
|
double strainTime = osuCurrent.StrainTime;
|
2018-12-18 08:51:49 +08:00
|
|
|
|
|
2021-09-15 18:12:36 +08:00
|
|
|
|
double greatWindowFull = greatWindow * 2;
|
2021-09-15 18:24:48 +08:00
|
|
|
|
double speedWindowRatio = strainTime / greatWindowFull;
|
2021-09-03 09:39:21 +08:00
|
|
|
|
|
2021-09-15 18:12:36 +08:00
|
|
|
|
// Aim to nerf cheesy rhythms (Very fast consecutive doubles with large deltatimes between)
|
2021-09-15 18:24:48 +08:00
|
|
|
|
if (Previous.Count > 0 && strainTime < greatWindowFull && (Previous[0] as OsuDifficultyHitObject).StrainTime > strainTime)
|
2021-08-30 00:19:26 +08:00
|
|
|
|
{
|
2021-09-15 22:40:26 +08:00
|
|
|
|
strainTime = Interpolation.Lerp((Previous[0] as OsuDifficultyHitObject).StrainTime, strainTime, speedWindowRatio);
|
2021-08-30 00:19:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-02 23:48:34 +08:00
|
|
|
|
// Cap deltatime to the OD 300 hitwindow.
|
2021-09-15 19:03:47 +08:00
|
|
|
|
// 0.93 is derived from making sure 260bpm OD8 streams aren't nerfed harshly, whilst 0.92 limits the effect of the cap.
|
2021-09-15 19:36:15 +08:00
|
|
|
|
strainTime /= Math.Clamp((strainTime / greatWindowFull) / 0.93, 0.92, 1);
|
2021-09-02 23:48:34 +08:00
|
|
|
|
|
2021-09-02 23:31:31 +08:00
|
|
|
|
double speedBonus = 1.0;
|
2021-09-15 18:24:48 +08:00
|
|
|
|
if (strainTime < min_speed_bonus)
|
|
|
|
|
speedBonus = 1 + Math.Pow((min_speed_bonus - strainTime) / speed_balancing_factor, 2);
|
2021-09-02 23:31:31 +08:00
|
|
|
|
|
2018-12-08 14:01:26 +08:00
|
|
|
|
double angleBonus = 1.0;
|
2019-04-01 11:16:05 +08:00
|
|
|
|
|
2019-02-12 15:03:28 +08:00
|
|
|
|
if (osuCurrent.Angle != null && osuCurrent.Angle.Value < angle_bonus_begin)
|
2018-12-22 08:31:30 +08:00
|
|
|
|
{
|
2019-02-12 15:03:28 +08:00
|
|
|
|
angleBonus = 1 + Math.Pow(Math.Sin(1.5 * (angle_bonus_begin - osuCurrent.Angle.Value)), 2) / 3.57;
|
2019-04-01 11:16:05 +08:00
|
|
|
|
|
2019-02-12 15:03:28 +08:00
|
|
|
|
if (osuCurrent.Angle.Value < pi_over_2)
|
2018-12-22 08:56:33 +08:00
|
|
|
|
{
|
2018-12-24 11:41:04 +08:00
|
|
|
|
angleBonus = 1.28;
|
2019-02-12 15:03:28 +08:00
|
|
|
|
if (distance < 90 && osuCurrent.Angle.Value < pi_over_4)
|
2018-12-24 11:41:04 +08:00
|
|
|
|
angleBonus += (1 - angleBonus) * Math.Min((90 - distance) / 10, 1);
|
|
|
|
|
else if (distance < 90)
|
2019-02-12 15:03:28 +08:00
|
|
|
|
angleBonus += (1 - angleBonus) * Math.Min((90 - distance) / 10, 1) * Math.Sin((pi_over_2 - osuCurrent.Angle.Value) / pi_over_4);
|
2018-12-22 08:56:33 +08:00
|
|
|
|
}
|
2018-12-22 08:31:30 +08:00
|
|
|
|
}
|
2018-12-08 14:01:26 +08:00
|
|
|
|
|
2021-09-15 17:27:18 +08:00
|
|
|
|
return (1 + (speedBonus - 1) * 0.75)
|
|
|
|
|
* angleBonus
|
|
|
|
|
* (0.95 + speedBonus * Math.Pow(distance / single_spacing_threshold, 3.5))
|
2021-09-15 18:24:48 +08:00
|
|
|
|
/ strainTime;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|