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

Award 100ms bonus hold time for holding until the end of a holdnote #569

Closed
wants to merge 3 commits into from
Closed
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
33 changes: 27 additions & 6 deletions osu.Game.Rulesets.Sentakki/Objects/Drawables/DrawableHold.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ protected override void OnFree()
base.OnFree();
HoldStartTime = null;
TotalHoldTime = 0;
pressedCount = 0;
}

protected override void UpdateInitialTransforms()
Expand Down Expand Up @@ -107,7 +106,14 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)
{
if (Time.Current > HitObject.GetEndTime())
{
bool holdingAtEndTime = HoldStartTime is not null;

endHold();

// We award an extra 100ms hold time to encourage players to hold the note until the end
// This avoids the situation where a note is too short and is much harder to get a good judgement due to player reaction
TotalHoldTime += holdingAtEndTime ? 100 : 0;

double totalHoldRatio = TotalHoldTime / ((IHasDuration)HitObject).Duration;
HitResult result;

Expand Down Expand Up @@ -218,8 +224,24 @@ private void endHold()
HoldStartTime = null;
}

// Tracks how many inputs are pressing on this HitObject currently
private int pressedCount = 0;
private SentakkiInputManager sentakkiActionInputManager = null!;
internal SentakkiInputManager SentakkiActionInputManager => sentakkiActionInputManager ??= (SentakkiInputManager)GetContainingInputManager();

private int pressedCount
{
get
{
int count = 0;
foreach (var pressedAction in sentakkiActionInputManager.PressedActions)
{
if (pressedAction == SentakkiAction.Key1 + HitObject.Lane)
++count;
}

return count;
}
}

public bool OnPressed(KeyBindingPressEvent<SentakkiAction> e)
{
if (AllJudged)
Expand All @@ -228,8 +250,6 @@ public bool OnPressed(KeyBindingPressEvent<SentakkiAction> e)
if (e.Action != SentakkiAction.Key1 + HitObject.Lane)
return false;

pressedCount++;

if (beginHoldAt(Time.Current - Head.HitObject.StartTime))
{
Head.UpdateResult();
Expand All @@ -250,7 +270,8 @@ public void OnReleased(KeyBindingReleaseEvent<SentakkiAction> e)
return;

// We only release the hold once ALL inputs are released
if (--pressedCount != 0)
// We check for 1 here as drawables receive the event before the counter decrements
if (pressedCount > 1)
return;

endHold();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)
{
if (Time.Current < ((IHasDuration)HitObject).EndTime) return;

// We award an extra 100ms hold time to encourage players to hold the note until the end
// This avoids the situation where a note is too short and is much harder to get a good judgement due to player reaction
if (isHitting.Value)
totalHoldTime += 100;

double result = totalHoldTime / ((IHasDuration)HitObject).Duration;

HitResult resultType;
Expand Down
Loading