Expose half catcher width to movement skill

This commit is contained in:
smoogipoo 2020-03-13 12:43:01 +09:00
parent 8d0bcf4bbb
commit c8cdc5fda5
2 changed files with 22 additions and 12 deletions

View File

@ -23,6 +23,8 @@ public class CatchDifficultyCalculator : DifficultyCalculator
protected override int SectionLength => 750;
private float halfCatcherWidth;
public CatchDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap)
: base(ruleset, beatmap)
{
@ -48,14 +50,6 @@ protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beat
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate)
{
float halfCatchWidth;
using (var catcher = new CatcherArea.Catcher(beatmap.BeatmapInfo.BaseDifficulty))
{
halfCatchWidth = catcher.CatchWidth * 0.5f;
halfCatchWidth *= 0.8f; // We're only using 80% of the catcher's width to simulate imperfect gameplay.
}
CatchHitObject lastObject = null;
// In 2B beatmaps, it is possible that a normal Fruit is placed in the middle of a JuiceStream.
@ -69,16 +63,25 @@ protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(I
continue;
if (lastObject != null)
yield return new CatchDifficultyHitObject(hitObject, lastObject, clockRate, halfCatchWidth);
yield return new CatchDifficultyHitObject(hitObject, lastObject, clockRate, halfCatcherWidth);
lastObject = hitObject;
}
}
protected override Skill[] CreateSkills(IBeatmap beatmap) => new Skill[]
protected override Skill[] CreateSkills(IBeatmap beatmap)
{
new Movement(),
};
using (var catcher = new CatcherArea.Catcher(beatmap.BeatmapInfo.BaseDifficulty))
{
halfCatcherWidth = catcher.CatchWidth * 0.5f;
halfCatcherWidth *= 0.8f; // We're only using 80% of the catcher's width to simulate imperfect gameplay.
}
return new Skill[]
{
new Movement(halfCatcherWidth),
};
}
protected override Mod[] DifficultyAdjustmentMods => new Mod[]
{

View File

@ -20,9 +20,16 @@ public class Movement : Skill
protected override double DecayWeight => 0.94;
protected readonly float HalfCatcherWidth;
private float? lastPlayerPosition;
private float lastDistanceMoved;
public Movement(float halfCatcherWidth)
{
HalfCatcherWidth = halfCatcherWidth;
}
protected override double StrainValueOf(DifficultyHitObject current)
{
var catchCurrent = (CatchDifficultyHitObject)current;