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