Skip to content

Commit

Permalink
Merge pull request #564 from LumpBloom7/reimplement-slide-order-leniency
Browse files Browse the repository at this point in the history
Reimplement slide order leniency
  • Loading branch information
LumpBloom7 authored Mar 11, 2024
2 parents 75dcf26 + 3f34efb commit 1e80c58
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
15 changes: 14 additions & 1 deletion osu.Game.Rulesets.Sentakki/Mods/SentakkiModHardRock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
using osu.Game.Configuration;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Sentakki.Localisation.Mods;
using osu.Game.Rulesets.Sentakki.Objects.Drawables;
using osu.Game.Rulesets.Sentakki.Scoring;

namespace osu.Game.Rulesets.Sentakki.Mods
{
public class SentakkiModHardRock : ModHardRock, IApplicableToHitObject
public class SentakkiModHardRock : ModHardRock, IApplicableToHitObject, IApplicableToDrawableHitObject
{
public override double ScoreMultiplier => 1;

Expand All @@ -28,6 +30,9 @@ public override void ApplyToDifficulty(BeatmapDifficulty difficulty)
[SettingSource(typeof(SentakkiModHardRockStrings), nameof(SentakkiModHardRockStrings.MinimumResult), nameof(SentakkiModHardRockStrings.MinimumResultDescription))]
public Bindable<SentakkiHitResult> MinimumValidResult { get; } = new Bindable<SentakkiHitResult>(SentakkiHitResult.Good);

[SettingSource("Enable strict slider tracking")]
public Bindable<bool> StrictSliderTracking { get; } = new Bindable<bool>(false);

public void ApplyToHitObject(HitObject hitObject)
{
// Nested HitObjects should get the same treatment
Expand All @@ -41,6 +46,14 @@ public void ApplyToHitObject(HitObject hitObject)
shw.JudgementMode = JudgementMode.Value;
}

public void ApplyToDrawableHitObject(DrawableHitObject drawable)
{
if (drawable is not DrawableSlideCheckpoint slideCheckpoint)
return;

slideCheckpoint.StrictSliderTracking = StrictSliderTracking.Value;
}

public enum SentakkiHitResult
{
Good = 3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ public partial class DrawableSlideCheckpoint : DrawableSentakkiHitObject
// All hits can only be done after the slide tap has been judged
public bool IsHittable => ParentHitObject.IsHittable && isPreviousNodeHit();

private bool isPreviousNodeHit() => ThisIndex < 1 || ParentHitObject.SlideCheckpoints[ThisIndex - 1].IsHit;
public bool StrictSliderTracking { get; set; }

private int trackingLookBehindDistance => StrictSliderTracking ? 1 : 2;

private bool isPreviousNodeHit() => ThisIndex < trackingLookBehindDistance || ParentHitObject.SlideCheckpoints[ThisIndex - trackingLookBehindDistance].IsHit;

private Container<DrawableSlideCheckpointNode> nodes = null!;

Expand Down Expand Up @@ -84,6 +88,10 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)
if (Judged)
return;

// The previous node may not be judged due to slider hit order leniency allowing players to skip up to one node
if (ThisIndex > 0)
ParentHitObject.SlideCheckpoints[ThisIndex - 1].ApplyResult(result);

// Make sure remaining nodes are judged
foreach (var node in nodes)
node.ApplyResult(result);
Expand Down

0 comments on commit 1e80c58

Please sign in to comment.