Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reimplement slide order leniency #564

Merged
merged 2 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading