added 'state' methods to PP calculator structs
This commit is contained in:
@@ -152,15 +152,11 @@ impl<'map> TaikoGradualPerformanceAttributes<'map> {
|
||||
let n = n.min(self.difficulty.len()).saturating_sub(1);
|
||||
let difficulty = self.difficulty.nth(n)?;
|
||||
|
||||
let _ = self.performance.n300.insert(state.n300);
|
||||
let _ = self.performance.n100.insert(state.n100);
|
||||
self.performance.n_misses = state.misses;
|
||||
|
||||
let performance = self
|
||||
.performance
|
||||
.clone()
|
||||
.attributes(difficulty)
|
||||
.combo(state.max_combo)
|
||||
.state(state)
|
||||
.passed_objects(self.difficulty.idx)
|
||||
.calculate();
|
||||
|
||||
|
||||
+23
-1
@@ -1,4 +1,4 @@
|
||||
use super::{stars, TaikoDifficultyAttributes, TaikoPerformanceAttributes};
|
||||
use super::{stars, TaikoDifficultyAttributes, TaikoPerformanceAttributes, TaikoScoreState};
|
||||
use crate::{Beatmap, DifficultyAttributes, Mods, PerformanceAttributes};
|
||||
|
||||
/// Performance calculator on osu!taiko maps.
|
||||
@@ -127,6 +127,10 @@ impl<'map> TaikoPP<'map> {
|
||||
}
|
||||
|
||||
/// Amount of passed objects for partial plays, e.g. a fail.
|
||||
///
|
||||
/// If you want to calculate the performance after every few objects, instead of
|
||||
/// using [`TaikoPP`] multiple times with different `passed_objects`, you should use
|
||||
/// [`TaikoGradualPerformanceAttributes`](crate::taiko::TaikoGradualPerformanceAttributes).
|
||||
#[inline]
|
||||
pub fn passed_objects(mut self, passed_objects: usize) -> Self {
|
||||
self.passed_objects.replace(passed_objects);
|
||||
@@ -134,6 +138,24 @@ impl<'map> TaikoPP<'map> {
|
||||
self
|
||||
}
|
||||
|
||||
/// Provide parameters through a [`TaikoScoreState`].
|
||||
#[inline]
|
||||
pub fn state(mut self, state: TaikoScoreState) -> Self {
|
||||
let TaikoScoreState {
|
||||
max_combo,
|
||||
n300,
|
||||
n100,
|
||||
misses,
|
||||
} = state;
|
||||
|
||||
self.combo = Some(max_combo);
|
||||
self.n300 = Some(n300);
|
||||
self.n100 = Some(n100);
|
||||
self.n_misses = misses;
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
/// Calculate all performance related values, including pp and stars.
|
||||
pub fn calculate(mut self) -> TaikoPerformanceAttributes {
|
||||
let attributes = self
|
||||
|
||||
Reference in New Issue
Block a user