Skip to content

Commit

Permalink
combo fix!
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackx2 committed Jan 5, 2025
1 parent e612c6c commit c6d1e51
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 26 deletions.
29 changes: 18 additions & 11 deletions source/funkin/game/objects/scorebars/AstroScore.hx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AstroScore extends BaseScorebar
private var shitsTxt:FlxText;
private var missTxt:FlxText;

override function create()
override function create():Void
{
scoreText = new FlxText(0, defaultPos.y + 36, FlxG.width, "erm, owo???", 20);
scoreText.scrollFactor.set();
Expand Down Expand Up @@ -104,16 +104,16 @@ class AstroScore extends BaseScorebar
game.baseUI.timeTxt.setFormat(Paths.font("PhantomMuff.ttf"), 32, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
}

override function update(f)
override function update(elapsed:Float):Void
{
super.update(f);
super.update(elapsed);

songLeft.text = FlxStringUtil.formatTime(Math.max(0, Math.floor((Conductor.songPosition - ClientPrefs.data.noteOffset) / 1000)), false)
+ ""
+ FlxStringUtil.formatTime(Math.max(0, Math.floor(FlxG.sound.music.length / 1000)), false);
}

override function updateScore()
override function updateScore():Void
{
scoreText.text = 'Score: '
+ game.songScore
Expand All @@ -124,13 +124,20 @@ class AstroScore extends BaseScorebar
+ (game.ratingName != '?' ? ' (${Highscore.floorDecimal(game.ratingPercent * 100, 2)}%) - ${game.ratingFC}' : '');

if (ClientPrefs.data.showRatingStats)
{
sickTxt.text = 'Sick: ${game.sicks}';
goodsTxt.text = 'Good: ${game.goods}';
badTxt.text = 'Bad: ${game.bads}';
shitsTxt.text = 'Shit: ${game.shits}';
missTxt.text = 'Miss: ${game.songMisses}';
};
updateStats();
}

@:dox(show) private dynamic function updateStats(){
final sicks:Int = game.ratingsData[0].hits;
final goods:Int = game.ratingsData[1].hits;
final bads:Int = game.ratingsData[2].hits;
final shits:Int = game.ratingsData[3].hits;

sickTxt.text = 'Sick: ${sicks}';
goodsTxt.text = 'Good: ${goods}';
badTxt.text = 'Bad: ${bads}';
shitsTxt.text = 'Shit: ${shits}';
missTxt.text = 'Miss: ${game.songMisses}';
}

@:dox(show) private function addCurveBG(x:Float = 0, y:Float = 0, width:Float = 0, height:Float = 0, ellipseWidthAndHeight:Int = 0, startAlpha:Int = 0,
Expand Down
36 changes: 21 additions & 15 deletions source/funkin/game/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,6 @@ class PlayState extends MusicBeatState

// Song Stats
public var ratingsData:Array<Rating> = Rating.loadDefault();
public var sicks:Int = 0;
public var goods:Int = 0;
public var bads:Int = 0;
public var shits:Int = 0;
public var songScore:Int = 0;
public var songHits:Int = 0;
public var songMisses:Int = 0;
Expand Down Expand Up @@ -4006,24 +4002,34 @@ class PlayState extends MusicBeatState
}

// Rating FC
ratingFC = "";
if (sicks > 0)
ratingFC = "SFC";
if (goods > 0)
ratingFC = "GFC";
if (bads > 0 || shits > 0)
ratingFC = "FC";
if (songMisses > 0 && songMisses < 10)
ratingFC = "SDCB";
else if (songMisses >= 10)
ratingFC = "Clear";
fullComboFunction();
}
updateScore(badHit); // score will only update after rating is calculated, if it's a badHit, it shouldn't bounce -Ghost
setOnScripts('rating', ratingPercent);
setOnScripts('ratingName', ratingName);
setOnScripts('ratingFC', ratingFC);
}

public dynamic function fullComboFunction()
{
var sicks:Int = ratingsData[0].hits;
var goods:Int = ratingsData[1].hits;
var bads:Int = ratingsData[2].hits;
var shits:Int = ratingsData[3].hits;

ratingFC = "TBC";
if(songMisses == 0)
{
if (bads > 0 || shits > 0) ratingFC = 'FC';
else if (goods > 0) ratingFC = 'GFC';
else if (sicks > 0) ratingFC = 'SFC';
}
else {
if (songMisses < 10) ratingFC = 'SDCB';
else ratingFC = 'Clear';
}
}

#if ACHIEVEMENTS_ALLOWED
private function checkForAchievement(achievesToCheck:Array<String> = null)
{
Expand Down

0 comments on commit c6d1e51

Please sign in to comment.