osu/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs

44 lines
1.8 KiB
C#
Raw Normal View History

2018-04-13 09:19:50 +00:00
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
2018-12-18 00:38:02 +00:00
using System;
2018-05-15 08:36:29 +00:00
using osu.Game.Rulesets.Osu.Difficulty.Preprocessing;
using osuTK;
2018-04-13 09:19:50 +00:00
2018-05-15 08:36:29 +00:00
namespace osu.Game.Rulesets.Osu.Difficulty.Skills
2018-04-13 09:19:50 +00: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
{
private const double min_angle_bonus = 1.0;
private const double max_angle_bonus = 1.25;
private const double angle_bonus_begin = 3 * Math.PI / 4;
private const double pi_over_4 = Math.PI / 4;
2018-04-13 09:19:50 +00:00
protected override double SkillMultiplier => 1400;
protected override double StrainDecayBase => 0.3;
2018-12-18 00:51:49 +00: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 09:19:50 +00:00
protected override double StrainValueOf(OsuDifficultyHitObject current)
{
double distance = Math.Min(SINGLE_SPACING_THRESHOLD, current.TravelDistance + current.JumpDistance);
2018-12-18 00:51:49 +00: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 06:01:26 +00:00
double angleBonus = 1.0;
if (current.Angle != null)
angleBonus = MathHelper.Clamp((angle_bonus_begin - current.Angle.Value) / pi_over_4 * 0.5 + 1.0, min_angle_bonus, max_angle_bonus);
2018-12-08 06:01:26 +00:00
2018-12-19 04:30:55 +00:00
return speedBonus * angleBonus * (0.95 + Math.Pow(distance / SINGLE_SPACING_THRESHOLD, 4)) / current.StrainTime;
2018-04-13 09:19:50 +00:00
}
}
}