aboutsummaryrefslogtreecommitdiff
path: root/src/statistics/mod.rs
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2018-04-27 13:02:04 +0200
committerDaniel Schadt <kingdread@gmx.de>2018-04-27 13:02:04 +0200
commit8423b0c401a484314241391f2f78d129eef704c4 (patch)
tree1ce1ae0730f0dcb98e5f5c43213a77a24a2706c3 /src/statistics/mod.rs
parent85e203629580192413dbaa8156c2b4ca351c4bfc (diff)
downloadevtclib-8423b0c401a484314241391f2f78d129eef704c4.tar.gz
evtclib-8423b0c401a484314241391f2f78d129eef704c4.tar.bz2
evtclib-8423b0c401a484314241391f2f78d129eef704c4.zip
add boon tracking basics
Diffstat (limited to 'src/statistics/mod.rs')
-rw-r--r--src/statistics/mod.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/statistics/mod.rs b/src/statistics/mod.rs
index 1ebb517..efb934f 100644
--- a/src/statistics/mod.rs
+++ b/src/statistics/mod.rs
@@ -49,6 +49,13 @@ pub struct AgentStats {
pub total_damage: DamageStats,
/// Damage directed to the boss.
pub boss_damage: DamageStats,
+ /// Average stacks of boons.
+ ///
+ /// This also includes conditions.
+ ///
+ /// For duration-based boons, the average amount of stacks is the same as
+ /// the uptime.
+ pub boon_averages: HashMap<u16, f64>,
/// Time when the agent has entered combat (millseconds since log start).
pub enter_combat: u64,
/// Time when the agent has left combat (millseconds since log start).
@@ -95,6 +102,7 @@ pub fn calculate(log: &Log) -> StatResult<Statistics> {
let mut damage_tracker = trackers::DamageTracker::new(log);
let mut log_start_tracker = trackers::LogStartTracker::new();
let mut combat_time_tracker = trackers::CombatTimeTracker::new();
+ let mut boon_tracker = trackers::BoonTracker::new();
run_trackers(
log,
@@ -102,6 +110,7 @@ pub fn calculate(log: &Log) -> StatResult<Statistics> {
&mut damage_tracker,
&mut log_start_tracker,
&mut combat_time_tracker,
+ &mut boon_tracker,
],
)?;
@@ -139,6 +148,19 @@ pub fn calculate(log: &Log) -> StatResult<Statistics> {
.unwrap_or_else(Default::default);
}
+ let boons = try_tracker!(boon_tracker.finalize());
+ for (agent, boon_map) in &boons {
+ let agent = agent_stats.entry(*agent).or_insert_with(Default::default);
+ let combat_time = agent.combat_time() as f64;
+ if combat_time == 0. {
+ continue;
+ }
+ agent.boon_averages = boon_map
+ .iter()
+ .map(|(id, area)| (*id, *area as f64 / combat_time))
+ .collect();
+ }
+
Ok(Statistics { agent_stats })
}