Calculate player rating based on last sung line
This commit is contained in:
1 parent
d7523ced37
commit
7edff72194
2 files changed
+9
-1
No files matched your search
@@ -199,6 +199,7 @@ namespace Vocaluxe.Base
|
|||||||
Players[i].Points = 0f;
|
Players[i].Points = 0f;
|
||||||
Players[i].PointsLineBonus = 0f;
|
Players[i].PointsLineBonus = 0f;
|
||||||
Players[i].PointsGoldenNotes = 0f;
|
Players[i].PointsGoldenNotes = 0f;
|
||||||
|
Players[i].Rating = 0.5f;
|
||||||
Players[i].VoiceNr = 0;
|
Players[i].VoiceNr = 0;
|
||||||
Players[i].NoteDiff = 0;
|
Players[i].NoteDiff = 0;
|
||||||
Players[i].SungLines = new List<CSungLine>();
|
Players[i].SungLines = new List<CSungLine>();
|
||||||
@@ -343,10 +344,11 @@ namespace Vocaluxe.Base
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Line Bonus
|
// Check if line ended
|
||||||
int numLinesWithPoints = song.Notes.GetNumLinesWithPoints(Players[p].VoiceNr);
|
int numLinesWithPoints = song.Notes.GetNumLinesWithPoints(Players[p].VoiceNr);
|
||||||
if (beat == lines[line].LastNoteBeat && lines[line].Points > 0 && numLinesWithPoints > 0)
|
if (beat == lines[line].LastNoteBeat && lines[line].Points > 0 && numLinesWithPoints > 0)
|
||||||
{
|
{
|
||||||
|
// Line Bonus
|
||||||
double factor = Players[p].SungLines[line].Points / (double)lines[line].Points;
|
double factor = Players[p].SungLines[line].Points / (double)lines[line].Points;
|
||||||
if (factor <= 0.4)
|
if (factor <= 0.4)
|
||||||
factor = 0.0;
|
factor = 0.0;
|
||||||
@@ -363,6 +365,11 @@ namespace Vocaluxe.Base
|
|||||||
Players[p].Points += points;
|
Players[p].Points += points;
|
||||||
Players[p].PointsLineBonus += points;
|
Players[p].PointsLineBonus += points;
|
||||||
Players[p].SungLines[line].BonusPoints += points;
|
Players[p].SungLines[line].BonusPoints += points;
|
||||||
|
|
||||||
|
//Calculate rating
|
||||||
|
double stretchFactor = 0.2;
|
||||||
|
double current = Players[p].SungLines[line].Points / (double)lines[line].Points;
|
||||||
|
Players[p].Rating = (Players[p].Rating + (current * stretchFactor - 0.1)).Clamp(0, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -362,6 +362,7 @@ namespace VocaluxeLib
|
|||||||
public double Points;
|
public double Points;
|
||||||
public double PointsLineBonus;
|
public double PointsLineBonus;
|
||||||
public double PointsGoldenNotes;
|
public double PointsGoldenNotes;
|
||||||
|
public double Rating;
|
||||||
public int NoteDiff;
|
public int NoteDiff;
|
||||||
public int VoiceNr;
|
public int VoiceNr;
|
||||||
public List<CSungLine> SungLines;
|
public List<CSungLine> SungLines;
|
||||||
|
|||||||
Reference in new issue
Block a user