Update with vinxis' latest code

This commit is contained in:
smoogipoo 2018-12-24 12:41:04 +09:00
parent c43c15a557
commit 5f0ab0ed7f
2 changed files with 26 additions and 49 deletions

View File

@ -11,12 +11,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
/// </summary>
public class Aim : Skill
{
private const double angle_bonus_begin = 5 * Math.PI / 12;
private const double angle_bonus_begin = Math.PI / 3;
private const double timing_threshold = 107;
private const double min_distance_for_bonus = 90;
private const double angle_threshold = Math.PI / 4;
private static readonly double sin_angle_threshold = Math.Sin(angle_threshold);
protected override double SkillMultiplier => 26.25;
protected override double StrainDecayBase => 0.15;
@ -25,37 +21,30 @@ protected override double StrainValueOf(OsuDifficultyHitObject current)
{
double result = 0;
const double scale = 90;
if (Previous.Count > 0)
{
if (current.Angle != null && current.Angle.Value > angle_bonus_begin)
{
var sinDiffAngle = Math.Sin(current.Angle.Value - angle_bonus_begin);
var angleBonus = Math.Sqrt
(
Math.Max(0, Previous[0].JumpDistance + 8 * Previous[0].TravelDistance - min_distance_for_bonus)
* Math.Min
(
sinDiffAngle,
sin_angle_threshold
)
* Math.Max(0, current.JumpDistance - min_distance_for_bonus)
* Math.Min
(
sinDiffAngle,
sin_angle_threshold
)
);
result = 2 * Math.Pow(Math.Max(0, angleBonus), 0.99) / Math.Max(Previous[0].StrainTime, timing_threshold);
var angleBonus = Math.Sqrt(
Math.Max(Previous[0].JumpDistance - scale, 0)
* Math.Pow(Math.Sin(current.Angle.Value - angle_bonus_begin), 2)
* Math.Max(current.JumpDistance - scale, 0));
result = 1.5 * Math.Pow(Math.Max(0, angleBonus), 0.99) / Math.Max(timing_threshold, Previous[0].StrainTime);
}
}
return Math.Max
(
result + (Math.Pow(current.TravelDistance, 0.99) + Math.Pow(current.JumpDistance, 0.99)) / Math.Max(current.StrainTime, timing_threshold),
(Math.Pow(current.TravelDistance, 0.99) + Math.Pow(current.JumpDistance, 0.99)) / current.StrainTime
);
return Math.Max(
result + (
Math.Pow(current.JumpDistance, 0.99)
+ Math.Pow(current.TravelDistance, 0.99)
+ Math.Sqrt(Math.Pow(current.TravelDistance, 0.99) * Math.Pow(current.JumpDistance, 0.99)))
/ Math.Max(current.StrainTime, timing_threshold),
(Math.Sqrt(Math.Pow(current.TravelDistance, 0.99) * Math.Pow(current.JumpDistance, 0.99))
+ Math.Pow(current.JumpDistance, 0.99)
+ Math.Pow(current.TravelDistance, 0.99))
/ current.StrainTime);
}
}
}

View File

@ -11,12 +11,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
/// </summary>
public class Speed : Skill
{
private const double angle_bonus_begin = 3 * Math.PI / 4;
private const double angle_bonus_begin = 5 * Math.PI / 6;
private const double pi_over_4 = Math.PI / 4;
private const double pi_over_2 = Math.PI / 2;
private const double max_distance_for_bonus = 90;
private static readonly double sin_pi_over_4 = Math.Sin(pi_over_4);
protected override double SkillMultiplier => 1400;
protected override double StrainDecayBase => 0.3;
@ -37,23 +34,14 @@ protected override double StrainValueOf(OsuDifficultyHitObject current)
double angleBonus = 1.0;
if (current.Angle != null && current.Angle.Value < angle_bonus_begin)
{
angleBonus = 1 + Math.Min(Math.Sin(angle_bonus_begin - current.Angle.Value), sin_pi_over_4) / 2.5;
if (distance < max_distance_for_bonus)
angleBonus = 1 + Math.Pow(Math.Sin(1.5 * (angle_bonus_begin - current.Angle.Value)), 2) / 3.57;
if (current.Angle.Value < pi_over_2)
{
if (current.Angle.Value < pi_over_4)
{
angleBonus +=
(1 - angleBonus)
* Math.Min((max_distance_for_bonus - distance) / 10, 1);
}
else if (current.Angle.Value < pi_over_2)
{
angleBonus +=
(1 - angleBonus)
* Math.Min((max_distance_for_bonus - distance) / 10, 1)
* Math.Sin((pi_over_2 - current.Angle.Value) / pi_over_4);
}
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);
}
}