1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-12 05:27:40 +08:00
osu-lazer/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs

46 lines
1.7 KiB
C#
Raw Normal View History

2018-04-13 17:19:50 +08: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 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
{
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)
{
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;
if (current.Angle != null)
{
double angle = current.Angle.Value * 180 / Math.PI;
if (angle < 135)
angleBonus = (135 - angle / 45) * 0.25 + 1.0;
else if (angle <= 90)
angleBonus = 1.25;
}
return angleBonus * (0.95 + Math.Pow(distance / SINGLE_SPACING_THRESHOLD, 4)) / current.StrainTime;
2018-04-13 17:19:50 +08:00
}
}
}