Skip to content

Commit d65ee56

Browse files
make ScoreProcessor.CalculateScore() more consistent
1 parent 0e52858 commit d65ee56

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

Quaver.API/Maps/Processors/Scoring/ScoreProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ public ScoreProcessor(Replay replay, JudgementWindows windows = null)
223223
/// <summary>
224224
/// Adds a judgement to the score and recalculates the score.
225225
/// </summary>
226-
public abstract void CalculateScore(Judgement judgement, bool isLongNoteRelease = false);
226+
public abstract void CalculateScore(Judgement judgement, bool isLongNoteRelease = false, bool isMine = false);
227227

228228
/// <summary>
229229
/// Calculates the accuracy of the current play session.

Quaver.API/Maps/Processors/Scoring/ScoreProcessorKeys.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,9 @@ public ScoreProcessorKeys(Replay replay, JudgementWindows windows = null) : base
173173
/// </summary>
174174
/// <param name="hitDifference"></param>
175175
/// <param name="keyPressType"></param>
176+
/// <param name="isMine"></param>
176177
/// <param name="calculateAllStats"></param>
177-
public Judgement CalculateScore(int hitDifference, KeyPressType keyPressType, bool calculateAllStats = true)
178+
public Judgement CalculateScore(int hitDifference, KeyPressType keyPressType, bool isMine, bool calculateAllStats = true)
178179
{
179180
var absoluteDifference = 0;
180181

@@ -220,13 +221,20 @@ public Judgement CalculateScore(int hitDifference, KeyPressType keyPressType, bo
220221
return judgement;
221222
}
222223

224+
public void CalculateScore(HitStat hitStat)
225+
{
226+
CalculateScore(hitStat.Judgement, hitStat.KeyPressType == KeyPressType.Release,
227+
hitStat.HitObject.Type is HitObjectType.Mine);
228+
}
229+
223230
/// <inheritdoc />
224231
/// <summary>
225232
/// Calculate Score and Health increase/decrease with a given judgement.
226233
/// </summary>
227234
/// <param name="judgement"></param>
228235
/// <param name="isLongNoteRelease"></param>
229-
public override void CalculateScore(Judgement judgement, bool isLongNoteRelease = false)
236+
/// <param name="isMine"></param>
237+
public override void CalculateScore(Judgement judgement, bool isLongNoteRelease = false, bool isMine = false)
230238
{
231239
// Update Judgement count
232240
CurrentJudgements[judgement]++;
@@ -250,7 +258,9 @@ public override void CalculateScore(Judgement judgement, bool isLongNoteRelease
250258
MultiplierCount++;
251259

252260
// Add to the combo since the user hit.
253-
Combo++;
261+
// Only do this when the note is not a mine (so it is a regular note)
262+
if (!isMine)
263+
Combo++;
254264

255265
// Set the max combo if applicable.
256266
if (Combo > MaxCombo)

Quaver.API/Replays/Virtual/VirtualReplayPlayer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ private void HandleKeyPressesInFrame()
298298
var hitDifference = hitObject.StartTime - Time;
299299

300300
// Calculate Score.
301-
var judgement = ScoreProcessor.CalculateScore(hitDifference, KeyPressType.Press);
301+
var judgement = ScoreProcessor.CalculateScore(hitDifference, KeyPressType.Press, false);
302302

303303
switch (judgement)
304304
{
@@ -347,7 +347,7 @@ private void HandleKeyPressesInFrame()
347347
var hitDifference = hitObject.EndTime - Time;
348348

349349
// Calculate Score
350-
var judgement = ScoreProcessor.CalculateScore(hitDifference, KeyPressType.Release);
350+
var judgement = ScoreProcessor.CalculateScore(hitDifference, KeyPressType.Release, false);
351351

352352
// LN was released during a hit window.
353353
if (judgement != Judgement.Ghost && judgement != Judgement.Miss)

0 commit comments

Comments
 (0)