Skip to content

Commit

Permalink
feat(osu-rebalance-difficulty-calculator; DroidVisual): add slider ve…
Browse files Browse the repository at this point in the history
…locity bonus
  • Loading branch information
Rian8337 committed Mar 23, 2022
1 parent 5a06b61 commit 225ce05
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export class DroidVisual extends DroidSkill {
return 0;
}

const last: DifficultyHitObject | undefined = this.previous.at(0);

// Start with base density and give minimum global bonus for Hidden.
let strain: number =
(0.25 * current.noteDensity) / (1 + current.overlappingFactor * 5);
Expand All @@ -52,6 +54,26 @@ export class DroidVisual extends DroidSkill {
(1 + current.overlappingFactor * 2);
}

if (current.travelTime) {
const currentVelocity: number =
current.travelDistance / current.travelTime;

// Reward sliders based on velocity, while avoiding overbuffing extremely fast sliders.
strain += Math.min(10, currentVelocity * 1.5);

// Reward for velocity changes if the previous object is a slider.
if (last?.travelTime) {
const prevVelocity: number =
last.travelDistance / last.travelTime;

// Avoid overbuffing extremely fast sliders.
strain += Math.min(
10,
Math.abs(currentVelocity - prevVelocity) * 2.5
);
}
}

return strain;
}

Expand Down

0 comments on commit 225ce05

Please sign in to comment.