aboutsummaryrefslogtreecommitdiff
path: root/src/analyzers/raids/w6.rs
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2020-07-23 17:18:56 +0200
committerDaniel Schadt <kingdread@gmx.de>2020-07-23 17:18:56 +0200
commitdcf1b948b953fb17db16eafcdd30f0a25301171f (patch)
treefda74e152d9354c22ed1d7fe1e3d89a3b3a3cc32 /src/analyzers/raids/w6.rs
parent4c02181067e789e41eb95c6f6e954e4de6277dc1 (diff)
downloadevtclib-dcf1b948b953fb17db16eafcdd30f0a25301171f.tar.gz
evtclib-dcf1b948b953fb17db16eafcdd30f0a25301171f.tar.bz2
evtclib-dcf1b948b953fb17db16eafcdd30f0a25301171f.zip
implement Analyzer::outcome for wing 6
Diffstat (limited to 'src/analyzers/raids/w6.rs')
-rw-r--r--src/analyzers/raids/w6.rs54
1 files changed, 52 insertions, 2 deletions
diff --git a/src/analyzers/raids/w6.rs b/src/analyzers/raids/w6.rs
index c4e5b1a..cc39403 100644
--- a/src/analyzers/raids/w6.rs
+++ b/src/analyzers/raids/w6.rs
@@ -1,10 +1,12 @@
//! Boss fight analyzers for Wing 6 (Mythwright Gambit)
use crate::{
- analyzers::{helpers, Analyzer},
- Log,
+ analyzers::{helpers, Analyzer, Outcome},
+ gamedata::{KENUT_ID, NIKARE_ID},
+ EventKind, Log,
};
pub const CA_CM_BUFF: u32 = 53_075;
+pub const ZOMMOROS_ID: u16 = 21_118;
/// Analyzer for the first fight of Wing 6, Conjured Amalgamate.
///
@@ -28,6 +30,23 @@ impl<'log> Analyzer for ConjuredAmalgamate<'log> {
fn is_cm(&self) -> bool {
helpers::buff_present(self.log, CA_CM_BUFF)
}
+
+ fn outcome(&self) -> Option<Outcome> {
+ for event in self.log.events() {
+ if let EventKind::Spawn { agent_addr } = event.kind() {
+ if self
+ .log
+ .agent_by_addr(*agent_addr)
+ .and_then(|a| a.as_character())
+ .map(|a| a.id() == ZOMMOROS_ID)
+ .unwrap_or(false)
+ {
+ return Some(Outcome::Success);
+ }
+ }
+ }
+ Some(Outcome::Failure)
+ }
}
pub const LARGOS_CM_HEALTH: u64 = 19_200_000;
@@ -56,6 +75,33 @@ impl<'log> Analyzer for LargosTwins<'log> {
.map(|h| h >= LARGOS_CM_HEALTH)
.unwrap_or(false)
}
+
+ fn outcome(&self) -> Option<Outcome> {
+ let mut nikare_dead = false;
+ let mut kenut_dead = false;
+
+ for event in self.log.events() {
+ if let EventKind::ChangeDead { agent_addr } = event.kind() {
+ let agent = if let Some(agent) = self
+ .log
+ .agent_by_addr(*agent_addr)
+ .and_then(|a| a.as_character())
+ {
+ agent
+ } else {
+ continue;
+ };
+
+ if agent.id() == NIKARE_ID {
+ nikare_dead = true;
+ } else if agent.id() == KENUT_ID {
+ kenut_dead = true;
+ }
+ }
+ }
+
+ Outcome::from_bool(kenut_dead && nikare_dead)
+ }
}
pub const QADIM_CM_HEALTH: u64 = 21_100_000;
@@ -84,4 +130,8 @@ impl<'log> Analyzer for Qadim<'log> {
.map(|h| h >= QADIM_CM_HEALTH)
.unwrap_or(false)
}
+
+ fn outcome(&self) -> Option<Outcome> {
+ Outcome::from_bool(helpers::players_exit_after_boss(self.log))
+ }
}