renamed 'attributes' field to 'difficulty' for performance attributes

This commit is contained in:
MaxOhn
2021-11-21 04:15:41 +01:00
parent bdc2927963
commit df022ee428
11 changed files with 43 additions and 42 deletions
+1
View File
@@ -8,6 +8,7 @@
- [BREAKING] Added the field `TaikoDifficultyAttributes::max_combo`
- Added method `Beatmap::bpm`
- Added method `max_combo` for `DifficultyAttributes`, `PerformanceAttributes`, and all `{Mode}PerformanceAttributes`
- [BREAKING] Renamed the `attributes` field to `difficulty` for all `{Mode}PerformanceAttributes` structs
# v0.3.0
+4 -4
View File
@@ -440,7 +440,7 @@ pub struct FruitsDifficultyAttributes {
#[derive(Clone, Debug, Default)]
pub struct FruitsPerformanceAttributes {
/// The difficulty attributes that were used for the performance calculation
pub attributes: FruitsDifficultyAttributes,
pub difficulty: FruitsDifficultyAttributes,
/// The final performance points.
pub pp: f64,
}
@@ -449,7 +449,7 @@ impl FruitsPerformanceAttributes {
/// Return the star value.
#[inline]
pub fn stars(&self) -> f64 {
self.attributes.stars
self.difficulty.stars
}
/// Return the performance point value.
@@ -461,13 +461,13 @@ impl FruitsPerformanceAttributes {
/// Return the maximum combo of the map.
#[inline]
pub fn max_combo(&self) -> usize {
self.attributes.max_combo
self.difficulty.max_combo
}
}
impl From<FruitsPerformanceAttributes> for FruitsDifficultyAttributes {
fn from(attributes: FruitsPerformanceAttributes) -> Self {
attributes.attributes
attributes.difficulty
}
}
+3 -3
View File
@@ -339,7 +339,7 @@ impl FruitsPPInner {
}
FruitsPerformanceAttributes {
attributes: self.attributes,
difficulty: self.attributes,
pp,
}
}
@@ -389,7 +389,7 @@ impl FruitsAttributeProvider for FruitsDifficultyAttributes {
impl FruitsAttributeProvider for FruitsPerformanceAttributes {
#[inline]
fn attributes(self) -> Option<FruitsDifficultyAttributes> {
Some(self.attributes)
Some(self.difficulty)
}
}
@@ -410,7 +410,7 @@ impl FruitsAttributeProvider for PerformanceAttributes {
fn attributes(self) -> Option<FruitsDifficultyAttributes> {
#[allow(irrefutable_let_patterns)]
if let Self::Fruits(attributes) = self {
Some(attributes.attributes)
Some(attributes.difficulty)
} else {
None
}
+11 -11
View File
@@ -432,13 +432,13 @@ impl PerformanceAttributes {
pub fn difficulty_attributes(&self) -> DifficultyAttributes {
match self {
#[cfg(feature = "fruits")]
Self::Fruits(attributes) => DifficultyAttributes::Fruits(attributes.attributes.clone()),
Self::Fruits(attributes) => DifficultyAttributes::Fruits(attributes.difficulty.clone()),
#[cfg(feature = "mania")]
Self::Mania(attributes) => DifficultyAttributes::Mania(attributes.attributes),
Self::Mania(attributes) => DifficultyAttributes::Mania(attributes.difficulty),
#[cfg(feature = "osu")]
Self::Osu(attributes) => DifficultyAttributes::Osu(attributes.attributes.clone()),
Self::Osu(attributes) => DifficultyAttributes::Osu(attributes.difficulty.clone()),
#[cfg(feature = "taiko")]
Self::Taiko(attributes) => DifficultyAttributes::Taiko(attributes.attributes),
Self::Taiko(attributes) => DifficultyAttributes::Taiko(attributes.difficulty),
}
}
@@ -450,12 +450,12 @@ impl PerformanceAttributes {
pub fn max_combo(&self) -> Option<usize> {
match self {
#[cfg(feature = "fruits")]
Self::Fruits(f) => Some(f.attributes.max_combo),
Self::Fruits(f) => Some(f.difficulty.max_combo),
Self::Mania(_) => None,
#[cfg(feature = "osu")]
Self::Osu(o) => Some(o.attributes.max_combo),
Self::Osu(o) => Some(o.difficulty.max_combo),
#[cfg(feature = "taiko")]
Self::Taiko(t) => Some(t.attributes.max_combo),
Self::Taiko(t) => Some(t.difficulty.max_combo),
}
}
@@ -478,13 +478,13 @@ impl From<PerformanceAttributes> for DifficultyAttributes {
fn from(attributes: PerformanceAttributes) -> Self {
match attributes {
#[cfg(feature = "fruits")]
PerformanceAttributes::Fruits(attributes) => Self::Fruits(attributes.attributes),
PerformanceAttributes::Fruits(attributes) => Self::Fruits(attributes.difficulty),
#[cfg(feature = "mania")]
PerformanceAttributes::Mania(attributes) => Self::Mania(attributes.attributes),
PerformanceAttributes::Mania(attributes) => Self::Mania(attributes.difficulty),
#[cfg(feature = "osu")]
PerformanceAttributes::Osu(attributes) => Self::Osu(attributes.attributes),
PerformanceAttributes::Osu(attributes) => Self::Osu(attributes.difficulty),
#[cfg(feature = "taiko")]
PerformanceAttributes::Taiko(attributes) => Self::Taiko(attributes.attributes),
PerformanceAttributes::Taiko(attributes) => Self::Taiko(attributes.difficulty),
}
}
}
+3 -3
View File
@@ -152,7 +152,7 @@ pub struct ManiaDifficultyAttributes {
#[derive(Copy, Clone, Debug, Default)]
pub struct ManiaPerformanceAttributes {
/// The difficulty attributes that were used for the performance calculation
pub attributes: ManiaDifficultyAttributes,
pub difficulty: ManiaDifficultyAttributes,
/// The final performance points.
pub pp: f64,
/// The accuracy portion of the final pp.
@@ -165,7 +165,7 @@ impl ManiaPerformanceAttributes {
/// Return the star value.
#[inline]
pub fn stars(&self) -> f64 {
self.attributes.stars
self.difficulty.stars
}
/// Return the performance point value.
@@ -177,6 +177,6 @@ impl ManiaPerformanceAttributes {
impl From<ManiaPerformanceAttributes> for ManiaDifficultyAttributes {
fn from(attributes: ManiaPerformanceAttributes) -> Self {
attributes.attributes
attributes.difficulty
}
}
+3 -3
View File
@@ -133,7 +133,7 @@ impl<'map> ManiaPP<'map> {
let pp = (strain_value.powf(1.1) + acc_value.powf(1.1)).powf(1.0 / 1.1) * multiplier;
ManiaPerformanceAttributes {
attributes: ManiaDifficultyAttributes { stars },
difficulty: ManiaDifficultyAttributes { stars },
pp_acc: acc_value,
pp_strain: strain_value,
pp,
@@ -193,7 +193,7 @@ impl ManiaAttributeProvider for ManiaDifficultyAttributes {
impl ManiaAttributeProvider for ManiaPerformanceAttributes {
#[inline]
fn attributes(self) -> Option<f64> {
Some(self.attributes.stars)
Some(self.difficulty.stars)
}
}
@@ -214,7 +214,7 @@ impl ManiaAttributeProvider for PerformanceAttributes {
fn attributes(self) -> Option<f64> {
#[allow(irrefutable_let_patterns)]
if let Self::Mania(attributes) = self {
Some(attributes.attributes.stars)
Some(attributes.difficulty.stars)
} else {
None
}
+4 -4
View File
@@ -477,7 +477,7 @@ pub struct OsuDifficultyAttributes {
#[derive(Clone, Debug, Default)]
pub struct OsuPerformanceAttributes {
/// The difficulty attributes that were used for the performance calculation
pub attributes: OsuDifficultyAttributes,
pub difficulty: OsuDifficultyAttributes,
/// The final performance points.
pub pp: f64,
/// The accuracy portion of the final pp.
@@ -494,7 +494,7 @@ impl OsuPerformanceAttributes {
/// Return the star value.
#[inline]
pub fn stars(&self) -> f64 {
self.attributes.stars
self.difficulty.stars
}
/// Return the performance point value.
@@ -506,13 +506,13 @@ impl OsuPerformanceAttributes {
/// Return the maximum combo of the map.
#[inline]
pub fn max_combo(&self) -> usize {
self.attributes.max_combo
self.difficulty.max_combo
}
}
impl From<OsuPerformanceAttributes> for OsuDifficultyAttributes {
fn from(attributes: OsuPerformanceAttributes) -> Self {
attributes.attributes
attributes.difficulty
}
}
+3 -3
View File
@@ -345,7 +345,7 @@ impl OsuPPInner {
* multiplier;
OsuPerformanceAttributes {
attributes: self.attributes,
difficulty: self.attributes,
pp_acc: acc_value,
pp_aim: aim_value,
pp_flashlight: flashlight_value,
@@ -607,7 +607,7 @@ impl OsuAttributeProvider for OsuDifficultyAttributes {
impl OsuAttributeProvider for OsuPerformanceAttributes {
#[inline]
fn attributes(self) -> Option<OsuDifficultyAttributes> {
Some(self.attributes)
Some(self.difficulty)
}
}
@@ -628,7 +628,7 @@ impl OsuAttributeProvider for PerformanceAttributes {
fn attributes(self) -> Option<OsuDifficultyAttributes> {
#[allow(irrefutable_let_patterns)]
if let Self::Osu(attributes) = self {
Some(attributes.attributes)
Some(attributes.difficulty)
} else {
None
}
+4 -4
View File
@@ -310,13 +310,13 @@ impl AttributeProvider for PerformanceAttributes {
fn attributes(self) -> DifficultyAttributes {
match self {
#[cfg(feature = "fruits")]
Self::Fruits(f) => DifficultyAttributes::Fruits(f.attributes),
Self::Fruits(f) => DifficultyAttributes::Fruits(f.difficulty),
#[cfg(feature = "mania")]
Self::Mania(m) => DifficultyAttributes::Mania(m.attributes),
Self::Mania(m) => DifficultyAttributes::Mania(m.difficulty),
#[cfg(feature = "osu")]
Self::Osu(o) => DifficultyAttributes::Osu(o.attributes),
Self::Osu(o) => DifficultyAttributes::Osu(o.difficulty),
#[cfg(feature = "taiko")]
Self::Taiko(t) => DifficultyAttributes::Taiko(t.attributes),
Self::Taiko(t) => DifficultyAttributes::Taiko(t.difficulty),
}
}
}
+4 -4
View File
@@ -238,7 +238,7 @@ pub struct TaikoDifficultyAttributes {
#[derive(Clone, Debug, Default)]
pub struct TaikoPerformanceAttributes {
/// The difficulty attributes that were used for the performance calculation
pub attributes: TaikoDifficultyAttributes,
pub difficulty: TaikoDifficultyAttributes,
/// The final performance points.
pub pp: f64,
/// The accuracy portion of the final pp.
@@ -251,7 +251,7 @@ impl TaikoPerformanceAttributes {
/// Return the star value.
#[inline]
pub fn stars(&self) -> f64 {
self.attributes.stars
self.difficulty.stars
}
/// Return the performance point value.
@@ -263,12 +263,12 @@ impl TaikoPerformanceAttributes {
/// Return the maximum combo of the map.
#[inline]
pub fn max_combo(&self) -> usize {
self.attributes.max_combo
self.difficulty.max_combo
}
}
impl From<TaikoPerformanceAttributes> for TaikoDifficultyAttributes {
fn from(attributes: TaikoPerformanceAttributes) -> Self {
attributes.attributes
attributes.difficulty
}
}
+3 -3
View File
@@ -199,7 +199,7 @@ impl<'map> TaikoPPInner<'map> {
let pp = (strain_value.powf(1.1) + acc_value.powf(1.1)).powf(1.0 / 1.1) * multiplier;
TaikoPerformanceAttributes {
attributes: self.attributes,
difficulty: self.attributes,
pp,
pp_acc: acc_value,
pp_strain: strain_value,
@@ -273,7 +273,7 @@ impl TaikoAttributeProvider for TaikoDifficultyAttributes {
impl TaikoAttributeProvider for TaikoPerformanceAttributes {
#[inline]
fn attributes(self) -> Option<TaikoDifficultyAttributes> {
Some(self.attributes)
Some(self.difficulty)
}
}
@@ -294,7 +294,7 @@ impl TaikoAttributeProvider for PerformanceAttributes {
fn attributes(self) -> Option<TaikoDifficultyAttributes> {
#[allow(irrefutable_let_patterns)]
if let Self::Taiko(attributes) = self {
Some(attributes.attributes)
Some(attributes.difficulty)
} else {
None
}