store hit_window in speed skill
This commit is contained in:
@@ -38,9 +38,8 @@ impl Skill for Aim {
|
||||
&mut self,
|
||||
curr: &OsuDifficultyObject<'_>,
|
||||
diff_objects: &[OsuDifficultyObject<'_>],
|
||||
hit_window: f64,
|
||||
) {
|
||||
<Self as StrainSkill>::process(self, curr, diff_objects, hit_window)
|
||||
<Self as StrainSkill>::process(self, curr, diff_objects)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -70,7 +69,6 @@ impl StrainSkill for Aim {
|
||||
&mut self,
|
||||
curr: &OsuDifficultyObject<'_>,
|
||||
diff_objects: &[OsuDifficultyObject<'_>],
|
||||
_hit_window: f64,
|
||||
) -> f64 {
|
||||
self.curr_strain *= Self::strain_decay(curr.delta_time);
|
||||
self.curr_strain += AimEvaluator::evaluate_diff_of(curr, diff_objects, self.with_sliders)
|
||||
|
||||
@@ -45,9 +45,8 @@ impl Skill for Flashlight {
|
||||
&mut self,
|
||||
curr: &OsuDifficultyObject<'_>,
|
||||
diff_objects: &[OsuDifficultyObject<'_>],
|
||||
hit_window: f64,
|
||||
) {
|
||||
<Self as StrainSkill>::process(self, curr, diff_objects, hit_window)
|
||||
<Self as StrainSkill>::process(self, curr, diff_objects)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -79,7 +78,6 @@ impl StrainSkill for Flashlight {
|
||||
&mut self,
|
||||
curr: &OsuDifficultyObject<'_>,
|
||||
diff_objects: &[OsuDifficultyObject<'_>],
|
||||
_hit_window: f64,
|
||||
) -> f64 {
|
||||
self.curr_strain *= Self::strain_decay(curr.delta_time);
|
||||
self.curr_strain += FlashlightEvaluator::evaluate_diff_of(
|
||||
|
||||
+12
-7
@@ -21,11 +21,17 @@ pub(crate) struct Skills {
|
||||
}
|
||||
|
||||
impl Skills {
|
||||
pub(crate) fn new(mods: u32, radius: f32, time_preempt: f64, time_fade_in: f64) -> Self {
|
||||
pub(crate) fn new(
|
||||
mods: u32,
|
||||
radius: f32,
|
||||
time_preempt: f64,
|
||||
time_fade_in: f64,
|
||||
hit_window: f64,
|
||||
) -> Self {
|
||||
Self {
|
||||
aim: Aim::new(true),
|
||||
aim_no_sliders: Aim::new(false),
|
||||
speed: Speed::new(),
|
||||
speed: Speed::new(hit_window),
|
||||
flashlight: Flashlight::new(mods, radius, time_preempt, time_fade_in),
|
||||
}
|
||||
}
|
||||
@@ -34,12 +40,11 @@ impl Skills {
|
||||
&mut self,
|
||||
curr: &OsuDifficultyObject<'_>,
|
||||
diff_objects: &[OsuDifficultyObject<'_>],
|
||||
hit_window: f64,
|
||||
) {
|
||||
<Aim as Skill>::process(&mut self.aim, curr, diff_objects, hit_window);
|
||||
<Aim as Skill>::process(&mut self.aim_no_sliders, curr, diff_objects, hit_window);
|
||||
<Speed as Skill>::process(&mut self.speed, curr, diff_objects, hit_window);
|
||||
<Flashlight as Skill>::process(&mut self.flashlight, curr, diff_objects, hit_window);
|
||||
<Aim as Skill>::process(&mut self.aim, curr, diff_objects);
|
||||
<Aim as Skill>::process(&mut self.aim_no_sliders, curr, diff_objects);
|
||||
<Speed as Skill>::process(&mut self.speed, curr, diff_objects);
|
||||
<Flashlight as Skill>::process(&mut self.flashlight, curr, diff_objects);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,13 +12,14 @@ pub(crate) struct Speed {
|
||||
curr_rhythm: f64,
|
||||
pub(crate) strain_peaks: Vec<f64>,
|
||||
object_strains: Vec<f64>,
|
||||
hit_window: f64,
|
||||
}
|
||||
|
||||
impl Speed {
|
||||
const SKILL_MULTIPLIER: f64 = 1375.0;
|
||||
const STRAIN_DECAY_BASE: f64 = 0.3;
|
||||
|
||||
pub(crate) fn new() -> Self {
|
||||
pub(crate) fn new(hit_window: f64) -> Self {
|
||||
Self {
|
||||
curr_strain: 0.0,
|
||||
curr_section_peak: 0.0,
|
||||
@@ -26,6 +27,7 @@ impl Speed {
|
||||
curr_rhythm: 0.0,
|
||||
strain_peaks: Vec::new(),
|
||||
object_strains: Vec::new(),
|
||||
hit_window,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,9 +55,8 @@ impl Skill for Speed {
|
||||
&mut self,
|
||||
curr: &OsuDifficultyObject<'_>,
|
||||
diff_objects: &[OsuDifficultyObject<'_>],
|
||||
hit_window: f64,
|
||||
) {
|
||||
<Self as StrainSkill>::process(self, curr, diff_objects, hit_window)
|
||||
<Self as StrainSkill>::process(self, curr, diff_objects)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -85,12 +86,11 @@ impl StrainSkill for Speed {
|
||||
&mut self,
|
||||
curr: &OsuDifficultyObject<'_>,
|
||||
diff_objects: &[OsuDifficultyObject<'_>],
|
||||
hit_window: f64,
|
||||
) -> f64 {
|
||||
self.curr_strain *= Self::strain_decay(curr.strain_time);
|
||||
self.curr_strain += SpeedEvaluator::evaluate_diff_of(curr, diff_objects, hit_window)
|
||||
self.curr_strain += SpeedEvaluator::evaluate_diff_of(curr, diff_objects, self.hit_window)
|
||||
* Self::SKILL_MULTIPLIER;
|
||||
self.curr_rhythm = RhythmEvaluator::evaluate_diff_of(curr, diff_objects, hit_window);
|
||||
self.curr_rhythm = RhythmEvaluator::evaluate_diff_of(curr, diff_objects, self.hit_window);
|
||||
|
||||
let total_strain = self.curr_strain * self.curr_rhythm;
|
||||
self.object_strains.push(total_strain);
|
||||
|
||||
@@ -3,12 +3,7 @@ use std::{cmp::Ordering, mem};
|
||||
use crate::osu::{difficulty_object::OsuDifficultyObject, SECTION_LEN};
|
||||
|
||||
pub(crate) trait Skill {
|
||||
fn process(
|
||||
&mut self,
|
||||
curr: &OsuDifficultyObject<'_>,
|
||||
diff_objects: &[OsuDifficultyObject<'_>],
|
||||
hit_window: f64,
|
||||
);
|
||||
fn process(&mut self, curr: &OsuDifficultyObject<'_>, diff_objects: &[OsuDifficultyObject<'_>]);
|
||||
fn difficulty_value(&mut self) -> f64;
|
||||
}
|
||||
|
||||
@@ -23,7 +18,6 @@ pub(crate) trait StrainSkill: Skill + Sized {
|
||||
&mut self,
|
||||
curr: &OsuDifficultyObject<'_>,
|
||||
diff_objects: &[OsuDifficultyObject<'_>],
|
||||
hit_window: f64,
|
||||
) -> f64;
|
||||
|
||||
fn calculate_initial_strain(
|
||||
@@ -37,7 +31,6 @@ pub(crate) trait StrainSkill: Skill + Sized {
|
||||
&mut self,
|
||||
curr: &OsuDifficultyObject<'_>,
|
||||
diff_objects: &[OsuDifficultyObject<'_>],
|
||||
hit_window: f64,
|
||||
) {
|
||||
// * The first object doesn't generate a strain, so we begin with an incremented section end
|
||||
if curr.idx == 0 {
|
||||
@@ -57,7 +50,7 @@ pub(crate) trait StrainSkill: Skill + Sized {
|
||||
}
|
||||
|
||||
*self.curr_section_peak() = self
|
||||
.strain_value_at(curr, diff_objects, hit_window)
|
||||
.strain_value_at(curr, diff_objects)
|
||||
.max(*self.curr_section_peak());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user