diff options
author | Daniel Schadt <kingdread@gmx.de> | 2018-06-10 01:16:30 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2018-06-10 01:16:30 +0200 |
commit | 877549baca100d534c1272000b2af7a8b364cd35 (patch) | |
tree | 3f4a2df365b89be33e9ed0c50fd29c28c60c5994 /src/statistics/trackers.rs | |
parent | a25ac4073d201801030f5a2baf13c54d80cc3467 (diff) | |
download | evtclib-877549baca100d534c1272000b2af7a8b364cd35.tar.gz evtclib-877549baca100d534c1272000b2af7a8b364cd35.tar.bz2 evtclib-877549baca100d534c1272000b2af7a8b364cd35.zip |
basic structure for mechanic tracker
Diffstat (limited to 'src/statistics/trackers.rs')
-rw-r--r-- | src/statistics/trackers.rs | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/src/statistics/trackers.rs b/src/statistics/trackers.rs index 6e23480..bcf5e90 100644 --- a/src/statistics/trackers.rs +++ b/src/statistics/trackers.rs @@ -16,7 +16,7 @@ use std::error::Error; use super::super::{Event, EventKind, Log}; use super::boon::BoonQueue; -use super::gamedata; +use super::gamedata::{self, Mechanic, Trigger}; use super::DamageStats; // A support macro to introduce a new block. @@ -377,3 +377,40 @@ impl Tracker for BoonTracker { Ok(self.boon_areas) } } + +/// A tracker that tracks boss mechanics for each player. +pub struct MechanicTracker { + mechanics: HashMap<u64, HashMap<&'static Mechanic, u32>>, + available_mechanics: Vec<&'static Mechanic>, + boss_address: u64, +} + +impl MechanicTracker { + /// Create a new mechanic tracker that watches over the given mechanics. + pub fn new(boss_address: u64, mechanics: Vec<&'static Mechanic>) -> MechanicTracker { + MechanicTracker { + mechanics: HashMap::new(), + available_mechanics: mechanics, + boss_address: boss_address, + } + } +} + +impl Tracker for MechanicTracker { + type Stat = HashMap<u64, HashMap<&'static Mechanic, u32>>; + type Error = !; + + fn feed(&mut self, event: &Event) -> Result<(), Self::Error> { + for mechanic in &self.available_mechanics { + match (&event.kind, &mechanic.1) { + (EventKind::SkillUse { .. }, Trigger::SkillOnPlayer { .. }) => (), + _ => (), + } + } + Ok(()) + } + + fn finalize(self) -> Result<Self::Stat, Self::Error> { + Ok(self.mechanics) + } +} |