Struct rosu_pp::osu::OsuGradualPerformanceAttributes [−][src]
pub struct OsuGradualPerformanceAttributes<'map> { /* fields omitted */ }
Expand description
Gradually calculate the performance attributes of an osu!standard map.
After each hit object you can call
process_next_object
and it will return the resulting current OsuPerformanceAttributes
.
To process multiple objects at once, use
process_next_n_objects
instead.
Both methods require an OsuScoreState
that contains the current
hitresults as well as the maximum combo so far.
If you only want to calculate difficulty attributes use
OsuGradualDifficultyAttributes
instead.
Example
use rosu_pp::{Beatmap, osu::{OsuGradualPerformanceAttributes, OsuScoreState}};
let map: Beatmap = ...
let mods = 64; // DT
let mut gradual_perf = OsuGradualPerformanceAttributes::new(&map, mods);
let mut state = OsuScoreState::new(); // empty state, everything is on 0.
// The first 10 hitresults are 300s and there are no sliders for additional combo
for _ in 0..10 {
state.n300 += 1;
state.max_combo += 1;
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;
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;
let performance = gradual_perf.process_next_object(state.clone()).unwrap();
println!("PP: {}", performance.pp);
// Skip to the end
state.max_combo = ...
state.n300 = ...
state.n100 = ...
state.n50 = ...
state.misses = ...
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());
Implementations
Create a new gradual performance calculator for osu!standard maps.
pub fn process_next_object(
&mut self,
state: OsuScoreState
) -> Option<OsuPerformanceAttributes>
pub fn process_next_object(
&mut self,
state: OsuScoreState
) -> Option<OsuPerformanceAttributes>
Process the next hit object and calculate the performance attributes for the resulting score state.
pub fn process_next_n_objects(
&mut self,
state: OsuScoreState,
n: usize
) -> Option<OsuPerformanceAttributes>
pub fn process_next_n_objects(
&mut self,
state: OsuScoreState,
n: usize
) -> Option<OsuPerformanceAttributes>
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 OsuGradualPerformanceAttributes<'map>
impl<'map> Send for OsuGradualPerformanceAttributes<'map>
impl<'map> Sync for OsuGradualPerformanceAttributes<'map>
impl<'map> Unpin for OsuGradualPerformanceAttributes<'map>
impl<'map> UnwindSafe for OsuGradualPerformanceAttributes<'map>
Blanket Implementations
Mutably borrows from an owned value. Read more