Merge pull request #1 from osuAkatsuki/std-autopilot-rework

Implement autopilot PP
This commit is contained in:
James
2022-11-21 18:48:37 +00:00
committed by GitHub
5 changed files with 29 additions and 8 deletions
+2
View File
@@ -40,6 +40,7 @@ pub trait Mods: Copy {
fn ht(self) -> bool;
fn fl(self) -> bool;
fn so(self) -> bool;
fn ap(self) -> bool;
}
impl Mods for u32 {
@@ -85,4 +86,5 @@ impl Mods for u32 {
impl_mods!(ht, HT);
impl_mods!(fl, FL);
impl_mods!(so, SO);
impl_mods!(ap, AP);
}
+5
View File
@@ -149,6 +149,11 @@ impl<'map> OsuStars<'map> {
flashlight_rating *= 0.7;
}
if mods.ap() {
aim_rating = 0.0;
flashlight_rating *= 0.4;
}
let base_aim_performance = (5.0 * (aim_rating / 0.0675).max(1.0) - 4.0).powi(3) / 100_000.0;
let base_speed_performance =
(5.0 * (speed_rating / 0.0675).max(1.0) - 4.0).powi(3) / 100_000.0;
+7 -1
View File
@@ -456,6 +456,10 @@ impl OsuPpInner {
}
fn compute_aim_value(&self) -> f64 {
if self.mods.ap() {
return 0.0;
}
let mut aim_value = (5.0 * (self.attrs.aim / 0.0675).max(1.0) - 4.0).powi(3) / 100_000.0;
let total_hits = self.total_hits();
@@ -542,7 +546,9 @@ impl OsuPpInner {
speed_value *= self.get_combo_scaling_factor();
let ar_factor = if self.attrs.ar > 10.33 {
let ar_factor = if self.mods.ap() {
0.0
} else if self.attrs.ar > 10.33 {
0.3 * (self.attrs.ar - 10.33)
} else {
0.0
+1 -1
View File
@@ -31,7 +31,7 @@ impl Skills {
Self {
aim: Aim::new(true),
aim_no_sliders: Aim::new(false),
speed: Speed::new(hit_window),
speed: Speed::new(hit_window, mods),
flashlight: Flashlight::new(mods, radius, time_preempt, time_fade_in),
}
}
+14 -6
View File
@@ -1,6 +1,6 @@
use std::{cmp::Ordering, f64::consts::PI};
use crate::osu::difficulty_object::OsuDifficultyObject;
use crate::{osu::difficulty_object::OsuDifficultyObject, Mods};
use super::{next, previous, previous_start_time, OsuStrainSkill, Skill, StrainSkill};
@@ -13,13 +13,14 @@ pub(crate) struct Speed {
pub(crate) strain_peaks: Vec<f64>,
object_strains: Vec<f64>,
hit_window: f64,
mods: u32,
}
impl Speed {
const SKILL_MULTIPLIER: f64 = 1375.0;
const STRAIN_DECAY_BASE: f64 = 0.3;
pub(crate) fn new(hit_window: f64) -> Self {
pub(crate) fn new(hit_window: f64, mods: u32) -> Self {
Self {
curr_strain: 0.0,
curr_section_peak: 0.0,
@@ -28,6 +29,7 @@ impl Speed {
strain_peaks: Vec::new(),
object_strains: Vec::new(),
hit_window,
mods,
}
}
@@ -88,8 +90,9 @@ impl StrainSkill for Speed {
diff_objects: &[OsuDifficultyObject<'_>],
) -> f64 {
self.curr_strain *= Self::strain_decay(curr.strain_time);
self.curr_strain += SpeedEvaluator::evaluate_diff_of(curr, diff_objects, self.hit_window)
* Self::SKILL_MULTIPLIER;
self.curr_strain +=
SpeedEvaluator::evaluate_diff_of(curr, diff_objects, self.hit_window, self.mods)
* Self::SKILL_MULTIPLIER;
self.curr_rhythm = RhythmEvaluator::evaluate_diff_of(curr, diff_objects, self.hit_window);
let total_strain = self.curr_strain * self.curr_rhythm;
@@ -131,6 +134,7 @@ impl SpeedEvaluator {
curr: &OsuDifficultyObject<'_>,
diff_objects: &[OsuDifficultyObject<'_>],
hit_window: f64,
mods: u32,
) -> f64 {
if curr.base.is_spinner() {
return 0.0;
@@ -169,8 +173,12 @@ impl SpeedEvaluator {
};
let travel_dist = osu_prev_obj.map_or(0.0, |obj| obj.dists.travel_dist);
let dist =
Self::SINGLE_SPACING_THRESHOLD.min(travel_dist + osu_curr_obj.dists.min_jump_dist);
let dist = match mods.ap() {
true => 0.0,
false => {
Self::SINGLE_SPACING_THRESHOLD.min(travel_dist + osu_curr_obj.dists.min_jump_dist)
}
};
(speed_bonus + speed_bonus * (dist / Self::SINGLE_SPACING_THRESHOLD).powf(3.5))
* doubletapness