fix peeker

This commit is contained in:
ntr 2019-12-10 15:27:49 +10:00
parent 0cac570695
commit b365a6c1f1

View File

@ -451,12 +451,12 @@ impl Game {
self.stack_sort_speed(); self.stack_sort_speed();
}; };
// go through the whole most recent round and modify delays of the resolutions
// update to go through the whole most recent round and modify durations let last = self.resolutions.len() - 1;
// let mut iter = event_list.into_iter().peekable(); let mut iter = self.resolutions[last].iter_mut().peekable();
// while let Some(event) = iter.next() { while let Some(res) = iter.next() {
// resolutions.push(Resolution::new(cast, event, iter.peek())); res.set_delay(iter.peek());
// } }
// info!("{:#?}", self.casts); // info!("{:#?}", self.casts);
@ -877,15 +877,18 @@ impl Resolution {
_ => vec![cast.source, cast.target], _ => vec![cast.source, cast.target],
}; };
let delay = event.delay(None);
Resolution { Resolution {
skill: cast.skill, skill: cast.skill,
delay, delay: 0, // set at the end of the resolve phase because of changes depending on what's before/after
focus, focus,
event, event,
} }
} }
pub fn set_delay(&mut self, next: Option<&&mut Resolution>) -> &mut Resolution {
self.delay = self.event.delay(next);
self
}
} }
pub type Disable = Vec<Effect>; pub type Disable = Vec<Effect>;
@ -913,42 +916,41 @@ pub enum Event {
} }
impl Event { impl Event {
fn delay(&self, next_event: Option<&Event>) -> i64 { fn delay(&self, next_event: Option<&&mut Resolution>) -> i64 {
900 let source_overlapping = 500;
// let source_overlapping = 500; let target_overlapping = 900;
// let target_overlapping = 900;
// let source_duration = 1000; let source_duration = 1000;
// let target_duration = 1500; let target_duration = 1500;
// let combat_text_duration = 1300; let combat_text_duration = 1300;
// match self { match self {
// Event::Cast { construct: _, direction: _, player: _ } => { Event::Cast { construct: _, direction: _, player: _ } => {
// match next_event { match next_event {
// Some(e) => { Some(e) => {
// match e { match e.event {
// Event::Cast { construct: _, direction: _, player: _ } => source_duration, Event::Cast { construct: _, direction: _, player: _ } => source_duration,
// _ => source_overlapping, _ => source_overlapping,
// } }
// }, },
// None => source_duration None => source_duration
// } }
// }, },
// Event::Hit { construct: _, direction: _, player: _ } | Event::Hit { construct: _, direction: _, player: _ } |
// Event::HitAoe { construct: _ } => { Event::HitAoe { construct: _ } => {
// match next_event { match next_event {
// Some(e) => { Some(e) => {
// match e { match e.event {
// Event::Cast { construct: _, direction: _, player: _ } | Event::Cast { construct: _, direction: _, player: _ } |
// Event::Hit { construct: _, direction: _, player: _ } => target_duration, Event::Hit { construct: _, direction: _, player: _ } => target_duration,
// _ => target_overlapping, _ => target_overlapping,
// } }
// } }
// None => target_duration, None => target_duration,
// } }
// }, },
// _ => combat_text_duration, _ => combat_text_duration,
// } }
} }
} }