rosu_pp/mania/
attributes.rs1use crate::mania::performance::ManiaPerformance;
2
3#[derive(Clone, Debug, Default, PartialEq)]
5pub struct ManiaDifficultyAttributes {
6 pub stars: f64,
8 pub n_objects: u32,
10 pub n_hold_notes: u32,
12 pub max_combo: u32,
14 pub is_convert: bool,
18}
19
20impl ManiaDifficultyAttributes {
21 pub const fn max_combo(&self) -> u32 {
23 self.max_combo
24 }
25
26 pub const fn n_objects(&self) -> u32 {
28 self.n_objects
29 }
30
31 pub const fn is_convert(&self) -> bool {
35 self.is_convert
36 }
37
38 pub fn performance<'a>(self) -> ManiaPerformance<'a> {
40 self.into()
41 }
42}
43
44#[derive(Clone, Debug, Default, PartialEq)]
46pub struct ManiaPerformanceAttributes {
47 pub difficulty: ManiaDifficultyAttributes,
49 pub pp: f64,
51 pub pp_difficulty: f64,
53}
54
55impl ManiaPerformanceAttributes {
56 pub const fn stars(&self) -> f64 {
58 self.difficulty.stars
59 }
60
61 pub const fn pp(&self) -> f64 {
63 self.pp
64 }
65
66 pub const fn max_combo(&self) -> u32 {
68 self.difficulty.max_combo
69 }
70
71 pub const fn n_objects(&self) -> u32 {
73 self.difficulty.n_objects
74 }
75
76 pub const fn is_convert(&self) -> bool {
80 self.difficulty.is_convert
81 }
82
83 pub fn performance<'a>(self) -> ManiaPerformance<'a> {
85 self.difficulty.into()
86 }
87}
88
89impl From<ManiaPerformanceAttributes> for ManiaDifficultyAttributes {
90 fn from(attributes: ManiaPerformanceAttributes) -> Self {
91 attributes.difficulty
92 }
93}