Remove preprocess until a later point in time

This commit is contained in:
smoogipoo 2019-03-19 15:53:27 +09:00
parent 5d9477e1e4
commit 57727ac184
2 changed files with 12 additions and 23 deletions

View File

@ -23,24 +23,13 @@ public class CatchDifficultyCalculator : DifficultyCalculator
protected override int SectionLength => 750;
private float halfCatchWidth;
private float? halfCatchWidth;
public CatchDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap)
: base(ruleset, beatmap)
{
}
protected override void PreProcess(IBeatmap beatmap, Mod[] mods, double clockRate)
{
base.PreProcess(beatmap, mods, clockRate);
var catcher = new CatcherArea.Catcher(beatmap.BeatmapInfo.BaseDifficulty);
halfCatchWidth = catcher.CatchWidth * 0.5f;
// We're only using 80% of the catcher's width to simulate imperfect gameplay.
halfCatchWidth *= 0.8f;
}
protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
{
if (beatmap.HitObjects.Count == 0)
@ -60,6 +49,15 @@ protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beat
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate)
{
if (halfCatchWidth == null)
{
var catcher = new CatcherArea.Catcher(beatmap.BeatmapInfo.BaseDifficulty);
halfCatchWidth = catcher.CatchWidth * 0.5f;
// We're only using 80% of the catcher's width to simulate imperfect gameplay.
halfCatchWidth *= 0.8f;
}
CatchHitObject lastObject = null;
foreach (var hitObject in beatmap.HitObjects.OfType<CatchHitObject>())
@ -74,14 +72,14 @@ protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(I
{
// We want to only consider fruits that contribute to the combo. Droplets are addressed as accuracy and spinners are not relevant for "skill" calculations.
case Fruit fruit:
yield return new CatchDifficultyHitObject(fruit, lastObject, clockRate, halfCatchWidth);
yield return new CatchDifficultyHitObject(fruit, lastObject, clockRate, halfCatchWidth.Value);
lastObject = hitObject;
break;
case JuiceStream _:
foreach (var nested in hitObject.NestedHitObjects.OfType<CatchHitObject>().Where(o => !(o is TinyDroplet)))
{
yield return new CatchDifficultyHitObject(nested, lastObject, clockRate, halfCatchWidth);
yield return new CatchDifficultyHitObject(nested, lastObject, clockRate, halfCatchWidth.Value);
lastObject = nested;
}

View File

@ -63,8 +63,6 @@ public IEnumerable<DifficultyAttributes> CalculateAll()
private DifficultyAttributes calculate(IBeatmap beatmap, Mod[] mods, double clockRate)
{
PreProcess(beatmap, mods, clockRate);
var skills = CreateSkills(beatmap);
if (!beatmap.HitObjects.Any())
@ -101,13 +99,6 @@ private DifficultyAttributes calculate(IBeatmap beatmap, Mod[] mods, double cloc
return CreateDifficultyAttributes(beatmap, mods, skills, clockRate);
}
/// <summary>
/// Computes any values to be used for difficulty calculation, prior to difficulty calculation taking place.
/// </summary>
protected virtual void PreProcess(IBeatmap beatmap, Mod[] mods, double clockRate)
{
}
/// <summary>
/// Creates all <see cref="Mod"/> combinations which adjust the <see cref="Beatmap"/> difficulty.
/// </summary>