diff options
author | Daniel Schadt <kingdread@gmx.de> | 2018-05-01 00:14:36 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2018-05-01 00:14:36 +0200 |
commit | 6922b2bb7dbe0e421d702c40d812a46259a5c51c (patch) | |
tree | f50a7eb01fb68426141eead1e56bff47d8419f09 /src/statistics/trackers.rs | |
parent | 1fe2fde9604db53e57996648d6d8627480391bab (diff) | |
download | evtclib-6922b2bb7dbe0e421d702c40d812a46259a5c51c.tar.gz evtclib-6922b2bb7dbe0e421d702c40d812a46259a5c51c.tar.bz2 evtclib-6922b2bb7dbe0e421d702c40d812a46259a5c51c.zip |
add boon data for some boons (exemplary)
Diffstat (limited to 'src/statistics/trackers.rs')
-rw-r--r-- | src/statistics/trackers.rs | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/statistics/trackers.rs b/src/statistics/trackers.rs index 9b8d633..751b639 100644 --- a/src/statistics/trackers.rs +++ b/src/statistics/trackers.rs @@ -16,6 +16,7 @@ use std::error::Error; use super::super::{Event, EventKind, Log}; use super::boon::{BoonQueue, BoonType}; +use super::gamedata; use super::DamageStats; // A support macro to introduce a new block. @@ -237,8 +238,6 @@ pub struct BoonTracker { } impl BoonTracker { - const MAX_STACKS: u32 = 25; - /// Creates a new boon tracker. pub fn new() -> BoonTracker { Default::default() @@ -304,7 +303,13 @@ impl BoonTracker { .entry(agent) .or_insert_with(Default::default) .entry(buff_id) - .or_insert_with(|| BoonQueue::new(Self::MAX_STACKS, BoonType::Intensity)) + .or_insert_with(|| { + gamedata::get_boon(buff_id) + .map(gamedata::Boon::create_queue) + // For unknown boons, default to a duration-based counter + // with 5 stacks. + .unwrap_or_else(|| BoonQueue::new(5, BoonType::Duration)) + }) } } @@ -333,6 +338,16 @@ impl Tracker for BoonTracker { self.update_next_update(); } + // XXX: Properly handle SINGLE and MANUAL removal types + EventKind::BuffRemove { + destination_agent_addr, + buff_id, + .. + } => { + self.get_queue(destination_agent_addr, buff_id).clear(); + self.update_next_update(); + } + _ => (), } |