aboutsummaryrefslogtreecommitdiff
path: root/src/statistics/trackers.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/statistics/trackers.rs')
-rw-r--r--src/statistics/trackers.rs21
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();
+ }
+
_ => (),
}