refactor: cleanup taiko skill eval
This commit is contained in:
@@ -9,7 +9,6 @@ use crate::{
|
||||
};
|
||||
|
||||
use super::{
|
||||
combined_difficulty_value,
|
||||
object::{TaikoDifficultyObject, TaikoDifficultyObjects},
|
||||
skills::TaikoSkills,
|
||||
DifficultyValues, TaikoDifficultyAttributes,
|
||||
@@ -171,18 +170,9 @@ impl Iterator for TaikoGradualDifficulty {
|
||||
|
||||
self.idx += 1;
|
||||
|
||||
let color = self.skills.color.as_difficulty_value();
|
||||
let rhythm = self.skills.rhythm.as_difficulty_value();
|
||||
let stamina = self.skills.stamina.as_difficulty_value();
|
||||
let combined = combined_difficulty_value(
|
||||
self.skills.color.clone(),
|
||||
self.skills.rhythm.clone(),
|
||||
self.skills.stamina.clone(),
|
||||
);
|
||||
|
||||
let mut attrs = self.attrs.clone();
|
||||
|
||||
DifficultyValues::eval(&mut attrs, color, rhythm, stamina, combined);
|
||||
DifficultyValues::eval(&mut attrs, self.skills.clone());
|
||||
|
||||
Some(attrs)
|
||||
}
|
||||
|
||||
@@ -37,14 +37,7 @@ pub fn difficulty(
|
||||
.hit_windows()
|
||||
.od;
|
||||
|
||||
let DifficultyValues {
|
||||
skills: TaikoSkills {
|
||||
rhythm,
|
||||
color,
|
||||
stamina,
|
||||
},
|
||||
max_combo,
|
||||
} = DifficultyValues::calculate(difficulty, converted);
|
||||
let DifficultyValues { skills, max_combo } = DifficultyValues::calculate(difficulty, converted);
|
||||
|
||||
let mut attrs = TaikoDifficultyAttributes {
|
||||
hit_window,
|
||||
@@ -53,18 +46,7 @@ pub fn difficulty(
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let color_rating = color.as_difficulty_value();
|
||||
let rhythm_rating = rhythm.as_difficulty_value();
|
||||
let stamina_rating = stamina.as_difficulty_value();
|
||||
let combined_rating = combined_difficulty_value(color, rhythm, stamina);
|
||||
|
||||
DifficultyValues::eval(
|
||||
&mut attrs,
|
||||
color_rating,
|
||||
rhythm_rating,
|
||||
stamina_rating,
|
||||
combined_rating,
|
||||
);
|
||||
DifficultyValues::eval(&mut attrs, skills);
|
||||
|
||||
attrs
|
||||
}
|
||||
@@ -169,17 +151,12 @@ impl DifficultyValues {
|
||||
Self { skills, max_combo }
|
||||
}
|
||||
|
||||
pub fn eval(
|
||||
attrs: &mut TaikoDifficultyAttributes,
|
||||
color_difficulty_value: f64,
|
||||
rhythm_difficulty_value: f64,
|
||||
stamina_difficulty_value: f64,
|
||||
combined_difficulty_value: f64,
|
||||
) {
|
||||
let color_rating = color_difficulty_value * COLOR_SKILL_MULTIPLIER;
|
||||
let rhythm_rating = rhythm_difficulty_value * RHYTHM_SKILL_MULTIPLIER;
|
||||
let stamina_rating = stamina_difficulty_value * STAMINA_SKILL_MULTIPLIER;
|
||||
let combined_rating = combined_difficulty_value;
|
||||
pub fn eval(attrs: &mut TaikoDifficultyAttributes, skills: TaikoSkills) {
|
||||
let color_rating = skills.color.as_difficulty_value() * COLOR_SKILL_MULTIPLIER;
|
||||
let rhythm_rating = skills.rhythm.as_difficulty_value() * RHYTHM_SKILL_MULTIPLIER;
|
||||
let stamina_rating = skills.stamina.as_difficulty_value() * STAMINA_SKILL_MULTIPLIER;
|
||||
let combined_rating =
|
||||
combined_difficulty_value(skills.color, skills.rhythm, skills.stamina);
|
||||
|
||||
let star_rating = rescale(combined_rating * 1.4);
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ pub mod color;
|
||||
pub mod rhythm;
|
||||
pub mod stamina;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct TaikoSkills {
|
||||
pub rhythm: Rhythm,
|
||||
pub color: Color,
|
||||
|
||||
Reference in New Issue
Block a user