Skip to content

Commit

Permalink
New skills
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDark98 committed Jan 13, 2025
1 parent 40bea3f commit cca3ba6
Show file tree
Hide file tree
Showing 16 changed files with 401 additions and 210 deletions.
18 changes: 4 additions & 14 deletions osu.Game.Rulesets.Osu/Difficulty/Evaluators/AimEvaluator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.

using System;
using System.Collections.Generic;
using osu.Game.Rulesets.Difficulty.Preprocessing;
using osu.Game.Rulesets.Difficulty.Utils;
using osu.Game.Rulesets.Mods;
Expand All @@ -27,7 +28,7 @@ public static class AimEvaluator
/// <item><description>and slider difficulty.</description></item>
/// </list>
/// </summary>
public static double EvaluateDifficultyOf(Mod[] mods, DifficultyHitObject current, bool withSliderTravelDistance)
public static double EvaluateDifficultyOf(IReadOnlyList<Mod> mods, DifficultyHitObject current)
{
if (current.BaseObject is Spinner || current.Index <= 1 || current.Previous(0).BaseObject is Spinner)
return 0;
Expand All @@ -43,7 +44,7 @@ public static double EvaluateDifficultyOf(Mod[] mods, DifficultyHitObject curren
double currVelocity = osuCurrObj.LazyJumpDistance / osuCurrObj.StrainTime;

// But if the last object is a slider, then we extend the travel velocity through the slider into the current object.
if (osuLastObj.BaseObject is Slider && withSliderTravelDistance)
if (osuLastObj.BaseObject is Slider)
{
double travelVelocity = osuLastObj.TravelDistance / osuLastObj.TravelTime; // calculate the slider velocity from slider head to slider end.
double movementVelocity = osuCurrObj.MinimumJumpDistance / osuCurrObj.MinimumJumpTime; // calculate the movement velocity from slider end to current object
Expand All @@ -54,7 +55,7 @@ public static double EvaluateDifficultyOf(Mod[] mods, DifficultyHitObject curren
// As above, do the same for the previous hitobject.
double prevVelocity = osuLastObj.LazyJumpDistance / osuLastObj.StrainTime;

if (osuLastLastObj.BaseObject is Slider && withSliderTravelDistance)
if (osuLastLastObj.BaseObject is Slider)
{
double travelVelocity = osuLastLastObj.TravelDistance / osuLastLastObj.TravelTime;
double movementVelocity = osuLastObj.MinimumJumpDistance / osuLastObj.MinimumJumpTime;
Expand All @@ -64,7 +65,6 @@ public static double EvaluateDifficultyOf(Mod[] mods, DifficultyHitObject curren

double wideAngleBonus = 0;
double acuteAngleBonus = 0;
double sliderBonus = 0;
double velocityChangeBonus = 0;
double wiggleBonus = 0;

Expand Down Expand Up @@ -125,21 +125,11 @@ public static double EvaluateDifficultyOf(Mod[] mods, DifficultyHitObject curren
velocityChangeBonus *= Math.Pow(Math.Min(osuCurrObj.StrainTime, osuLastObj.StrainTime) / Math.Max(osuCurrObj.StrainTime, osuLastObj.StrainTime), 2);
}

if (osuLastObj.BaseObject is Slider)
{
// Reward sliders based on velocity.
sliderBonus = osuLastObj.TravelDistance / osuLastObj.TravelTime;
}

aimStrain += wiggleBonus * wiggle_multiplier;

// Add in acute angle bonus or wide angle bonus + velocity change bonus, whichever is larger.
aimStrain += Math.Max(acuteAngleBonus * acute_angle_multiplier, wideAngleBonus * wide_angle_multiplier + velocityChangeBonus * velocity_change_multiplier);

// Add in additional slider velocity bonus.
if (withSliderTravelDistance)
aimStrain += sliderBonus * slider_multiplier;

return aimStrain;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.

using System;
using System.Collections.Generic;
using osu.Game.Rulesets.Difficulty.Preprocessing;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Difficulty.Preprocessing;
Expand Down Expand Up @@ -29,7 +30,7 @@ public static class FlashlightEvaluator
/// <item><description>and whether the hidden mod is enabled.</description></item>
/// </list>
/// </summary>
public static double EvaluateDifficultyOf(Mod[] mods, DifficultyHitObject current, bool hidden)
public static double EvaluateDifficultyOf(IReadOnlyList<Mod> mods, DifficultyHitObject current)
{
if (current.BaseObject is Spinner)
return 0;
Expand Down Expand Up @@ -64,12 +65,12 @@ public static double EvaluateDifficultyOf(Mod[] mods, DifficultyHitObject curren
smallDistNerf = Math.Min(1.0, jumpDistance / 75.0);

// We also want to nerf stacks so that only the first object of the stack is accounted for.
double stackNerf = Math.Min(1.0, (currentObj.LazyJumpDistance / scalingFactor) / 25.0);
//double stackNerf = Math.Min(1.0, (currentObj.LazyJumpDistance / scalingFactor) / 25.0);

// Bonus based on how visible the object is.
double opacityBonus = 1.0 + max_opacity_bonus * (1.0 - osuCurrent.OpacityAt(currentHitObject.StartTime, hidden));
//double opacityBonus = 1.0 + max_opacity_bonus * (1.0 - osuCurrent.OpacityAt(currentHitObject.StartTime, hidden));

result += stackNerf * opacityBonus * scalingFactor * jumpDistance / cumulativeStrainTime;
//result += stackNerf * opacityBonus * scalingFactor * jumpDistance / cumulativeStrainTime;

if (currentObj.Angle != null && osuCurrent.Angle != null)
{
Expand All @@ -85,8 +86,8 @@ public static double EvaluateDifficultyOf(Mod[] mods, DifficultyHitObject curren
result = Math.Pow(smallDistNerf * result, 2.0);

// Additional bonus for Hidden due to there being no approach circles.
if (hidden)
result *= 1.0 + hidden_bonus;
//if (hidden)
// result *= 1.0 + hidden_bonus;

// Nerf patterns with repeated angles.
result *= min_angle_multiplier + (1.0 - min_angle_multiplier) / (angleRepeatCount + 1.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static class RhythmEvaluator
/// <summary>
/// Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current <see cref="OsuDifficultyHitObject"/>.
/// </summary>
public static double EvaluateDifficultyOf(Mod[] mods, DifficultyHitObject current)
public static double EvaluateDifficultyOf(IReadOnlyList<Mod> mods, DifficultyHitObject current)
{
if (current.BaseObject is Spinner)
return 0;
Expand Down
140 changes: 140 additions & 0 deletions osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System;
using System.Collections.Generic;
using osu.Game.Rulesets.Difficulty.Preprocessing;
using osu.Game.Rulesets.Difficulty.Utils;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Difficulty.Preprocessing;
using osu.Game.Rulesets.Osu.Objects;

namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators
{
public static class AimEvaluator

Check failure on line 14 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, MultiThreaded)

The namespace 'osu.Game.Rulesets.Osu.Difficulty.Evaluators' already contains a definition for 'AimEvaluator'

Check failure on line 14 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, MultiThreaded)

The namespace 'osu.Game.Rulesets.Osu.Difficulty.Evaluators' already contains a definition for 'AimEvaluator'

Check failure on line 14 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, SingleThread)

The namespace 'osu.Game.Rulesets.Osu.Difficulty.Evaluators' already contains a definition for 'AimEvaluator'

Check failure on line 14 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, SingleThread)

The namespace 'osu.Game.Rulesets.Osu.Difficulty.Evaluators' already contains a definition for 'AimEvaluator'

Check failure on line 14 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Code Quality

The namespace 'osu.Game.Rulesets.Osu.Difficulty.Evaluators' already contains a definition for 'AimEvaluator'

Check failure on line 14 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Code Quality

The namespace 'osu.Game.Rulesets.Osu.Difficulty.Evaluators' already contains a definition for 'AimEvaluator'

Check failure on line 14 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Build only (iOS)

The namespace 'osu.Game.Rulesets.Osu.Difficulty.Evaluators' already contains a definition for 'AimEvaluator'

Check failure on line 14 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Build only (iOS)

The namespace 'osu.Game.Rulesets.Osu.Difficulty.Evaluators' already contains a definition for 'AimEvaluator'

Check failure on line 14 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, SingleThread)

The namespace 'osu.Game.Rulesets.Osu.Difficulty.Evaluators' already contains a definition for 'AimEvaluator'

Check failure on line 14 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, SingleThread)

The namespace 'osu.Game.Rulesets.Osu.Difficulty.Evaluators' already contains a definition for 'AimEvaluator'

Check failure on line 14 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, MultiThreaded)

The namespace 'osu.Game.Rulesets.Osu.Difficulty.Evaluators' already contains a definition for 'AimEvaluator'

Check failure on line 14 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, MultiThreaded)

The namespace 'osu.Game.Rulesets.Osu.Difficulty.Evaluators' already contains a definition for 'AimEvaluator'

Check failure on line 14 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Build only (Android)

The namespace 'osu.Game.Rulesets.Osu.Difficulty.Evaluators' already contains a definition for 'AimEvaluator'

Check failure on line 14 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Build only (Android)

The namespace 'osu.Game.Rulesets.Osu.Difficulty.Evaluators' already contains a definition for 'AimEvaluator'
{
private const double wide_angle_multiplier = 1.5;
private const double acute_angle_multiplier = 2.6;
private const double slider_multiplier = 1.35;
private const double velocity_change_multiplier = 0.75;
private const double wiggle_multiplier = 1.02;

/// <summary>
/// Evaluates the difficulty of aiming the current object, based on:
/// <list type="bullet">
/// <item><description>cursor velocity to the current object,</description></item>
/// <item><description>angle difficulty,</description></item>
/// <item><description>sharp velocity increases,</description></item>
/// <item><description>and slider difficulty.</description></item>
/// </list>
/// </summary>
public static double EvaluateDifficultyOf(IReadOnlyList<Mod> mods, DifficultyHitObject current)

Check failure on line 31 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, MultiThreaded)

Type 'AimEvaluator' already defines a member called 'EvaluateDifficultyOf' with the same parameter types

Check failure on line 31 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, SingleThread)

Type 'AimEvaluator' already defines a member called 'EvaluateDifficultyOf' with the same parameter types

Check failure on line 31 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Type 'AimEvaluator' already defines a member called 'EvaluateDifficultyOf' with the same parameter types

Check failure on line 31 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Build only (iOS)

Type 'AimEvaluator' already defines a member called 'EvaluateDifficultyOf' with the same parameter types

Check failure on line 31 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, SingleThread)

Type 'AimEvaluator' already defines a member called 'EvaluateDifficultyOf' with the same parameter types

Check failure on line 31 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, MultiThreaded)

Type 'AimEvaluator' already defines a member called 'EvaluateDifficultyOf' with the same parameter types

Check failure on line 31 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Build only (Android)

Type 'AimEvaluator' already defines a member called 'EvaluateDifficultyOf' with the same parameter types
{
if (current.BaseObject is Spinner || current.Index <= 1 || current.Previous(0).BaseObject is Spinner)
return 0;

var osuCurrObj = (OsuDifficultyHitObject)current;
var osuLastObj = (OsuDifficultyHitObject)current.Previous(0);
var osuLastLastObj = (OsuDifficultyHitObject)current.Previous(1);

const int radius = OsuDifficultyHitObject.NORMALISED_RADIUS;
const int diameter = OsuDifficultyHitObject.NORMALISED_DIAMETER;

// Calculate the velocity to the current hitobject, which starts with a base distance / time assuming the last object is a hitcircle.
double currVelocity = osuCurrObj.LazyJumpDistance / osuCurrObj.StrainTime;

// But if the last object is a slider, then we extend the travel velocity through the slider into the current object.
if (osuLastObj.BaseObject is Slider)
{
double travelVelocity = osuLastObj.TravelDistance / osuLastObj.TravelTime; // calculate the slider velocity from slider head to slider end.
double movementVelocity = osuCurrObj.MinimumJumpDistance / osuCurrObj.MinimumJumpTime; // calculate the movement velocity from slider end to current object

currVelocity = Math.Max(currVelocity, movementVelocity + travelVelocity); // take the larger total combined velocity.
}

// As above, do the same for the previous hitobject.
double prevVelocity = osuLastObj.LazyJumpDistance / osuLastObj.StrainTime;

if (osuLastLastObj.BaseObject is Slider)
{
double travelVelocity = osuLastLastObj.TravelDistance / osuLastLastObj.TravelTime;
double movementVelocity = osuLastObj.MinimumJumpDistance / osuLastObj.MinimumJumpTime;

prevVelocity = Math.Max(prevVelocity, movementVelocity + travelVelocity);
}

double wideAngleBonus = 0;
double acuteAngleBonus = 0;
double velocityChangeBonus = 0;
double wiggleBonus = 0;

double aimStrain = currVelocity; // Start strain with regular velocity.

if (Math.Max(osuCurrObj.StrainTime, osuLastObj.StrainTime) < 1.25 * Math.Min(osuCurrObj.StrainTime, osuLastObj.StrainTime)) // If rhythms are the same.
{
if (osuCurrObj.Angle != null && osuLastObj.Angle != null && osuLastLastObj.Angle != null)
{
double currAngle = osuCurrObj.Angle.Value;
double lastAngle = osuLastObj.Angle.Value;

// Rewarding angles, take the smaller velocity as base.
double angleBonus = Math.Min(currVelocity, prevVelocity);

wideAngleBonus = calcWideAngleBonus(currAngle);
acuteAngleBonus = calcAcuteAngleBonus(currAngle);

// Penalize angle repetition.
wideAngleBonus *= 1 - Math.Min(wideAngleBonus, Math.Pow(calcWideAngleBonus(lastAngle), 3));
acuteAngleBonus *= 0.1 + 0.9 * (1 - Math.Min(acuteAngleBonus, Math.Pow(calcAcuteAngleBonus(lastAngle), 3)));

// Apply full wide angle bonus for distance more than one diameter
wideAngleBonus *= angleBonus * DifficultyCalculationUtils.Smootherstep(osuCurrObj.LazyJumpDistance, 0, diameter);

// Apply acute angle bonus for BPM above 300 1/2 and distance more than one diameter
acuteAngleBonus *= angleBonus *
DifficultyCalculationUtils.Smootherstep(DifficultyCalculationUtils.MillisecondsToBPM(osuCurrObj.StrainTime, 2), 300, 400) *
DifficultyCalculationUtils.Smootherstep(osuCurrObj.LazyJumpDistance, diameter, diameter * 2);

// Apply wiggle bonus for jumps that are [radius, 3*diameter] in distance, with < 110 angle
// https://www.desmos.com/calculator/dp0v0nvowc
wiggleBonus = angleBonus
* DifficultyCalculationUtils.Smootherstep(osuCurrObj.LazyJumpDistance, radius, diameter)
* Math.Pow(DifficultyCalculationUtils.ReverseLerp(osuCurrObj.LazyJumpDistance, diameter * 3, diameter), 1.8)
* DifficultyCalculationUtils.Smootherstep(currAngle, double.DegreesToRadians(110), double.DegreesToRadians(60))
* DifficultyCalculationUtils.Smootherstep(osuLastObj.LazyJumpDistance, radius, diameter)
* Math.Pow(DifficultyCalculationUtils.ReverseLerp(osuLastObj.LazyJumpDistance, diameter * 3, diameter), 1.8)
* DifficultyCalculationUtils.Smootherstep(lastAngle, double.DegreesToRadians(110), double.DegreesToRadians(60));
}
}

if (Math.Max(prevVelocity, currVelocity) != 0)
{
// We want to use the average velocity over the whole object when awarding differences, not the individual jump and slider path velocities.
prevVelocity = (osuLastObj.LazyJumpDistance + osuLastLastObj.TravelDistance) / osuLastObj.StrainTime;
currVelocity = (osuCurrObj.LazyJumpDistance + osuLastObj.TravelDistance) / osuCurrObj.StrainTime;

// Scale with ratio of difference compared to 0.5 * max dist.
double distRatio = Math.Pow(Math.Sin(Math.PI / 2 * Math.Abs(prevVelocity - currVelocity) / Math.Max(prevVelocity, currVelocity)), 2);

// Reward for % distance up to 125 / strainTime for overlaps where velocity is still changing.
double overlapVelocityBuff = Math.Min(diameter * 1.25 / Math.Min(osuCurrObj.StrainTime, osuLastObj.StrainTime), Math.Abs(prevVelocity - currVelocity));

velocityChangeBonus = overlapVelocityBuff * distRatio;

// Penalize for rhythm changes.
velocityChangeBonus *= Math.Pow(Math.Min(osuCurrObj.StrainTime, osuLastObj.StrainTime) / Math.Max(osuCurrObj.StrainTime, osuLastObj.StrainTime), 2);
}

aimStrain += wiggleBonus * wiggle_multiplier;

// Add in acute angle bonus or wide angle bonus + velocity change bonus, whichever is larger.
aimStrain += Math.Max(acuteAngleBonus * acute_angle_multiplier, wideAngleBonus * wide_angle_multiplier + velocityChangeBonus * velocity_change_multiplier);

return aimStrain;
}

private static double calcWideAngleBonus(double angle) => DifficultyCalculationUtils.Smoothstep(angle, double.DegreesToRadians(40), double.DegreesToRadians(140));

Check failure on line 136 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, MultiThreaded)

Type 'AimEvaluator' already defines a member called 'calcWideAngleBonus' with the same parameter types

Check failure on line 136 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, SingleThread)

Type 'AimEvaluator' already defines a member called 'calcWideAngleBonus' with the same parameter types

Check failure on line 136 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Type 'AimEvaluator' already defines a member called 'calcWideAngleBonus' with the same parameter types

Check failure on line 136 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Build only (iOS)

Type 'AimEvaluator' already defines a member called 'calcWideAngleBonus' with the same parameter types

Check failure on line 136 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, SingleThread)

Type 'AimEvaluator' already defines a member called 'calcWideAngleBonus' with the same parameter types

Check failure on line 136 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, MultiThreaded)

Type 'AimEvaluator' already defines a member called 'calcWideAngleBonus' with the same parameter types

Check failure on line 136 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Build only (Android)

Type 'AimEvaluator' already defines a member called 'calcWideAngleBonus' with the same parameter types

private static double calcAcuteAngleBonus(double angle) => DifficultyCalculationUtils.Smoothstep(angle, double.DegreesToRadians(140), double.DegreesToRadians(40));

Check failure on line 138 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, MultiThreaded)

Type 'AimEvaluator' already defines a member called 'calcAcuteAngleBonus' with the same parameter types

Check failure on line 138 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, SingleThread)

Type 'AimEvaluator' already defines a member called 'calcAcuteAngleBonus' with the same parameter types

Check failure on line 138 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Type 'AimEvaluator' already defines a member called 'calcAcuteAngleBonus' with the same parameter types

Check failure on line 138 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Build only (iOS)

Type 'AimEvaluator' already defines a member called 'calcAcuteAngleBonus' with the same parameter types

Check failure on line 138 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, SingleThread)

Type 'AimEvaluator' already defines a member called 'calcAcuteAngleBonus' with the same parameter types

Check failure on line 138 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, MultiThreaded)

Type 'AimEvaluator' already defines a member called 'calcAcuteAngleBonus' with the same parameter types

Check failure on line 138 in osu.Game.Rulesets.Osu/Difficulty/Evaluators/SliderAim.cs

View workflow job for this annotation

GitHub Actions / Build only (Android)

Type 'AimEvaluator' already defines a member called 'calcAcuteAngleBonus' with the same parameter types
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static class SpeedEvaluator
/// <item><description>and how easily they can be cheesed.</description></item>
/// </list>
/// </summary>
public static double EvaluateDifficultyOf(Mod[] mods, DifficultyHitObject current, IReadOnlyList<Mod> mods)
public static double EvaluateDifficultyOf(IReadOnlyList<Mod> mods, DifficultyHitObject current)
{
if (current.BaseObject is Spinner)
return 0;
Expand Down
73 changes: 73 additions & 0 deletions osu.Game.Rulesets.Osu/Difficulty/Evaluators/StaminaEvaluator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System;
using System.Collections.Generic;
using System.Linq;
using osu.Game.Rulesets.Difficulty.Preprocessing;
using osu.Game.Rulesets.Difficulty.Utils;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Difficulty.Preprocessing;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Rulesets.Osu.Objects;

namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators
{
public static class StaminaEvaluator
{
private const double single_spacing_threshold = OsuDifficultyHitObject.NORMALISED_DIAMETER * 1.25; // 1.25 circles distance between centers
private const double min_speed_bonus = 200; // 200 BPM 1/4th
private const double speed_balancing_factor = 40;
private const double distance_multiplier = 0.9;

/// <summary>
/// Evaluates the difficulty of tapping the current object, based on:
/// <list type="bullet">
/// <item><description>time between pressing the previous and current object,</description></item>
/// <item><description>distance between those objects,</description></item>
/// <item><description>and how easily they can be cheesed.</description></item>
/// </list>
/// </summary>
public static double EvaluateDifficultyOf(IReadOnlyList<Mod> mods, DifficultyHitObject current)
{
if (current.BaseObject is Spinner)
return 0;

// derive strainTime for calculation
var osuCurrObj = (OsuDifficultyHitObject)current;
var osuPrevObj = current.Index > 0 ? (OsuDifficultyHitObject)current.Previous(0) : null;

double strainTime = osuCurrObj.StrainTime;
double doubletapness = 1.0 - osuCurrObj.GetDoubletapness((OsuDifficultyHitObject?)osuCurrObj.Next(0));

// Cap deltatime to the OD 300 hitwindow.
// 0.93 is derived from making sure 260bpm OD8 streams aren't nerfed harshly, whilst 0.92 limits the effect of the cap.
strainTime /= Math.Clamp((strainTime / osuCurrObj.HitWindowGreat) / 0.93, 0.92, 1);

// speedBonus will be 0.0 for BPM < 200
double speedBonus = 0.0;

// Add additional scaling bonus for streams/bursts higher than 200bpm
if (DifficultyCalculationUtils.MillisecondsToBPM(strainTime) > min_speed_bonus)
speedBonus = 0.75 * Math.Pow((DifficultyCalculationUtils.BPMToMilliseconds(min_speed_bonus) - strainTime) / speed_balancing_factor, 2);

double travelDistance = osuPrevObj?.TravelDistance ?? 0;
double distance = travelDistance + osuCurrObj.MinimumJumpDistance;

// Cap distance at single_spacing_threshold
distance = Math.Min(distance, single_spacing_threshold);

// Max distance bonus is 1 * `distance_multiplier` at single_spacing_threshold
double distanceBonus = Math.Pow(distance / single_spacing_threshold, 3.95) * distance_multiplier;

if (mods.OfType<OsuModAutopilot>().Any())
distanceBonus = 0;

// Base difficulty with all bonuses
double difficulty = (1 + speedBonus + distanceBonus) * 1000 / strainTime;

// Apply penalty if there's doubletappable doubles
return difficulty * doubletapness;
}
}
}
Loading

0 comments on commit cca3ba6

Please sign in to comment.