Add flag to disable computing legacy scoring values

This commit is contained in:
Dan Balasescu 2023-06-24 01:03:18 +09:00
parent 87447f41d0
commit 06565871d6
5 changed files with 49 additions and 22 deletions

View File

@ -41,18 +41,23 @@ protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beat
// this is the same as osu!, so there's potential to share the implementation... maybe
double preempt = IBeatmapDifficultyInfo.DifficultyRange(beatmap.Difficulty.ApproachRate, 1800, 1200, 450) / clockRate;
CatchScoreV1Processor sv1Processor = new CatchScoreV1Processor(workingBeatmap.Beatmap, beatmap, mods);
return new CatchDifficultyAttributes
CatchDifficultyAttributes attributes = new CatchDifficultyAttributes
{
StarRating = Math.Sqrt(skills[0].DifficultyValue()) * star_scaling_factor,
Mods = mods,
ApproachRate = preempt > 1200.0 ? -(preempt - 1800.0) / 120.0 : -(preempt - 1200.0) / 150.0 + 5.0,
MaxCombo = beatmap.HitObjects.Count(h => h is Fruit) + beatmap.HitObjects.OfType<JuiceStream>().SelectMany(j => j.NestedHitObjects).Count(h => !(h is TinyDroplet)),
LegacyAccuracyScore = sv1Processor.AccuracyScore,
LegacyComboScore = sv1Processor.ComboScore,
LegacyBonusScoreRatio = sv1Processor.BonusScoreRatio
};
if (ComputeLegacyScoringValues)
{
CatchScoreV1Processor sv1Processor = new CatchScoreV1Processor(workingBeatmap.Beatmap, beatmap, mods);
attributes.LegacyAccuracyScore = sv1Processor.AccuracyScore;
attributes.LegacyComboScore = sv1Processor.ComboScore;
attributes.LegacyBonusScoreRatio = sv1Processor.BonusScoreRatio;
}
return attributes;
}
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate)

View File

@ -48,9 +48,7 @@ protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beat
HitWindows hitWindows = new ManiaHitWindows();
hitWindows.SetDifficulty(beatmap.Difficulty.OverallDifficulty);
ManiaScoreV1Processor sv1Processor = new ManiaScoreV1Processor(mods);
return new ManiaDifficultyAttributes
ManiaDifficultyAttributes attributes = new ManiaDifficultyAttributes
{
StarRating = skills[0].DifficultyValue() * star_scaling_factor,
Mods = mods,
@ -58,8 +56,15 @@ protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beat
// This is done the way it is to introduce fractional differences in order to match osu-stable for the time being.
GreatHitWindow = Math.Ceiling((int)(getHitWindow300(mods) * clockRate) / clockRate),
MaxCombo = beatmap.HitObjects.Sum(maxComboForObject),
LegacyComboScore = sv1Processor.TotalScore
};
if (ComputeLegacyScoringValues)
{
ManiaScoreV1Processor sv1Processor = new ManiaScoreV1Processor(mods);
attributes.LegacyComboScore = sv1Processor.TotalScore;
}
return attributes;
}
private static int maxComboForObject(HitObject hitObject)

View File

@ -91,9 +91,7 @@ protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beat
double hitWindowGreat = hitWindows.WindowFor(HitResult.Great) / clockRate;
OsuScoreV1Processor sv1Processor = new OsuScoreV1Processor(workingBeatmap.Beatmap, beatmap, mods);
return new OsuDifficultyAttributes
OsuDifficultyAttributes attributes = new OsuDifficultyAttributes
{
StarRating = starRating,
Mods = mods,
@ -109,10 +107,17 @@ protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beat
HitCircleCount = hitCirclesCount,
SliderCount = sliderCount,
SpinnerCount = spinnerCount,
LegacyAccuracyScore = sv1Processor.AccuracyScore,
LegacyComboScore = sv1Processor.ComboScore,
LegacyBonusScoreRatio = sv1Processor.BonusScoreRatio
};
if (ComputeLegacyScoringValues)
{
OsuScoreV1Processor sv1Processor = new OsuScoreV1Processor(workingBeatmap.Beatmap, beatmap, mods);
attributes.LegacyAccuracyScore = sv1Processor.AccuracyScore;
attributes.LegacyComboScore = sv1Processor.ComboScore;
attributes.LegacyBonusScoreRatio = sv1Processor.BonusScoreRatio;
}
return attributes;
}
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate)

View File

@ -89,9 +89,7 @@ protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beat
HitWindows hitWindows = new TaikoHitWindows();
hitWindows.SetDifficulty(beatmap.Difficulty.OverallDifficulty);
TaikoScoreV1Processor sv1Processor = new TaikoScoreV1Processor(workingBeatmap.Beatmap, beatmap, mods);
return new TaikoDifficultyAttributes
TaikoDifficultyAttributes attributes = new TaikoDifficultyAttributes
{
StarRating = starRating,
Mods = mods,
@ -101,10 +99,17 @@ protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beat
PeakDifficulty = combinedRating,
GreatHitWindow = hitWindows.WindowFor(HitResult.Great) / clockRate,
MaxCombo = beatmap.HitObjects.Count(h => h is Hit),
LegacyAccuracyScore = sv1Processor.AccuracyScore,
LegacyComboScore = sv1Processor.ComboScore,
LegacyBonusScoreRatio = sv1Processor.BonusScoreRatio
};
if (ComputeLegacyScoringValues)
{
TaikoScoreV1Processor sv1Processor = new TaikoScoreV1Processor(workingBeatmap.Beatmap, beatmap, mods);
attributes.LegacyAccuracyScore = sv1Processor.AccuracyScore;
attributes.LegacyComboScore = sv1Processor.ComboScore;
attributes.LegacyBonusScoreRatio = sv1Processor.BonusScoreRatio;
}
return attributes;
}
/// <summary>

View File

@ -23,6 +23,13 @@ namespace osu.Game.Rulesets.Difficulty
{
public abstract class DifficultyCalculator
{
/// <summary>
/// Whether legacy scoring values (ScoreV1) should be computed to populate the difficulty attributes
/// <see cref="DifficultyAttributes.LegacyAccuracyScore"/>, <see cref="DifficultyAttributes.LegacyComboScore"/>,
/// and <see cref="DifficultyAttributes.LegacyBonusScoreRatio"/>.
/// </summary>
public bool ComputeLegacyScoringValues;
/// <summary>
/// The beatmap for which difficulty will be calculated.
/// </summary>