accuracy isn't dumb now lol
This commit is contained in:
parent
cf1ba67926
commit
ea83641799
84
source/EtternaFunctions.hx
Normal file
84
source/EtternaFunctions.hx
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
class EtternaFunctions
|
||||||
|
{
|
||||||
|
// erf constants
|
||||||
|
public static var a1 = 0.254829592;
|
||||||
|
public static var a2 = -0.284496736;
|
||||||
|
public static var a3 = 1.421413741;
|
||||||
|
public static var a4 = -1.453152027;
|
||||||
|
public static var a5 = 1.061405429;
|
||||||
|
public static var p = 0.3275911;
|
||||||
|
|
||||||
|
public static function erf(x:Float):Float
|
||||||
|
{
|
||||||
|
// Save the sign of x
|
||||||
|
var sign = 1;
|
||||||
|
if (x < 0)
|
||||||
|
sign = -1;
|
||||||
|
x = Math.abs(x);
|
||||||
|
|
||||||
|
// A&S formula 7.1.26
|
||||||
|
var t = 1.0/(1.0 + p*x);
|
||||||
|
var y = 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*Math.exp(-x*x);
|
||||||
|
|
||||||
|
return sign*y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getNotes():Int
|
||||||
|
{
|
||||||
|
var notes:Int = 0;
|
||||||
|
for (i in 0...PlayState.SONG.notes.length)
|
||||||
|
{
|
||||||
|
for (ii in 0...PlayState.SONG.notes[i].sectionNotes.length)
|
||||||
|
{
|
||||||
|
var n = PlayState.SONG.notes[i].sectionNotes[ii];
|
||||||
|
if (n[1] <= 0)
|
||||||
|
notes++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return notes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getHolds():Int
|
||||||
|
{
|
||||||
|
var notes:Int = 0;
|
||||||
|
for (i in 0...PlayState.SONG.notes.length)
|
||||||
|
{
|
||||||
|
trace(PlayState.SONG.notes[i]);
|
||||||
|
for (ii in 0...PlayState.SONG.notes[i].sectionNotes.length)
|
||||||
|
{
|
||||||
|
var n = PlayState.SONG.notes[i].sectionNotes[ii];
|
||||||
|
trace(n);
|
||||||
|
if (n[1] > 0)
|
||||||
|
notes++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return notes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getMapMaxScore():Int
|
||||||
|
{
|
||||||
|
return (getNotes() * 350);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function wife3(maxms:Float, ts)
|
||||||
|
{
|
||||||
|
var max_points = 1.0;
|
||||||
|
var miss_weight = -5.5;
|
||||||
|
var ridic= 5 * ts;
|
||||||
|
var max_boo_weight = 180 * ts;
|
||||||
|
var ts_pow = 0.75;
|
||||||
|
var zero = 65 * (Math.pow(ts,ts_pow));
|
||||||
|
var power = 2.5;
|
||||||
|
var dev = 22.7 * (Math.pow(ts,ts_pow));
|
||||||
|
|
||||||
|
if (maxms <= ridic) // anything below this (judge scaled) threshold is counted as full pts
|
||||||
|
return max_points;
|
||||||
|
else if (maxms <= zero) // ma/pa region, exponential
|
||||||
|
return max_points * erf((zero - maxms) / dev);
|
||||||
|
else if (maxms <= max_boo_weight)// cb region, linear
|
||||||
|
return (maxms - zero) * miss_weight / (max_boo_weight - zero);
|
||||||
|
else
|
||||||
|
return miss_weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -40,6 +40,9 @@ class Note extends FlxSprite
|
|||||||
if (prevNote == null)
|
if (prevNote == null)
|
||||||
prevNote = this;
|
prevNote = this;
|
||||||
|
|
||||||
|
if (FlxG.save.data.downscroll)
|
||||||
|
flipY = true;
|
||||||
|
|
||||||
this.prevNote = prevNote;
|
this.prevNote = prevNote;
|
||||||
isSustainNote = sustainNote;
|
isSustainNote = sustainNote;
|
||||||
|
|
||||||
|
@ -1928,13 +1928,13 @@ class PlayState extends MusicBeatState
|
|||||||
if (SONG.validScore)
|
if (SONG.validScore)
|
||||||
{
|
{
|
||||||
#if !switch
|
#if !switch
|
||||||
Highscore.saveScore(SONG.song, songScore, storyDifficulty);
|
Highscore.saveScore(SONG.song, Math.round(songScore), storyDifficulty);
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isStoryMode)
|
if (isStoryMode)
|
||||||
{
|
{
|
||||||
campaignScore += songScore;
|
campaignScore += Math.round(songScore);
|
||||||
|
|
||||||
storyPlaylist.remove(storyPlaylist[0]);
|
storyPlaylist.remove(storyPlaylist[0]);
|
||||||
|
|
||||||
@ -2005,7 +2005,7 @@ class PlayState extends MusicBeatState
|
|||||||
private function popUpScore(strumtime:Float):Void
|
private function popUpScore(strumtime:Float):Void
|
||||||
{
|
{
|
||||||
var noteDiff:Float = Math.abs(strumtime - Conductor.songPosition);
|
var noteDiff:Float = Math.abs(strumtime - Conductor.songPosition);
|
||||||
var wife:Float = noteDiff / 1000;
|
var wife:Float = EtternaFunctions.wife3(noteDiff, 1);
|
||||||
// boyfriend.playAnim('hey');
|
// boyfriend.playAnim('hey');
|
||||||
vocals.volume = 1;
|
vocals.volume = 1;
|
||||||
|
|
||||||
@ -2017,14 +2017,15 @@ class PlayState extends MusicBeatState
|
|||||||
//
|
//
|
||||||
|
|
||||||
var rating:FlxSprite = new FlxSprite();
|
var rating:FlxSprite = new FlxSprite();
|
||||||
var score:Int = 350;
|
var score:Float = 350;
|
||||||
|
|
||||||
var daRating:String = "sick";
|
var daRating:String = "sick";
|
||||||
|
|
||||||
|
totalNotesHit += wife;
|
||||||
|
|
||||||
if (noteDiff > Conductor.safeZoneOffset * 2)
|
if (noteDiff > Conductor.safeZoneOffset * 2)
|
||||||
{
|
{
|
||||||
daRating = 'shit';
|
daRating = 'shit';
|
||||||
totalNotesHit -= 2 - wife;
|
|
||||||
ss = false;
|
ss = false;
|
||||||
if (theFunne)
|
if (theFunne)
|
||||||
{
|
{
|
||||||
@ -2037,7 +2038,6 @@ class PlayState extends MusicBeatState
|
|||||||
else if (noteDiff < Conductor.safeZoneOffset * -2)
|
else if (noteDiff < Conductor.safeZoneOffset * -2)
|
||||||
{
|
{
|
||||||
daRating = 'shit';
|
daRating = 'shit';
|
||||||
totalNotesHit -= 2 - wife;
|
|
||||||
if (theFunne)
|
if (theFunne)
|
||||||
{
|
{
|
||||||
score = -3000;
|
score = -3000;
|
||||||
@ -2050,7 +2050,6 @@ class PlayState extends MusicBeatState
|
|||||||
else if (noteDiff < Conductor.safeZoneOffset * -0.45)
|
else if (noteDiff < Conductor.safeZoneOffset * -0.45)
|
||||||
{
|
{
|
||||||
daRating = 'bad';
|
daRating = 'bad';
|
||||||
totalNotesHit += 0.2 - wife;
|
|
||||||
if (theFunne)
|
if (theFunne)
|
||||||
{
|
{
|
||||||
score = -1000;
|
score = -1000;
|
||||||
@ -2065,7 +2064,6 @@ class PlayState extends MusicBeatState
|
|||||||
else if (noteDiff > Conductor.safeZoneOffset * 0.45)
|
else if (noteDiff > Conductor.safeZoneOffset * 0.45)
|
||||||
{
|
{
|
||||||
daRating = 'bad';
|
daRating = 'bad';
|
||||||
totalNotesHit += 0.2 - wife;
|
|
||||||
if (theFunne)
|
if (theFunne)
|
||||||
{
|
{
|
||||||
score = -1000;
|
score = -1000;
|
||||||
@ -2080,7 +2078,6 @@ class PlayState extends MusicBeatState
|
|||||||
else if (noteDiff < Conductor.safeZoneOffset * -0.25)
|
else if (noteDiff < Conductor.safeZoneOffset * -0.25)
|
||||||
{
|
{
|
||||||
daRating = 'good';
|
daRating = 'good';
|
||||||
totalNotesHit += 0.65 - wife;
|
|
||||||
if (theFunne)
|
if (theFunne)
|
||||||
{
|
{
|
||||||
score = 200;
|
score = 200;
|
||||||
@ -2094,7 +2091,6 @@ class PlayState extends MusicBeatState
|
|||||||
else if (noteDiff > Conductor.safeZoneOffset * 0.35)
|
else if (noteDiff > Conductor.safeZoneOffset * 0.35)
|
||||||
{
|
{
|
||||||
daRating = 'good';
|
daRating = 'good';
|
||||||
totalNotesHit += 0.65 - wife;
|
|
||||||
if (theFunne)
|
if (theFunne)
|
||||||
{
|
{
|
||||||
score = 200;
|
score = 200;
|
||||||
@ -2107,19 +2103,20 @@ class PlayState extends MusicBeatState
|
|||||||
}
|
}
|
||||||
if (daRating == 'sick')
|
if (daRating == 'sick')
|
||||||
{
|
{
|
||||||
totalNotesHit += 1 - wife;
|
|
||||||
if (health < 2)
|
if (health < 2)
|
||||||
health += 0.1;
|
health += 0.1;
|
||||||
sicks++;
|
sicks++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trace('Weight: ' + wife);
|
||||||
|
|
||||||
// trace('Wife accuracy loss: ' + wife + ' | Rating: ' + daRating + ' | Score: ' + score + ' | Weight: ' + (1 - wife));
|
// trace('Wife accuracy loss: ' + wife + ' | Rating: ' + daRating + ' | Score: ' + score + ' | Weight: ' + (1 - wife));
|
||||||
|
|
||||||
if (daRating != 'shit' || daRating != 'bad')
|
if (daRating != 'shit' || daRating != 'bad')
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
songScore += score;
|
songScore += Math.round(score);
|
||||||
|
|
||||||
/* if (combo > 60)
|
/* if (combo > 60)
|
||||||
daRating = 'sick';
|
daRating = 'sick';
|
||||||
@ -2616,6 +2613,8 @@ class PlayState extends MusicBeatState
|
|||||||
fc = true;
|
fc = true;
|
||||||
totalPlayed += 1;
|
totalPlayed += 1;
|
||||||
accuracy = totalNotesHit / totalPlayed * 100;
|
accuracy = totalNotesHit / totalPlayed * 100;
|
||||||
|
trace('Notes Hit: ' + totalNotesHit + ' / ' + totalPlayed + ' = ' + accuracy);
|
||||||
|
trace(accuracy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user