Skip to content

Commit

Permalink
Fix mods not being applied in user beatmap calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
Rian8337 committed Jul 16, 2024
1 parent bbe38e4 commit f858ba6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/utils/helpers/BeatmapDifficultyHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,14 @@ export abstract class BeatmapDifficultyHelper<
accPercent = NumberHelper.clamp(newAccPercent, 0, 100);
}
}

if (input.endsWith("m")) {
const newCountMiss = parseInt(input);
if (!Number.isNaN(newCountMiss)) {
countMiss = Math.max(0, newCountMiss);
}
}

if (input.endsWith("x")) {
if (input.includes(".")) {
const newSpeedMultiplier = parseFloat(input);
Expand All @@ -129,9 +131,11 @@ export abstract class BeatmapDifficultyHelper<
}
}
}

if (input.startsWith("+")) {
mods.push(...ModUtil.pcStringToMods(input.replace("+", "")));
}

if (input.startsWith("CS")) {
const newForceCS = parseFloat(input.substring(2));
if (!Number.isNaN(newForceCS)) {
Expand All @@ -142,6 +146,7 @@ export abstract class BeatmapDifficultyHelper<
);
}
}

if (input.startsWith("AR")) {
const newForceAR = parseFloat(input.substring(2));
if (!Number.isNaN(newForceAR)) {
Expand All @@ -152,6 +157,7 @@ export abstract class BeatmapDifficultyHelper<
);
}
}

if (input.startsWith("OD")) {
const newForceOD = parseFloat(input.substring(2));
if (!Number.isNaN(newForceOD)) {
Expand All @@ -162,12 +168,14 @@ export abstract class BeatmapDifficultyHelper<
);
}
}

if (input.endsWith("x50")) {
const newCount50 = parseInt(input);
if (!Number.isNaN(newCount50)) {
count50 = Math.max(0, newCount50);
}
}

if (input.endsWith("x100")) {
const newCount100 = parseInt(input);
if (!Number.isNaN(newCount100)) {
Expand All @@ -177,6 +185,7 @@ export abstract class BeatmapDifficultyHelper<
}

return new PerformanceCalculationParameters({
mods: mods,
accuracy: new Accuracy({
n100: count100,
n50: count50,
Expand Down

0 comments on commit f858ba6

Please sign in to comment.