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

Note count fix, solo reset fix*, slightly easier tap recovery #222

Merged
merged 1 commit into from
Apr 30, 2023
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
17 changes: 13 additions & 4 deletions Assets/Script/PlayMode/AbstractTrack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public EventInfo FillSection {

// Solo stuff
private bool soloInProgress = false;
private int soloNoteCount = -1;
protected int soloNoteCount = -1;
protected int soloNotesHit = 0;
private float soloHitPercent = 0;
private int lastHit = -1;
Expand Down Expand Up @@ -176,15 +176,15 @@ protected virtual void OnDestroy() {
player.lastScore = new PlayerManager.LastScore {
percentage = new DiffPercent {
difficulty = player.chosenDifficulty,
percent = Chart.Count == 0 ? 1f : (float) notesHit / Chart.Count
percent = Chart.Count == 0 ? 1f : (float) notesHit / GetChartCount()
},
score = new DiffScore {
difficulty = player.chosenDifficulty,
score = (int) math.round(scoreKeeper.Score),
stars = math.clamp((int) starsKeeper.Stars, 0, 6)
},
notesHit = notesHit,
notesMissed = Chart.Count - notesHit
notesMissed = GetChartCount() - notesHit
};

Play.OnPauseToggle -= PauseToggled;
Expand Down Expand Up @@ -370,6 +370,7 @@ private void UpdateInfo() {
if (Play.Instance.SongTime >= SoloSection?.time - 2 && Play.Instance.SongTime <= SoloSection?.time) {
// run ONCE
if (!soloInProgress) {
soloNotesHit = 0; // Reset count
soloInProgress = true;
}

Expand All @@ -379,7 +380,7 @@ private void UpdateInfo() {
if (Chart[i].time > SoloSection?.EndTime) {
break;
} else {
soloNoteCount++;
AddSoloNoteCount(i);
}
}
}
Expand Down Expand Up @@ -408,6 +409,7 @@ private void UpdateInfo() {
// run ONCE
if (soloInProgress) {
soloPtsEarned = scoreKeeper.AddSolo(soloNotesHit, soloNoteCount);
soloNotesHit = 0; // Reset count

// set box text
if (soloHitPercent >= 100f) {
Expand Down Expand Up @@ -496,5 +498,12 @@ private bool IsStarpowerHit() {
}

public abstract void SetReverb(bool on);

public virtual void AddSoloNoteCount(int i) {
soloNoteCount++;
}
public virtual int GetChartCount() {
return Chart.Count;
}
}
}
32 changes: 23 additions & 9 deletions Assets/Script/PlayMode/FiveFretTrack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ private void UpdateInput() {
}
// If tapping to recover combo during tap note section, skip to first valid note within the timing window.
// This will make it easier to recover.
if (Constants.EASY_TAP_RECOVERY && Combo <= 0 && pressedThisFrame && chord[0].tap && !ChordPressed(chord)) {
if (Constants.EASY_TAP_RECOVERY && Combo <= 0 /*&& pressedThisFrame*/ && chord[0].tap && !ChordPressed(chord)) {
var found = false;
foreach (var newChord in expectedHits) {
if (!newChord[0].tap) {
Expand Down Expand Up @@ -354,9 +354,16 @@ private void UpdateInput() {

ResetAllowedChordGhosts();
Combo++;
notesHit++;
strummedCurrentNote = strummedCurrentNote || strummed || strumLeniency > 0f;
strumLeniency = 0f;
StopAudio = false;


// Solo stuff
if (Play.Instance.SongTime >= SoloSection?.time && Play.Instance.SongTime <= SoloSection?.EndTime) {
soloNotesHit++;
}
foreach (var hit in chord) {
hitChartIndex++;
// Hit notes
Expand Down Expand Up @@ -388,15 +395,7 @@ private void UpdateInput() {
}

// Add stats
notesHit++;
scoreKeeper.Add(PTS_PER_NOTE * Multiplier);

// Solo stuff
if (Play.Instance.SongTime >= SoloSection?.time && Play.Instance.SongTime <= SoloSection?.EndTime) {
soloNotesHit++;
} else if (Play.Instance.SongTime >= SoloSection?.EndTime + 10) {
soloNotesHit = 0;
}
}

// If this is a tap note, and it was hit without strumming,
Expand Down Expand Up @@ -780,5 +779,20 @@ private void ResetAllowedChordGhosts(bool resetGhosts = true) {
private bool IsExtendedSustain() {
return extendedSustain.Any(x => x);
}

public override void AddSoloNoteCount(int i) {
if (i == 0 || Chart[i].time > Chart[i-1].time) {
soloNoteCount++;
}
}
public override int GetChartCount() {
int count = 0;
for (int i = 0; i < Chart.Count; i++) {
if (i == 0 || Chart[i].time > Chart[i-1].time) {
count++;
}
}
return count;
}
}
}