various minor adjustments
This commit is contained in:
+2
-2
@@ -20,8 +20,8 @@ use crate::{
|
||||
/// let pp_result = TaikoPP::new(&map)
|
||||
/// .mods(8 + 64) // HDDT
|
||||
/// .combo(1234)
|
||||
/// .n_misses(1)
|
||||
/// .accuracy(98.5)
|
||||
/// .n_misses(1)
|
||||
/// .calculate();
|
||||
///
|
||||
/// println!("PP: {} | Stars: {}", pp_result.pp(), pp_result.stars());
|
||||
@@ -134,7 +134,7 @@ impl<'map> TaikoPP<'map> {
|
||||
self
|
||||
}
|
||||
|
||||
/// Specify the accuracy of a play between `0` and `100`.
|
||||
/// Specify the accuracy of a play between `0.0` and `100.0`.
|
||||
/// This will be used to generate matching hitresults.
|
||||
#[inline]
|
||||
pub fn accuracy(mut self, acc: f64) -> Self {
|
||||
|
||||
@@ -30,32 +30,39 @@ impl Colour {
|
||||
}
|
||||
|
||||
impl Skill for Colour {
|
||||
#[inline]
|
||||
fn process(&mut self, curr: &TaikoDifficultyObject, hit_objects: &ObjectLists) {
|
||||
<Self as StrainSkill>::process(self, curr, hit_objects)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn difficulty_value(self) -> f64 {
|
||||
<Self as StrainSkill>::difficulty_value(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl StrainSkill for Colour {
|
||||
#[inline]
|
||||
fn strain_peaks_mut(&mut self) -> &mut Vec<f64> {
|
||||
&mut self.strain_peaks
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn curr_section_peak(&mut self) -> &mut f64 {
|
||||
&mut self.curr_section_peak
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn curr_section_end(&mut self) -> &mut f64 {
|
||||
&mut self.curr_section_end
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn strain_value_at(&mut self, curr: &TaikoDifficultyObject, hit_objects: &ObjectLists) -> f64 {
|
||||
<Self as StrainDecaySkill>::strain_value_at(self, curr, hit_objects)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn calculate_initial_strain(&self, time: f64, curr: &TaikoDifficultyObject) -> f64 {
|
||||
<Self as StrainDecaySkill>::calculate_initial_strain(self, time, curr)
|
||||
}
|
||||
@@ -65,14 +72,17 @@ impl StrainDecaySkill for Colour {
|
||||
const SKILL_MULTIPLIER: f64 = 0.12;
|
||||
const STRAIN_DECAY_BASE: f64 = 0.8;
|
||||
|
||||
#[inline]
|
||||
fn curr_strain(&self) -> f64 {
|
||||
self.curr_strain
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn curr_strain_mut(&mut self) -> &mut f64 {
|
||||
&mut self.curr_strain
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn strain_value_of(&mut self, curr: &TaikoDifficultyObject, _: &ObjectLists) -> f64 {
|
||||
ColourEvaluator::evaluate_diff_of(curr)
|
||||
}
|
||||
|
||||
@@ -51,11 +51,13 @@ pub(crate) trait StrainSkill: Skill {
|
||||
.max(*self.curr_section_peak());
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn save_curr_peak(&mut self) {
|
||||
let peak = *self.curr_section_peak();
|
||||
self.strain_peaks_mut().push(peak);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn start_new_section_from(&mut self, time: f64, curr: &TaikoDifficultyObject) {
|
||||
// * The maximum strain of the new section is not zero by default
|
||||
// * This means we need to capture the strain level at the beginning of the new section,
|
||||
@@ -84,6 +86,7 @@ pub(crate) trait StrainSkill: Skill {
|
||||
difficulty
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_curr_strain_peaks(mut self) -> Vec<f64> {
|
||||
let curr_peak = *self.curr_section_peak();
|
||||
let mut strain_peaks = mem::take(self.strain_peaks_mut());
|
||||
@@ -102,10 +105,12 @@ pub(crate) trait StrainDecaySkill: StrainSkill {
|
||||
|
||||
fn strain_value_of(&mut self, curr: &TaikoDifficultyObject, hit_objects: &ObjectLists) -> f64;
|
||||
|
||||
#[inline]
|
||||
fn calculate_initial_strain(&self, time: f64, curr: &TaikoDifficultyObject) -> f64 {
|
||||
self.curr_strain() * self.strain_decay(time - curr.prev_time)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn strain_value_at(&mut self, curr: &TaikoDifficultyObject, hit_objects: &ObjectLists) -> f64 {
|
||||
*self.curr_strain_mut() *= self.strain_decay(curr.delta);
|
||||
*self.curr_strain_mut() += self.strain_value_of(curr, hit_objects) * Self::SKILL_MULTIPLIER;
|
||||
@@ -113,6 +118,7 @@ pub(crate) trait StrainDecaySkill: StrainSkill {
|
||||
self.curr_strain()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn strain_decay(&self, ms: f64) -> f64 {
|
||||
Self::STRAIN_DECAY_BASE.powf(ms / 1000.0)
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ impl Peaks {
|
||||
}
|
||||
|
||||
impl Skill for Peaks {
|
||||
#[inline]
|
||||
fn process(&mut self, curr: &TaikoDifficultyObject, hit_objects: &ObjectLists) {
|
||||
<Colour as Skill>::process(&mut self.colour, curr, hit_objects);
|
||||
<Rhythm as Skill>::process(&mut self.rhythm, curr, hit_objects);
|
||||
|
||||
@@ -100,32 +100,39 @@ impl Rhythm {
|
||||
}
|
||||
|
||||
impl Skill for Rhythm {
|
||||
#[inline]
|
||||
fn process(&mut self, curr: &TaikoDifficultyObject, hit_objects: &ObjectLists) {
|
||||
<Self as StrainSkill>::process(self, curr, hit_objects)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn difficulty_value(self) -> f64 {
|
||||
<Self as StrainSkill>::difficulty_value(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl StrainSkill for Rhythm {
|
||||
#[inline]
|
||||
fn strain_peaks_mut(&mut self) -> &mut Vec<f64> {
|
||||
&mut self.strain_peaks
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn curr_section_peak(&mut self) -> &mut f64 {
|
||||
&mut self.curr_section_peak
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn curr_section_end(&mut self) -> &mut f64 {
|
||||
&mut self.curr_section_end
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn strain_value_at(&mut self, curr: &TaikoDifficultyObject, hit_objects: &ObjectLists) -> f64 {
|
||||
<Self as StrainDecaySkill>::strain_value_at(self, curr, hit_objects)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn calculate_initial_strain(&self, time: f64, curr: &TaikoDifficultyObject) -> f64 {
|
||||
<Self as StrainDecaySkill>::calculate_initial_strain(self, time, curr)
|
||||
}
|
||||
@@ -135,10 +142,12 @@ impl StrainDecaySkill for Rhythm {
|
||||
const SKILL_MULTIPLIER: f64 = 10.0;
|
||||
const STRAIN_DECAY_BASE: f64 = 0.0;
|
||||
|
||||
#[inline]
|
||||
fn curr_strain(&self) -> f64 {
|
||||
self.curr_decay_strain
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn curr_strain_mut(&mut self) -> &mut f64 {
|
||||
&mut self.curr_decay_strain
|
||||
}
|
||||
|
||||
@@ -22,32 +22,39 @@ impl Stamina {
|
||||
}
|
||||
|
||||
impl Skill for Stamina {
|
||||
#[inline]
|
||||
fn process(&mut self, curr: &TaikoDifficultyObject, hit_objects: &ObjectLists) {
|
||||
<Self as StrainSkill>::process(self, curr, hit_objects)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn difficulty_value(self) -> f64 {
|
||||
<Self as StrainSkill>::difficulty_value(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl StrainSkill for Stamina {
|
||||
#[inline]
|
||||
fn strain_peaks_mut(&mut self) -> &mut Vec<f64> {
|
||||
&mut self.strain_peaks
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn curr_section_peak(&mut self) -> &mut f64 {
|
||||
&mut self.curr_section_peak
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn curr_section_end(&mut self) -> &mut f64 {
|
||||
&mut self.curr_section_end
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn strain_value_at(&mut self, curr: &TaikoDifficultyObject, hit_objects: &ObjectLists) -> f64 {
|
||||
<Self as StrainDecaySkill>::strain_value_at(self, curr, hit_objects)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn calculate_initial_strain(&self, time: f64, curr: &TaikoDifficultyObject) -> f64 {
|
||||
<Self as StrainDecaySkill>::calculate_initial_strain(self, time, curr)
|
||||
}
|
||||
@@ -57,14 +64,17 @@ impl StrainDecaySkill for Stamina {
|
||||
const SKILL_MULTIPLIER: f64 = 1.1;
|
||||
const STRAIN_DECAY_BASE: f64 = 0.4;
|
||||
|
||||
#[inline]
|
||||
fn curr_strain(&self) -> f64 {
|
||||
self.curr_strain
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn curr_strain_mut(&mut self) -> &mut f64 {
|
||||
&mut self.curr_strain
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn strain_value_of(&mut self, curr: &TaikoDifficultyObject, hit_objects: &ObjectLists) -> f64 {
|
||||
StaminaEvaluator::evaluate_diff_of(curr, hit_objects)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user