mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 08:43:01 +08:00
Fixing code style
This commit is contained in:
parent
44fd4b95bd
commit
0405383e4e
@ -31,7 +31,6 @@ namespace osu.Game.Rulesets.Catch.Difficulty
|
|||||||
|
|
||||||
public override double Calculate(Dictionary<string, double> categoryDifficulty = null)
|
public override double Calculate(Dictionary<string, double> categoryDifficulty = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
difficultyHitObjects.Clear();
|
difficultyHitObjects.Clear();
|
||||||
|
|
||||||
float circleSize = Beatmap.BeatmapInfo.BaseDifficulty.CircleSize;
|
float circleSize = Beatmap.BeatmapInfo.BaseDifficulty.CircleSize;
|
||||||
@ -83,7 +82,6 @@ namespace osu.Game.Rulesets.Catch.Difficulty
|
|||||||
// Traverse hitObjects in pairs to calculate the strain value of NextHitObject from the strain value of CurrentHitObject and environment.
|
// Traverse hitObjects in pairs to calculate the strain value of NextHitObject from the strain value of CurrentHitObject and environment.
|
||||||
using (List<CatchDifficultyHitObject>.Enumerator hitObjectsEnumerator = difficultyHitObjects.GetEnumerator())
|
using (List<CatchDifficultyHitObject>.Enumerator hitObjectsEnumerator = difficultyHitObjects.GetEnumerator())
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!hitObjectsEnumerator.MoveNext()) return false;
|
if (!hitObjectsEnumerator.MoveNext()) return false;
|
||||||
|
|
||||||
CatchDifficultyHitObject currentHitObject = hitObjectsEnumerator.Current;
|
CatchDifficultyHitObject currentHitObject = hitObjectsEnumerator.Current;
|
||||||
@ -106,17 +104,17 @@ namespace osu.Game.Rulesets.Catch.Difficulty
|
|||||||
/// This is to eliminate higher influence of stream over aim by simply having more HitObjects with high strain.
|
/// This is to eliminate higher influence of stream over aim by simply having more HitObjects with high strain.
|
||||||
/// The higher this value, the less strains there will be, indirectly giving long beatmaps an advantage.
|
/// The higher this value, the less strains there will be, indirectly giving long beatmaps an advantage.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected const double STRAIN_STEP = 750;
|
protected const double strain_step = 750;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The weighting of each strain value decays to this number * it's previous value
|
/// The weighting of each strain value decays to this number * it's previous value
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected const double DECAY_WEIGHT = 0.94;
|
protected const double decay_weight = 0.94;
|
||||||
|
|
||||||
protected double CalculateDifficulty()
|
protected double CalculateDifficulty()
|
||||||
{
|
{
|
||||||
// The strain step needs to be adjusted for the algorithm to be considered equal with speed changing mods
|
// The strain step needs to be adjusted for the algorithm to be considered equal with speed changing mods
|
||||||
double actualStrainStep = STRAIN_STEP * TimeRate;
|
double actualStrainStep = strain_step * TimeRate;
|
||||||
|
|
||||||
// Find the highest strain value within each strain step
|
// Find the highest strain value within each strain step
|
||||||
List<double> highestStrains = new List<double>();
|
List<double> highestStrains = new List<double>();
|
||||||
@ -153,17 +151,8 @@ namespace osu.Game.Rulesets.Catch.Difficulty
|
|||||||
previousHitObject = hitObject;
|
previousHitObject = hitObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// calculate maximun strain difficulty
|
||||||
// Build the weighted sum over the highest strains for each interval
|
double difficulty = StrainCalculator(highestStrains, decay_weight);
|
||||||
double difficulty = 0;
|
|
||||||
double weight = 1;
|
|
||||||
highestStrains.Sort((a, b) => b.CompareTo(a)); // Sort from highest to lowest strain.
|
|
||||||
|
|
||||||
foreach (double strain in highestStrains)
|
|
||||||
{
|
|
||||||
difficulty += weight * strain;
|
|
||||||
weight *= DECAY_WEIGHT;
|
|
||||||
}
|
|
||||||
|
|
||||||
return difficulty;
|
return difficulty;
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty
|
|||||||
// We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps.
|
// We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps.
|
||||||
float scalingFactor = NORMALIZED_HITOBJECT_RADIUS / catcherWidthHalf;
|
float scalingFactor = NORMALIZED_HITOBJECT_RADIUS / catcherWidthHalf;
|
||||||
|
|
||||||
playerPositioningError = ABSOLUTE_PLAYER_POSITIONING_ERROR;// * scalingFactor;
|
playerPositioningError = ABSOLUTE_PLAYER_POSITIONING_ERROR; // * scalingFactor;
|
||||||
NormalizedPosition = baseHitObject.X * CatchPlayfield.BASE_WIDTH * scalingFactor;
|
NormalizedPosition = baseHitObject.X * CatchPlayfield.BASE_WIDTH * scalingFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,16 +122,8 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
|
|||||||
previousHitObject = hitObject;
|
previousHitObject = hitObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build the weighted sum over the highest strains for each interval
|
// calculate maximun strain difficulty
|
||||||
double difficulty = 0;
|
double difficulty = StrainCalculator(highestStrains, decay_weight);
|
||||||
double weight = 1;
|
|
||||||
highestStrains.Sort((a, b) => b.CompareTo(a)); // Sort from highest to lowest strain.
|
|
||||||
|
|
||||||
foreach (double strain in highestStrains)
|
|
||||||
{
|
|
||||||
difficulty += weight * strain;
|
|
||||||
weight *= decay_weight;
|
|
||||||
}
|
|
||||||
|
|
||||||
return difficulty;
|
return difficulty;
|
||||||
}
|
}
|
||||||
|
@ -37,5 +37,20 @@ namespace osu.Game.Rulesets.Difficulty
|
|||||||
}
|
}
|
||||||
|
|
||||||
public abstract double Calculate(Dictionary<string, double> categoryDifficulty = null);
|
public abstract double Calculate(Dictionary<string, double> categoryDifficulty = null);
|
||||||
|
|
||||||
|
protected double StrainCalculator(List<double> highestStrains, double decayWeight)
|
||||||
|
{
|
||||||
|
// Build the weighted sum over the highest strains for each interval
|
||||||
|
double difficulty = 0;
|
||||||
|
double weight = 1;
|
||||||
|
highestStrains.Sort((a, b) => b.CompareTo(a)); // Sort from highest to lowest strain.
|
||||||
|
|
||||||
|
foreach (double strain in highestStrains)
|
||||||
|
{
|
||||||
|
difficulty += weight * strain;
|
||||||
|
weight *= decayWeight;
|
||||||
|
}
|
||||||
|
return difficulty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user