This repository has been archived on 2023-11-06. You can view files and clone it, but cannot push or open issues or pull requests.
beatsaber-overlay/src/curve/BeatLeaderCurve.js

15 lines
433 B
JavaScript
Raw Normal View History

2022-10-21 16:12:32 +00:00
function curve(acc, stars) {
var l = 1 - (0.03 * (stars - 3.0)) / 11.0;
var a = 0.96 * l;
var f = 1.2 - (0.6 * stars) / 14.0;
return Math.pow(Math.log10(l / (l - acc)) / Math.log10(l / (l - a)), f);
}
2022-10-21 16:12:32 +00:00
export function getBeatLeaderPP(acc, stars) {
if (stars === undefined || acc === undefined) {
return undefined;
}
2022-10-21 16:12:32 +00:00
const pp = curve(acc / 100, stars - 0.5) * (stars + 0.5) * 42;
return Number.isNaN(pp) ? undefined : pp;
}