adding maxMisses to ComboRating
This commit is contained in:
@@ -119,7 +119,7 @@ class HScript extends Script {
|
|||||||
interp.execute(expr);
|
interp.execute(expr);
|
||||||
call("new", []);
|
call("new", []);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GLOBAL_SCRIPT
|
#if GLOBAL_SCRIPT
|
||||||
funkin.backend.scripting.GlobalScript.call("onScriptSetup", [this, "hscript"]);
|
funkin.backend.scripting.GlobalScript.call("onScriptSetup", [this, "hscript"]);
|
||||||
#end
|
#end
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package funkin.backend.scripting.events;
|
|||||||
|
|
||||||
final class RatingUpdateEvent extends CancellableEvent {
|
final class RatingUpdateEvent extends CancellableEvent {
|
||||||
/**
|
/**
|
||||||
New combo
|
New combo (may be null if no ratings were found)
|
||||||
**/
|
**/
|
||||||
public var rating:ComboRating;
|
public var rating:ComboRating;
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -522,10 +522,10 @@ class PlayState extends MusicBeatState
|
|||||||
*/
|
*/
|
||||||
public function updateRating() {
|
public function updateRating() {
|
||||||
var rating = null;
|
var rating = null;
|
||||||
var acc = get_accuracy();
|
var acc = accuracy; // caching since it has a getter with an operation - Nex
|
||||||
|
|
||||||
for(e in comboRatings)
|
if (comboRatings != null && comboRatings.length > 0) for (e in comboRatings)
|
||||||
if (e.percent <= acc && (rating == null || rating.percent < e.percent))
|
if ((e.percent <= acc && e.maxMisses >= misses) && (rating == null || (rating.percent < e.percent && e.maxMisses >= misses)))
|
||||||
rating = e;
|
rating = e;
|
||||||
|
|
||||||
var event = scripts.event("onRatingUpdate", EventManager.get(RatingUpdateEvent).recycle(rating, curRating));
|
var event = scripts.event("onRatingUpdate", EventManager.get(RatingUpdateEvent).recycle(rating, curRating));
|
||||||
@@ -1970,8 +1970,10 @@ final class ComboRating {
|
|||||||
public var percent:Float;
|
public var percent:Float;
|
||||||
public var rating:String;
|
public var rating:String;
|
||||||
public var color:FlxColor;
|
public var color:FlxColor;
|
||||||
|
public var maxMisses:Float; // Float since it could be Math.POSITIVE_INFINITY - Nex
|
||||||
|
|
||||||
public function new(percent:Float, rating:String, color:FlxColor) {
|
public function new(?percent:Float, ?rating:String, ?color:FlxColor, ?misses:Float) {
|
||||||
|
maxMisses = misses == null || Math.isNaN(misses) ? Math.POSITIVE_INFINITY : misses;
|
||||||
this.percent = percent;
|
this.percent = percent;
|
||||||
this.rating = rating;
|
this.rating = rating;
|
||||||
this.color = color;
|
this.color = color;
|
||||||
|
|||||||
Reference in New Issue
Block a user