Skip to content

Commit

Permalink
Fix beatmap maximum score not accounting for ScoreV2
Browse files Browse the repository at this point in the history
  • Loading branch information
Rian8337 committed Jan 11, 2025
1 parent cc9422f commit d41e2e0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/osu-base/src/beatmap/Beatmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { PlayableBeatmapOptions } from "./PlayableBeatmapOptions";
import { Modes } from "../constants/Modes";
import { BeatmapProcessor } from "./BeatmapProcessor";
import { BeatmapConverter } from "./BeatmapConverter";
import { ModScoreV2 } from "../mods/ModScoreV2";

/**
* Represents a beatmap with advanced information.
Expand Down Expand Up @@ -176,6 +177,10 @@ export class Beatmap {
scoreMultiplier *= Math.pow(0.3, (1 - customSpeedMultiplier) * 4);
}

if (mods.some((m) => m instanceof ModScoreV2)) {
return 1e6 * scoreMultiplier;
}

const difficultyMultiplier =
1 +
this.difficulty.od / 10 +
Expand Down Expand Up @@ -236,6 +241,10 @@ export class Beatmap {
}
}

if (mods.some((m) => m instanceof ModScoreV2)) {
return 1e6 * scoreMultiplier;
}

switch (true) {
case accumulatedDiffPoints <= 5:
difficultyMultiplier = 2;
Expand Down
27 changes: 27 additions & 0 deletions packages/osu-base/tests/beatmap/Beatmap.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
ModHidden,
ModReallyEasy,
ModRelax,
ModScoreV2,
Modes,
ObjectTypes,
PathType,
Expand Down Expand Up @@ -316,6 +317,18 @@ describe("Test osu!droid max score calculation", () => {
test("With unranked mods", () => {
expect(beatmap.maxDroidScore([new ModRelax()])).toBe(0);
});

describe("With ScoreV2", () => {
test("Without extra mods", () => {
expect(beatmap.maxDroidScore([new ModScoreV2()])).toBe(1e6);
});

test("With extra mods", () => {
expect(
beatmap.maxDroidScore([new ModScoreV2(), new ModHidden()]),
).toBe(1.06e6);
});
});
});

describe("Test osu!standard max score calculation", () => {
Expand Down Expand Up @@ -390,6 +403,20 @@ describe("Test osu!standard max score calculation", () => {
test("With mods", () => {
expect(constructBeatmap().maxOsuScore([new ModHidden()])).toBe(300);
});

describe("With ScoreV2", () => {
const beatmap = constructBeatmap();

test("Without extra mods", () => {
expect(beatmap.maxOsuScore([new ModScoreV2()])).toBe(1e6);
});

test("With extra mods", () => {
expect(
beatmap.maxOsuScore([new ModScoreV2(), new ModHidden()]),
).toBe(1.06e6);
});
});
});

describe("Test string concatenation", () => {
Expand Down

0 comments on commit d41e2e0

Please sign in to comment.