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