From 2d8c0f26c71e90e30d8aef35f7ae95003abf13d6 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Thu, 31 May 2018 16:05:52 +0200 Subject: cargo fmt --- src/event.rs | 4 +++- src/lib.rs | 3 ++- src/raw/mod.rs | 6 ++++-- src/raw/types.rs | 3 ++- src/statistics/boon.rs | 3 ++- src/statistics/gamedata.rs | 3 --- src/statistics/trackers.rs | 13 +++++++------ 7 files changed, 20 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/event.rs b/src/event.rs index 0b28147..02f4686 100644 --- a/src/event.rs +++ b/src/event.rs @@ -264,7 +264,9 @@ fn check_damage(raw_event: &raw::CbtEvent) -> Option { damage: raw_event.value, result: raw_event.result, }) - } else if raw_event.buff == 1 && raw_event.buff_dmg != 0 && raw_event.dst_agent != 0 + } else if raw_event.buff == 1 + && raw_event.buff_dmg != 0 + && raw_event.dst_agent != 0 && raw_event.value == 0 { Some(EventKind::ConditionTick { diff --git a/src/lib.rs b/src/lib.rs index c0b8850..e793760 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -275,7 +275,8 @@ fn set_agent_masters(data: &raw::Evtc, agents: &mut [Agent]) -> Result<(), EvtcE if event.src_master_instid != 0 { let mut master_addr = None; for agent in &*agents { - if agent.instance_id == event.src_master_instid && agent.first_aware < event.time + if agent.instance_id == event.src_master_instid + && agent.first_aware < event.time && event.time < agent.last_aware { master_addr = Some(agent.addr); diff --git a/src/raw/mod.rs b/src/raw/mod.rs index 4b32955..7cbe483 100644 --- a/src/raw/mod.rs +++ b/src/raw/mod.rs @@ -6,8 +6,10 @@ //! functions whenever possible. mod types; -pub use self::types::{Agent, CbtActivation, CbtBuffRemove, CbtCustomSkill, CbtEvent, CbtResult, - CbtStateChange, Language, Skill, IFF}; +pub use self::types::{ + Agent, CbtActivation, CbtBuffRemove, CbtCustomSkill, CbtEvent, CbtResult, CbtStateChange, + Language, Skill, IFF, +}; pub mod parser; diff --git a/src/raw/types.rs b/src/raw/types.rs index 9096a32..e3a80af 100644 --- a/src/raw/types.rs +++ b/src/raw/types.rs @@ -291,7 +291,8 @@ impl Skill { /// /// Returns `None` if the name is not valid UTF-8. pub fn name_string(&self) -> Option { - let bytes = self.name + let bytes = self + .name .iter() .cloned() .take_while(|b| *b != 0) diff --git a/src/statistics/boon.rs b/src/statistics/boon.rs index 6378d50..425f4a5 100644 --- a/src/statistics/boon.rs +++ b/src/statistics/boon.rs @@ -116,7 +116,8 @@ impl BoonQueue { } BoonType::Intensity => { - self.queue = self.queue + self.queue = self + .queue .iter() .cloned() .filter(|v| *v > duration) diff --git a/src/statistics/gamedata.rs b/src/statistics/gamedata.rs index a6dbf15..73f2780 100644 --- a/src/statistics/gamedata.rs +++ b/src/statistics/gamedata.rs @@ -37,11 +37,9 @@ pub static BOONS: &[Boon] = &[ Boon(719, "Swiftness", 9, BoonType::Duration), Boon(1187, "Quickness", 5, BoonType::Duration), Boon(726, "Vigor", 5, BoonType::Duration), - // Intensity based Boon(740, "Might", 25, BoonType::Intensity), Boon(1122, "Stability", 25, BoonType::Intensity), - // Standard conditions. // Duration based Boon(720, "Blinded", 5, BoonType::Duration), @@ -51,7 +49,6 @@ pub static BOONS: &[Boon] = &[ Boon(727, "Immobile", 3, BoonType::Duration), Boon(26766, "Slow", 3, BoonType::Duration), Boon(742, "Weakness", 3, BoonType::Duration), - // Intensity based Boon(736, "Bleeding", 1500, BoonType::Intensity), Boon(737, "Burning", 1500, BoonType::Intensity), diff --git a/src/statistics/trackers.rs b/src/statistics/trackers.rs index b64e586..2783285 100644 --- a/src/statistics/trackers.rs +++ b/src/statistics/trackers.rs @@ -272,7 +272,8 @@ impl BoonTracker { for (agent, queues) in &self.boon_queues { for (buff_id, queue) in queues { let current_stacks = queue.current_stacks(); - let area = self.boon_areas + let area = self + .boon_areas .entry(*agent) .or_insert_with(Default::default) .entry(*buff_id) @@ -283,7 +284,8 @@ impl BoonTracker { } fn update_next_update(&mut self) { - let next_update = self.boon_queues + let next_update = self + .boon_queues .values() .flat_map(HashMap::values) .map(BoonQueue::next_update) @@ -301,7 +303,8 @@ impl BoonTracker { /// * `buff_id` - The buff (or condition) id. fn get_queue(&mut self, agent: u64, buff_id: u16) -> Option<&mut BoonQueue> { use std::collections::hash_map::Entry; - let mut entry = self.boon_queues + let mut entry = self + .boon_queues .entry(agent) .or_insert_with(Default::default) .entry(buff_id); @@ -310,15 +313,13 @@ impl BoonTracker { Entry::Occupied(e) => Some(e.into_mut()), // Queue needs to be created, but only if we know about that boon. Entry::Vacant(e) => { - let boon_queue = gamedata::get_boon(buff_id) - .map(gamedata::Boon::create_queue); + let boon_queue = gamedata::get_boon(buff_id).map(gamedata::Boon::create_queue); if let Some(queue) = boon_queue { Some(e.insert(queue)) } else { None } } - } } } -- cgit v1.2.3