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;
|
2018-05-15 16:36:29 +08:00
|
|
|
|
using osu.Game.Rulesets.Osu.Difficulty.Preprocessing;
|
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>
|
|
|
|
|
public class Speed : Skill
|
|
|
|
|
{
|
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;
|
|
|
|
|
|
2018-12-18 08:51:49 +08:00
|
|
|
|
private const double min_speed_bonus = 75; // ~200BPM
|
|
|
|
|
private const double max_speed_bonus = 45; // ~330BPM
|
|
|
|
|
private const double speed_balancing_factor = 40;
|
|
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
|
protected override double StrainValueOf(OsuDifficultyHitObject current)
|
|
|
|
|
{
|
2018-12-18 09:29:36 +08:00
|
|
|
|
double distance = Math.Min(SINGLE_SPACING_THRESHOLD, current.TravelDistance + current.JumpDistance);
|
2018-12-18 08:51:49 +08:00
|
|
|
|
double deltaTime = Math.Max(max_speed_bonus, current.DeltaTime);
|
|
|
|
|
|
|
|
|
|
double speedBonus = 1.0;
|
|
|
|
|
if (deltaTime < min_speed_bonus)
|
|
|
|
|
speedBonus = 1 + Math.Pow((min_speed_bonus - deltaTime) / speed_balancing_factor, 2);
|
|
|
|
|
|
2018-12-08 14:01:26 +08:00
|
|
|
|
double angleBonus = 1.0;
|
2018-12-22 08:31:30 +08:00
|
|
|
|
if (current.Angle != null && current.Angle.Value < angle_bonus_begin)
|
|
|
|
|
{
|
2018-12-24 11:41:04 +08:00
|
|
|
|
angleBonus = 1 + Math.Pow(Math.Sin(1.5 * (angle_bonus_begin - current.Angle.Value)), 2) / 3.57;
|
|
|
|
|
if (current.Angle.Value < pi_over_2)
|
2018-12-22 08:56:33 +08:00
|
|
|
|
{
|
2018-12-24 11:41:04 +08:00
|
|
|
|
angleBonus = 1.28;
|
|
|
|
|
if (distance < 90 && current.Angle.Value < pi_over_4)
|
|
|
|
|
angleBonus += (1 - angleBonus) * Math.Min((90 - distance) / 10, 1);
|
|
|
|
|
else if (distance < 90)
|
|
|
|
|
angleBonus += (1 - angleBonus) * Math.Min((90 - distance) / 10, 1) * Math.Sin((pi_over_2 - current.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
|
|
|
|
|
2019-01-29 15:35:20 +08:00
|
|
|
|
return (1 + (speedBonus - 1) * 0.75) * angleBonus * (0.95 + speedBonus * Math.Pow(distance / SINGLE_SPACING_THRESHOLD, 3.5)) / current.StrainTime;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|