Enum rosu_pp::GradualPerformanceAttributes [−][src]
pub enum GradualPerformanceAttributes<'map> {
Fruits(FruitsGradualPerformanceAttributes<'map>),
Mania(ManiaGradualPerformanceAttributes<'map>),
Osu(OsuGradualPerformanceAttributes<'map>),
Taiko(TaikoGradualPerformanceAttributes<'map>),
}
Expand description
Gradually calculate the performance attributes on maps of any mode.
After each hit object you can call
process_next_object
and it will return the resulting current PerformanceAttributes
.
To process multiple objects at once, use
process_next_n_objects
instead.
Both methods require a ScoreState
that contains the current hitresults
as well as the maximum combo so far or just the current score for osu!mania.
Since the map could have any mode, all fields of ScoreState
could be of use
and should be updated properly.
Alternatively, you can match on the map’s mode yourself and use the gradual
performance attribute struct for the corresponding mode, i.e.
FruitsGradualPerformanceAttributes
,
ManiaGradualPerformanceAttributes
,
OsuGradualPerformanceAttributes
, or
TaikoGradualPerformanceAttributes
.
If you only want to calculate difficulty attributes use
GradualDifficultyAttributes
instead.
Example
use rosu_pp::{Beatmap, GradualPerformanceAttributes, ScoreState};
let map: Beatmap = ...
let mods = 64; // DT
let mut gradual_perf = GradualPerformanceAttributes::new(&map, mods);
let mut state = ScoreState::new(); // empty state, everything is on 0.
// The first 10 hitresults are 300s and increase the score by 123 each.
for _ in 0..10 {
state.n300 += 1;
state.max_combo += 1;
state.score += 123;
let performance = gradual_perf.process_next_object(state.clone()).unwrap();
println!("PP: {}", performance.pp);
}
// Then comes a miss.
// Note that state's max combo won't be incremented for
// the next few objects because the combo is reset.
state.misses += 1;
let performance = gradual_perf.process_next_object(state.clone()).unwrap();
println!("PP: {}", performance.pp);
// The next 10 objects will be a mixture of 300s, 100s, and 50s.
// Notice how all 10 objects will be processed in one go.
state.n300 += 2;
state.n100 += 7;
state.n50 += 1;
state.score += 987;
// Don't forget state.n_katu
let performance = gradual_perf.process_next_n_objects(state.clone(), 10).unwrap();
println!("PP: {}", performance.pp);
// Now comes another 300. Note that the max combo gets incremented again.
state.n300 += 1;
state.max_combo += 1;
state.score += 123;
let performance = gradual_perf.process_next_object(state.clone()).unwrap();
println!("PP: {}", performance.pp);
// Skip to the end
state.max_combo = ...
state.n300 = ...
...
let final_performance = gradual_perf.process_next_n_objects(state.clone(), usize::MAX).unwrap();
println!("PP: {}", performance.pp);
// Once the final performance was calculated,
// attempting to process further objects will return `None`.
assert!(gradual_perf.process_next_object(state).is_none());
Variants
Fruits(FruitsGradualPerformanceAttributes<'map>)
Tuple Fields
0: FruitsGradualPerformanceAttributes<'map>
Gradual osu!ctb performance attributes.
Mania(ManiaGradualPerformanceAttributes<'map>)
Tuple Fields
0: ManiaGradualPerformanceAttributes<'map>
Gradual osu!mania performance attributes.
Osu(OsuGradualPerformanceAttributes<'map>)
Tuple Fields
0: OsuGradualPerformanceAttributes<'map>
Gradual osu!standard performance attributes.
Taiko(TaikoGradualPerformanceAttributes<'map>)
Tuple Fields
0: TaikoGradualPerformanceAttributes<'map>
Gradual osu!taiko performance attributes.
Implementations
Create a new gradual performance calculator for maps of any mode.
Process the next hit object and calculate the performance attributes for the resulting score.
pub fn process_next_n_objects(
&mut self,
state: ScoreState,
n: usize
) -> Option<PerformanceAttributes>
pub fn process_next_n_objects(
&mut self,
state: ScoreState,
n: usize
) -> Option<PerformanceAttributes>
Same as process_next_object
but instead of processing only one object it process n
many.
If n
is 0 it will be considered as 1.
If there are still objects to be processed but n
is larger than the amount
of remaining objects, n
will be considered as the amount of remaining objects.
Trait Implementations
Auto Trait Implementations
impl<'map> RefUnwindSafe for GradualPerformanceAttributes<'map>
impl<'map> Send for GradualPerformanceAttributes<'map>
impl<'map> Sync for GradualPerformanceAttributes<'map>
impl<'map> Unpin for GradualPerformanceAttributes<'map>
impl<'map> UnwindSafe for GradualPerformanceAttributes<'map>
Blanket Implementations
Mutably borrows from an owned value. Read more