Skip to content

Commit 6b73196

Browse files
committed
chore: prepare for mania
1 parent e6ef0f4 commit 6b73196

File tree

2 files changed

+33
-21
lines changed

2 files changed

+33
-21
lines changed

packages/tosu/src/states/beatmap.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,14 +664,17 @@ export class BeatmapPP extends AbstractState {
664664

665665
const beatmapAttributes = calculateBeatmapAttributes({
666666
isConvert: this.mode !== currentMode,
667+
isLazer: commonParams.lazer,
667668

668669
ar: this.beatmap.native.approachRate,
669670
cs: this.beatmap.native.circleSize,
670671
od: this.beatmap.native.overallDifficulty,
671672
hp: this.beatmap.native.drainRate,
672673

673674
mode: currentMode,
674-
mods: currentMods
675+
mods: commonParams.mods,
676+
677+
rate: currentMods.rate
675678
});
676679

677680
this.calculatedMapAttributes = {

packages/tosu/src/utils/calculators.ts

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CalculateMods, Mod, ModsLazer, Rulesets } from '@tosu/common';
1+
import { Mod, ModsLazer, Rulesets } from '@tosu/common';
22
import { HitObject } from 'osu-classes';
33

44
import { Statistics } from '@/states/types';
@@ -248,18 +248,23 @@ export const calculatePassedObjects = (
248248

249249
export const calculateBeatmapAttributes = (params: {
250250
isConvert: boolean;
251+
isLazer: boolean;
251252

252253
ar: number;
253254
cs: number;
254255
od: number;
255256
hp: number;
256257

257258
mode: number;
258-
mods: CalculateMods;
259+
mods: ModsLazer;
260+
261+
rate: number;
259262
}) => {
260-
const isEz = params.mods.array.some((r) => r.acronym === 'EZ');
261-
const isHr = params.mods.array.some((r) => r.acronym === 'HR');
262-
const DA = (params.mods.array as Mod[]).find((r) => r.acronym === 'DA');
263+
const isEz = params.mods.some((r) => r.acronym === 'EZ');
264+
const isHr = params.mods.some((r) => r.acronym === 'HR');
265+
// const isV2 = params.mods.some((r) => r.acronym === 'SV2');
266+
267+
const DA = (params.mods as Mod[]).find((r) => r.acronym === 'DA');
263268
const multiply = isHr ? 1.4 : isEz ? 0.5 : 1;
264269

265270
const AR = DA?.settings?.approach_rate ?? params.ar;
@@ -272,34 +277,38 @@ export const calculateBeatmapAttributes = (params: {
272277
const csConverted = isHr ? Math.min(CS * 1.3, 10) : CS * multiply;
273278
const hpConverted = isHr ? Math.min(HP * multiply, 10) : HP * multiply;
274279

275-
if (params.mods.rate !== 1) {
280+
if (params.isLazer && params.mode === Rulesets.mania) {
281+
// they do some magic shit here
282+
}
283+
284+
if (params.rate !== 1) {
276285
arConverted =
277286
arConverted <= 5
278-
? 15 - (15 - arConverted) / (1 * params.mods.rate)
279-
: 13 - (13 - arConverted) / (1 * params.mods.rate);
287+
? 15 - (15 - arConverted) / (1 * params.rate)
288+
: 13 - (13 - arConverted) / (1 * params.rate);
280289

281290
switch (params.mode) {
282291
case Rulesets.osu:
283-
odConverted =
284-
13.33 - (13.33 - odConverted) / (1 * params.mods.rate);
292+
odConverted = 13.33 - (13.33 - odConverted) / (1 * params.rate);
285293
break;
286294

287295
case Rulesets.taiko:
288296
odConverted =
289297
16.66666666666667 -
290-
(16.66666666666667 - odConverted) / (1 * params.mods.rate);
298+
(16.66666666666667 - odConverted) / (1 * params.rate);
291299
break;
292300

293301
case Rulesets.mania: {
294-
// if (commonParams.lazer === true || (commonParams.lazer === false && isV2))
295-
// odMs = _OD <= 5 ? 22.4 - 0.6 * _OD : 24.9 - 1.1 * _OD;
296-
297-
// else if (this.mode !== currentMode)
298-
// odMs = 16;
299-
300-
// else
301-
// odMs = 16;
302-
// odMs = Math.floor(72 - 6 * _OD);
302+
// also some dark magic shit right here
303+
// if (params.isLazer === false && isV2)
304+
// odConverted =
305+
// odConverted <= 5
306+
// ? 37.33 - (37.33 - odConverted)
307+
// : 22.63636363636364 -
308+
// (22.63636363636364 - odConverted);
309+
// else if (params.isConvert)
310+
// odConverted = 16 - (16 - odConverted);
311+
// else odConverted = 16 - (16 - odConverted);
303312
break;
304313
}
305314
}

0 commit comments

Comments
 (0)