diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 3b8d3e8b9..ac4e1670e 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -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; } diff --git a/source/funkin/play/ResultState.hx b/source/funkin/play/ResultState.hx index 976fcd5ee..9a6cb0343 100644 --- a/source/funkin/play/ResultState.hx +++ b/source/funkin/play/ResultState.hx @@ -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); diff --git a/source/funkin/ui/charSelect/CharSelectSubState.hx b/source/funkin/ui/charSelect/CharSelectSubState.hx index eb7adb6a7..48a88be33 100644 --- a/source/funkin/ui/charSelect/CharSelectSubState.hx +++ b/source/funkin/ui/charSelect/CharSelectSubState.hx @@ -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 diff --git a/source/funkin/ui/debug/results/ResultsDebugSubState.hx b/source/funkin/ui/debug/results/ResultsDebugSubState.hx index 011888991..81628f30f 100644 --- a/source/funkin/ui/debug/results/ResultsDebugSubState.hx +++ b/source/funkin/ui/debug/results/ResultsDebugSubState.hx @@ -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,