2022-03-08 08:13:53 +00:00
|
|
|
package funkin;
|
2020-11-07 02:17:27 +00:00
|
|
|
|
2023-11-07 09:04:22 +00:00
|
|
|
/**
|
|
|
|
* A core class which handles tracking score and combo for the current song.
|
|
|
|
*/
|
2020-11-07 02:17:27 +00:00
|
|
|
class Highscore
|
|
|
|
{
|
2024-03-05 01:47:23 +00:00
|
|
|
/**
|
2024-03-05 02:18:40 +00:00
|
|
|
* Keeps track of notes hit for the current song
|
2024-03-05 01:47:23 +00:00
|
|
|
* and how accurate you were with each note (bad, missed, shit, etc.)
|
|
|
|
*/
|
2023-01-23 03:25:45 +00:00
|
|
|
public static var tallies:Tallies = new Tallies();
|
2024-03-05 02:18:40 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Keeps track of notes hit for the current WEEK / level
|
|
|
|
* for use with storymode, or likely any other "playlist" esque option
|
|
|
|
*/
|
|
|
|
public static var talliesLevel:Tallies = new Tallies();
|
|
|
|
|
2024-03-05 03:22:19 +00:00
|
|
|
/**
|
|
|
|
* Produces a new Tallies object which represents the sum of two existing Tallies
|
|
|
|
* @param newTally The first tally
|
|
|
|
* @param baseTally The second tally
|
|
|
|
* @return The combined tally
|
|
|
|
*/
|
|
|
|
public static function combineTallies(newTally:Tallies, baseTally:Tallies):Tallies
|
2024-03-05 02:18:40 +00:00
|
|
|
{
|
|
|
|
var combinedTally:Tallies = new Tallies();
|
2024-03-05 03:22:19 +00:00
|
|
|
combinedTally.missed = newTally.missed + baseTally.missed;
|
|
|
|
combinedTally.shit = newTally.shit + baseTally.shit;
|
|
|
|
combinedTally.bad = newTally.bad + baseTally.bad;
|
|
|
|
combinedTally.good = newTally.good + baseTally.good;
|
|
|
|
combinedTally.sick = newTally.sick + baseTally.sick;
|
|
|
|
combinedTally.totalNotes = newTally.totalNotes + baseTally.totalNotes;
|
|
|
|
combinedTally.totalNotesHit = newTally.totalNotesHit + baseTally.totalNotesHit;
|
|
|
|
|
|
|
|
// Current combo = use most recent.
|
|
|
|
combinedTally.combo = newTally.combo;
|
|
|
|
// Max combo = use maximum value.
|
|
|
|
combinedTally.maxCombo = Std.int(Math.max(newTally.maxCombo, baseTally.maxCombo));
|
2024-03-05 02:18:40 +00:00
|
|
|
|
|
|
|
return combinedTally;
|
|
|
|
}
|
2020-11-07 02:17:27 +00:00
|
|
|
}
|
2022-09-20 06:16:12 +00:00
|
|
|
|
|
|
|
@:forward
|
|
|
|
abstract Tallies(RawTallies)
|
|
|
|
{
|
2023-01-23 03:25:45 +00:00
|
|
|
public function new()
|
|
|
|
{
|
|
|
|
this =
|
|
|
|
{
|
|
|
|
combo: 0,
|
|
|
|
missed: 0,
|
|
|
|
shit: 0,
|
|
|
|
bad: 0,
|
|
|
|
good: 0,
|
|
|
|
sick: 0,
|
|
|
|
totalNotes: 0,
|
|
|
|
totalNotesHit: 0,
|
|
|
|
maxCombo: 0,
|
2024-04-02 01:59:53 +00:00
|
|
|
score: 0,
|
2023-01-23 03:25:45 +00:00
|
|
|
isNewHighscore: false
|
|
|
|
}
|
|
|
|
}
|
2022-09-20 06:16:12 +00:00
|
|
|
}
|
|
|
|
|
2024-03-05 03:22:19 +00:00
|
|
|
/**
|
|
|
|
* A structure object containing the data for highscore tallies.
|
|
|
|
*/
|
2022-09-20 06:16:12 +00:00
|
|
|
typedef RawTallies =
|
|
|
|
{
|
2023-01-23 03:25:45 +00:00
|
|
|
var combo:Int;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* How many notes you let scroll by.
|
|
|
|
*/
|
|
|
|
var missed:Int;
|
|
|
|
|
|
|
|
var shit:Int;
|
|
|
|
var bad:Int;
|
|
|
|
var good:Int;
|
|
|
|
var sick:Int;
|
|
|
|
var maxCombo:Int;
|
2024-04-02 01:59:53 +00:00
|
|
|
|
|
|
|
var score:Int;
|
|
|
|
|
2023-01-23 03:25:45 +00:00
|
|
|
var isNewHighscore:Bool;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* How many notes total that you hit. (NOT how many notes total in the song!)
|
|
|
|
*/
|
|
|
|
var totalNotesHit:Int;
|
|
|
|
|
|
|
|
/**
|
2024-03-05 01:47:23 +00:00
|
|
|
* How many notes in the current chart
|
2023-01-23 03:25:45 +00:00
|
|
|
*/
|
|
|
|
var totalNotes:Int;
|
2022-09-20 06:16:12 +00:00
|
|
|
}
|