mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-12-23 21:56:46 +00:00
Redo combine tally implementation
This commit is contained in:
parent
acc75c5c5c
commit
08fb8be419
|
@ -1,7 +1,5 @@
|
||||||
package funkin;
|
package funkin;
|
||||||
|
|
||||||
import flixel.FlxG;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A core class which handles tracking score and combo for the current song.
|
* A core class which handles tracking score and combo for the current song.
|
||||||
*/
|
*/
|
||||||
|
@ -19,18 +17,27 @@ class Highscore
|
||||||
*/
|
*/
|
||||||
public static var talliesLevel:Tallies = new Tallies();
|
public static var talliesLevel:Tallies = new Tallies();
|
||||||
|
|
||||||
public static function combineTallies(tally1:Tallies, tally2:Tallies):Tallies
|
/**
|
||||||
|
* 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
|
||||||
{
|
{
|
||||||
var combinedTally:Tallies = new Tallies();
|
var combinedTally:Tallies = new Tallies();
|
||||||
combinedTally.combo = tally1.combo + tally2.combo;
|
combinedTally.missed = newTally.missed + baseTally.missed;
|
||||||
combinedTally.missed = tally1.missed + tally2.missed;
|
combinedTally.shit = newTally.shit + baseTally.shit;
|
||||||
combinedTally.shit = tally1.shit + tally2.shit;
|
combinedTally.bad = newTally.bad + baseTally.bad;
|
||||||
combinedTally.bad = tally1.bad + tally2.bad;
|
combinedTally.good = newTally.good + baseTally.good;
|
||||||
combinedTally.good = tally1.good + tally2.good;
|
combinedTally.sick = newTally.sick + baseTally.sick;
|
||||||
combinedTally.sick = tally1.sick + tally2.sick;
|
combinedTally.totalNotes = newTally.totalNotes + baseTally.totalNotes;
|
||||||
combinedTally.totalNotes = tally1.totalNotes + tally2.totalNotes;
|
combinedTally.totalNotesHit = newTally.totalNotesHit + baseTally.totalNotesHit;
|
||||||
combinedTally.totalNotesHit = tally1.totalNotesHit + tally2.totalNotesHit;
|
|
||||||
combinedTally.maxCombo = tally1.maxCombo + tally2.maxCombo;
|
// Current combo = use most recent.
|
||||||
|
combinedTally.combo = newTally.combo;
|
||||||
|
// Max combo = use maximum value.
|
||||||
|
combinedTally.maxCombo = Std.int(Math.max(newTally.maxCombo, baseTally.maxCombo));
|
||||||
|
|
||||||
return combinedTally;
|
return combinedTally;
|
||||||
}
|
}
|
||||||
|
@ -57,6 +64,9 @@ abstract Tallies(RawTallies)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A structure object containing the data for highscore tallies.
|
||||||
|
*/
|
||||||
typedef RawTallies =
|
typedef RawTallies =
|
||||||
{
|
{
|
||||||
var combo:Int;
|
var combo:Int;
|
||||||
|
|
Loading…
Reference in a new issue