fixed taiko passed objects
This commit is contained in:
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
## Upcoming
|
## Upcoming
|
||||||
|
|
||||||
Nothing as of now
|
- __Fixes:__
|
||||||
|
- Fixed passed object count for taiko by ignoring non-circles.
|
||||||
|
|
||||||
# v0.9.1 (2022-10-26)
|
# v0.9.1 (2022-10-26)
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ pub struct TaikoGradualDifficultyAttributes {
|
|||||||
hit_objects: IntoIter<Rc<RefCell<TaikoDifficultyObject>>>,
|
hit_objects: IntoIter<Rc<RefCell<TaikoDifficultyObject>>>,
|
||||||
lists: ObjectLists,
|
lists: ObjectLists,
|
||||||
peaks: Peaks,
|
peaks: Peaks,
|
||||||
|
total_hits: usize,
|
||||||
|
pub(crate) started: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TaikoGradualDifficultyAttributes {
|
impl TaikoGradualDifficultyAttributes {
|
||||||
@@ -76,11 +78,14 @@ impl TaikoGradualDifficultyAttributes {
|
|||||||
lists: ObjectLists::default(),
|
lists: ObjectLists::default(),
|
||||||
peaks,
|
peaks,
|
||||||
attrs,
|
attrs,
|
||||||
|
total_hits: 0,
|
||||||
|
started: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
attrs.max_combo += map.hit_objects[0].is_circle() as usize;
|
attrs.max_combo += map.hit_objects[0].is_circle() as usize;
|
||||||
attrs.max_combo += map.hit_objects[1].is_circle() as usize;
|
attrs.max_combo += map.hit_objects[1].is_circle() as usize;
|
||||||
|
let mut total_hits = attrs.max_combo;
|
||||||
|
|
||||||
let mut diff_objects = map
|
let mut diff_objects = map
|
||||||
.taiko_objects()
|
.taiko_objects()
|
||||||
@@ -91,6 +96,8 @@ impl TaikoGradualDifficultyAttributes {
|
|||||||
.fold(
|
.fold(
|
||||||
ObjectLists::default(),
|
ObjectLists::default(),
|
||||||
|mut lists, (idx, (((base, base_start_time), last), last_last))| {
|
|mut lists, (idx, (((base, base_start_time), last), last_last))| {
|
||||||
|
total_hits += base.is_hit as usize;
|
||||||
|
|
||||||
let diff_obj = TaikoDifficultyObject::new(
|
let diff_obj = TaikoDifficultyObject::new(
|
||||||
base,
|
base,
|
||||||
base_start_time,
|
base_start_time,
|
||||||
@@ -124,23 +131,28 @@ impl TaikoGradualDifficultyAttributes {
|
|||||||
lists: diff_objects,
|
lists: diff_objects,
|
||||||
peaks,
|
peaks,
|
||||||
attrs,
|
attrs,
|
||||||
|
total_hits,
|
||||||
|
started: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn passed_objects(&self) -> usize {
|
|
||||||
self.lists.all.len() - self.hit_objects.len()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Iterator for TaikoGradualDifficultyAttributes {
|
impl Iterator for TaikoGradualDifficultyAttributes {
|
||||||
type Item = TaikoDifficultyAttributes;
|
type Item = TaikoDifficultyAttributes;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
{
|
self.started = true;
|
||||||
|
|
||||||
|
loop {
|
||||||
let curr = self.hit_objects.next()?;
|
let curr = self.hit_objects.next()?;
|
||||||
let borrowed = curr.borrow();
|
let borrowed = curr.borrow();
|
||||||
self.peaks.process(&borrowed, &self.lists);
|
self.peaks.process(&borrowed, &self.lists);
|
||||||
self.attrs.max_combo += borrowed.base.is_hit as usize;
|
|
||||||
|
if borrowed.base.is_hit {
|
||||||
|
self.attrs.max_combo += 1;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let PeaksDifficultyValues {
|
let PeaksDifficultyValues {
|
||||||
@@ -189,13 +201,22 @@ impl Iterator for TaikoGradualDifficultyAttributes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn nth(&mut self, n: usize) -> Option<Self::Item> {
|
fn nth(&mut self, n: usize) -> Option<Self::Item> {
|
||||||
let skip = n.min(self.len()).saturating_sub(1);
|
let skip = n
|
||||||
|
.min(self.total_hits - self.attrs.max_combo)
|
||||||
|
.saturating_sub(1);
|
||||||
|
|
||||||
for _ in 0..skip {
|
for _ in 0..skip {
|
||||||
let curr = self.hit_objects.next()?;
|
loop {
|
||||||
let borrowed = curr.borrow();
|
let curr = self.hit_objects.next()?;
|
||||||
self.peaks.process(&borrowed, &self.lists);
|
let borrowed = curr.borrow();
|
||||||
self.attrs.max_combo += borrowed.base.is_hit as usize;
|
self.peaks.process(&borrowed, &self.lists);
|
||||||
|
|
||||||
|
if borrowed.base.is_hit {
|
||||||
|
self.attrs.max_combo += 1;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.next()
|
self.next()
|
||||||
|
|||||||
@@ -170,15 +170,16 @@ impl<'map> TaikoGradualPerformanceAttributes<'map> {
|
|||||||
state: TaikoScoreState,
|
state: TaikoScoreState,
|
||||||
n: usize,
|
n: usize,
|
||||||
) -> Option<TaikoPerformanceAttributes> {
|
) -> Option<TaikoPerformanceAttributes> {
|
||||||
let sub = 2 * (self.difficulty.passed_objects() == 0) as usize;
|
let sub = 2 * !self.difficulty.started as usize;
|
||||||
let difficulty = self.difficulty.nth(n.saturating_sub(sub))?;
|
let difficulty = self.difficulty.nth(n.saturating_sub(sub))?;
|
||||||
|
let passed_objects = difficulty.max_combo;
|
||||||
|
|
||||||
let performance = self
|
let performance = self
|
||||||
.performance
|
.performance
|
||||||
.clone()
|
.clone()
|
||||||
.attributes(difficulty)
|
.attributes(difficulty)
|
||||||
.state(state)
|
.state(state)
|
||||||
.passed_objects(self.difficulty.passed_objects() + 2)
|
.passed_objects(passed_objects)
|
||||||
.calculate();
|
.calculate();
|
||||||
|
|
||||||
Some(performance)
|
Some(performance)
|
||||||
|
|||||||
+13
-13
@@ -214,30 +214,30 @@ fn calculate_skills(params: TaikoStars<'_>) -> (Peaks, usize) {
|
|||||||
is_convert: _,
|
is_convert: _,
|
||||||
} = params;
|
} = params;
|
||||||
|
|
||||||
let take = passed_objects.unwrap_or(map.hit_objects.len());
|
let mut take = passed_objects.unwrap_or(map.hit_objects.len());
|
||||||
let clock_rate = clock_rate.unwrap_or_else(|| mods.clock_rate());
|
let clock_rate = clock_rate.unwrap_or_else(|| mods.clock_rate());
|
||||||
|
|
||||||
let mut peaks = Peaks::new();
|
let mut peaks = Peaks::new();
|
||||||
let mut max_combo = 0;
|
let mut max_combo = 0;
|
||||||
|
|
||||||
match map.hit_objects.get(0) {
|
|
||||||
Some(h) => max_combo += h.is_circle() as usize,
|
|
||||||
None => return (peaks, max_combo),
|
|
||||||
}
|
|
||||||
|
|
||||||
match map.hit_objects.get(1) {
|
|
||||||
Some(h) => max_combo += h.is_circle() as usize,
|
|
||||||
None => return (peaks, max_combo),
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut diff_objects = map
|
let mut diff_objects = map
|
||||||
.taiko_objects()
|
.taiko_objects()
|
||||||
.take(take)
|
.take_while(|(h, _)| {
|
||||||
|
if h.is_hit {
|
||||||
|
if take == 0 {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
max_combo += 1;
|
||||||
|
take -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
true
|
||||||
|
})
|
||||||
.skip(2)
|
.skip(2)
|
||||||
.zip(map.hit_objects.iter().skip(1))
|
.zip(map.hit_objects.iter().skip(1))
|
||||||
.zip(map.hit_objects.iter())
|
.zip(map.hit_objects.iter())
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.inspect(|(_, (((base, _), _), _))| max_combo += base.is_hit as usize)
|
|
||||||
.fold(
|
.fold(
|
||||||
ObjectLists::default(),
|
ObjectLists::default(),
|
||||||
|mut lists, (idx, (((base, base_start_time), last), last_last))| {
|
|mut lists, (idx, (((base, base_start_time), last), last_last))| {
|
||||||
|
|||||||
@@ -212,7 +212,6 @@ impl<'map> TaikoPP<'map> {
|
|||||||
|
|
||||||
fn generate_hitresults(&self, max_combo: usize) -> TaikoScoreState {
|
fn generate_hitresults(&self, max_combo: usize) -> TaikoScoreState {
|
||||||
let total_result_count = if let Some(passed_objects) = self.passed_objects {
|
let total_result_count = if let Some(passed_objects) = self.passed_objects {
|
||||||
// Not really correct since not all objects count towards combo
|
|
||||||
max_combo.min(passed_objects)
|
max_combo.min(passed_objects)
|
||||||
} else {
|
} else {
|
||||||
max_combo
|
max_combo
|
||||||
|
|||||||
@@ -100,14 +100,13 @@ fn gradual_eq_regular_passed() {
|
|||||||
let mut gradual = TaikoGradualPerformanceAttributes::new(&map, 0);
|
let mut gradual = TaikoGradualPerformanceAttributes::new(&map, 0);
|
||||||
|
|
||||||
let state = TaikoScoreState {
|
let state = TaikoScoreState {
|
||||||
max_combo: 246,
|
max_combo: 250,
|
||||||
n300: 246,
|
n300: 250,
|
||||||
n100: 0,
|
n100: 0,
|
||||||
n_misses: 0,
|
n_misses: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
let gradual = gradual.process_next_n_objects(state, n).unwrap();
|
let gradual = gradual.process_next_n_objects(state, n).unwrap();
|
||||||
|
|
||||||
// Cyclic types in difficulty calculation prohibit values to coincide completely
|
assert_eq!(regular, gradual);
|
||||||
assert_eq!(regular.difficulty.max_combo, gradual.difficulty.max_combo);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user