Fix an issue where story mode medals would not be awarded without a personal best.

This commit is contained in:
EliteMasterEric
2025-04-02 13:33:06 -04:00
committed by Cameron Taylor
parent 4fa0334e7b
commit 54cd52db76
4 changed files with 18 additions and 14 deletions
+12 -13
View File
@@ -3017,7 +3017,7 @@ class PlayState extends MusicBeatSubState
}
});
// Award various medals based on variation, difficulty, and scoring rank.
// Award various medals based on variation, difficulty, song ID, and scoring rank.
if (scoreRank == ScoringRank.SHIT) Medals.award(LossRating);
if (scoreRank >= ScoringRank.PERFECT && currentDifficulty == 'hard') Medals.award(PerfectRatingHard);
if (scoreRank == ScoringRank.PERFECT_GOLD && currentDifficulty == 'hard') Medals.award(GoldPerfectRatingHard);
@@ -3062,19 +3062,18 @@ class PlayState extends MusicBeatSubState
},
};
if (currentSong.validScore
&& Save.instance.isLevelHighScore(PlayStatePlaylist.campaignId, PlayStatePlaylist.campaignDifficulty, data))
#if FEATURE_NEWGROUNDS
// Award a medal for beating a Story level.
Medals.awardStoryLevel(PlayStatePlaylist.campaignId);
// Submit the score for the Story level to Newgrounds.
Leaderboards.submitLevelScore(PlayStatePlaylist.campaignId, PlayStatePlaylist.campaignDifficulty, PlayStatePlaylist.campaignScore);
Events.logCompleteLevel(PlayStatePlaylist.campaignId);
#end
if (Save.instance.isLevelHighScore(PlayStatePlaylist.campaignId, PlayStatePlaylist.campaignDifficulty, data))
{
#if FEATURE_NEWGROUNDS
// Award a medal for beating a Story level.
Medals.awardStoryLevel(PlayStatePlaylist.campaignId);
// Submit the score for the Story level to Newgrounds.
Leaderboards.submitLevelScore(PlayStatePlaylist.campaignId, PlayStatePlaylist.campaignDifficulty, PlayStatePlaylist.campaignScore);
Events.logCompleteLevel(PlayStatePlaylist.campaignId);
#end
Save.instance.setLevelScore(PlayStatePlaylist.campaignId, PlayStatePlaylist.campaignDifficulty, data);
isNewHighscore = true;
}
+2 -1
View File
@@ -502,8 +502,9 @@ class ResultState extends MusicBeatSubState
clearPercentCounter.curNumber = clearPercentTarget;
#if FEATURE_NEWGROUNDS
var isScoreValid = !(params?.isPracticeMode ?? false) && !(params?.isBotPlayMode ?? false);
// This is the easiest spot to do the medal calculation lol.
if (clearPercentTarget == 69) Medals.award(Nice);
if (isScoreValid && clearPercentTarget == 69) Medals.award(Nice);
#end
clearPercentCounter.flash(true);
@@ -425,6 +425,7 @@ class CharSelectSubState extends MusicBeatSubState
else
{
#if FEATURE_NEWGROUNDS
// Make the character unlock medal retroactive.
if (availableChars.size() > 1) Medals.award(CharSelect);
#end
@@ -570,6 +571,7 @@ class CharSelectSubState extends MusicBeatSubState
});
#if FEATURE_NEWGROUNDS
// Grant the medal when the player unlocks a character.
Medals.award(CharSelect);
#end
@@ -126,6 +126,8 @@ class ResultsDebugSubState extends MusicBeatSubState
characterId: "bf",
difficultyId: "nightmare",
isNewHighscore: true,
isPracticeMode: true, // Invalidates achievements/scores.
isBotPlayMode: true, // Invalidates achievements/scores.
scoreData:
{
score: 1_234_567,