diff options
author | Daniel Schadt <kingdread@gmx.de> | 2020-09-29 17:23:01 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2020-09-29 17:25:26 +0200 |
commit | 65bd385540db567751405df000f6b063226d8b8a (patch) | |
tree | 10592aaed4104bef4b39aa908a9943eb2eec50a2 | |
parent | ed23bdb5f2d4790ab91628a690483b15089c2a55 (diff) | |
download | evtclib-65bd385540db567751405df000f6b063226d8b8a.tar.gz evtclib-65bd385540db567751405df000f6b063226d8b8a.tar.bz2 evtclib-65bd385540db567751405df000f6b063226d8b8a.zip |
return Outcome::Success if a raid was rewarded
If the reward has been given out, we can be 99.9% sure that the fight
succeeded, in which case we don't need to do any other convuluted
checking. This has the benefit of catching some false-negatives (edge
cases in success detection), at the cost of making the detection a bit
... weirder, in the sense that a log's success might now depend on
whether it was the first kill in the week or not.
However, given that our sucess detection works pretty well overall, I'd
say it's worth to catch a few more false-negatives and try to classify
as many logs correctly as possible. At least, this does not introduce
any false-positives.
-rw-r--r-- | CHANGELOG.md | 4 | ||||
-rw-r--r-- | src/analyzers/helpers.rs | 10 | ||||
-rw-r--r-- | src/analyzers/mod.rs | 1 | ||||
-rw-r--r-- | src/analyzers/raids/w3.rs | 1 | ||||
-rw-r--r-- | src/analyzers/raids/w4.rs | 4 | ||||
-rw-r--r-- | src/analyzers/raids/w5.rs | 2 | ||||
-rw-r--r-- | src/analyzers/raids/w6.rs | 3 | ||||
-rw-r--r-- | src/analyzers/raids/w7.rs | 3 |
8 files changed, 28 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 60937a6..2d9a506 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,10 @@ All notable changes to this project will be documented in this file. `evtclib::Encounter` is exported. - Renamed `Log::npcs` to `Log::characters` to have consistent naming. +### Fixed +- Some edge cases where raid success was not detected (as long as the fight was + rewarded). + ### Removed - Various `*_ID` constants from `gamedata`: `XERA_PHASE2_ID`, `NIKARE_ID`, `KENUT_ID`, `VOICE_OF_THE_FALLEN_ID` and `CLAW_OF_THE_FALLEN_ID`. diff --git a/src/analyzers/helpers.rs b/src/analyzers/helpers.rs index b5042aa..067f575 100644 --- a/src/analyzers/helpers.rs +++ b/src/analyzers/helpers.rs @@ -3,6 +3,16 @@ use std::collections::HashMap; use crate::{AgentKind, EventKind, Log}; +/// Check if the log was rewarded, and if yes, return `Outcome::Success` early. +macro_rules! check_reward { + ($log:expr) => { + let log: &Log = $log; + if log.was_rewarded() { + return Some(crate::analyzers::Outcome::Success); + } + }; +} + /// Returns the maximum health of the boss agent. /// /// If the health cannot be determined, this function returns `None`. diff --git a/src/analyzers/mod.rs b/src/analyzers/mod.rs index ff04728..e19e61a 100644 --- a/src/analyzers/mod.rs +++ b/src/analyzers/mod.rs @@ -27,6 +27,7 @@ use crate::{Encounter, Log}; pub mod fractals; +#[macro_use] pub mod helpers; pub mod raids; pub mod strikes; diff --git a/src/analyzers/raids/w3.rs b/src/analyzers/raids/w3.rs index 1b80b8d..16a3d13 100644 --- a/src/analyzers/raids/w3.rs +++ b/src/analyzers/raids/w3.rs @@ -29,6 +29,7 @@ impl<'log> Analyzer for Xera<'log> { } fn outcome(&self) -> Option<Outcome> { + check_reward!(self.log); Outcome::from_bool(helpers::players_exit_after_boss(self.log)) } } diff --git a/src/analyzers/raids/w4.rs b/src/analyzers/raids/w4.rs index adeb2ea..9294e3c 100644 --- a/src/analyzers/raids/w4.rs +++ b/src/analyzers/raids/w4.rs @@ -35,6 +35,7 @@ impl<'log> Analyzer for Cairn<'log> { } fn outcome(&self) -> Option<Outcome> { + check_reward!(self.log); Outcome::from_bool(helpers::boss_is_dead(self.log)) } } @@ -71,6 +72,7 @@ impl<'log> Analyzer for MursaatOverseer<'log> { } fn outcome(&self) -> Option<Outcome> { + check_reward!(self.log); Outcome::from_bool(helpers::boss_is_dead(self.log)) } } @@ -107,6 +109,7 @@ impl<'log> Analyzer for Samarog<'log> { } fn outcome(&self) -> Option<Outcome> { + check_reward!(self.log); Outcome::from_bool(helpers::boss_is_dead(self.log)) } } @@ -143,6 +146,7 @@ impl<'log> Analyzer for Deimos<'log> { } fn outcome(&self) -> Option<Outcome> { + check_reward!(self.log); // The idea for Deimos is that we first need to figure out when the 10% split happens (if // it even happens), then we can find the time when 10%-Deimos becomes untargetable and // then we can compare this time to the player exit time. diff --git a/src/analyzers/raids/w5.rs b/src/analyzers/raids/w5.rs index 578cea8..f914031 100644 --- a/src/analyzers/raids/w5.rs +++ b/src/analyzers/raids/w5.rs @@ -38,6 +38,7 @@ impl<'log> Analyzer for SoullessHorror<'log> { } fn outcome(&self) -> Option<Outcome> { + check_reward!(self.log); Outcome::from_bool(self.log.events().iter().any(|event| { if let EventKind::BuffApplication { buff_id, @@ -85,6 +86,7 @@ impl<'log> Analyzer for Dhuum<'log> { } fn outcome(&self) -> Option<Outcome> { + check_reward!(self.log); Outcome::from_bool(helpers::boss_is_dead(self.log)) } } diff --git a/src/analyzers/raids/w6.rs b/src/analyzers/raids/w6.rs index 97a2094..2284933 100644 --- a/src/analyzers/raids/w6.rs +++ b/src/analyzers/raids/w6.rs @@ -36,6 +36,7 @@ impl<'log> Analyzer for ConjuredAmalgamate<'log> { } fn outcome(&self) -> Option<Outcome> { + check_reward!(self.log); for event in self.log.events() { if let EventKind::Spawn { agent_addr } = event.kind() { if self @@ -85,6 +86,7 @@ impl<'log> Analyzer for TwinLargos<'log> { } fn outcome(&self) -> Option<Outcome> { + check_reward!(self.log); let mut nikare_dead = false; let mut kenut_dead = false; @@ -144,6 +146,7 @@ impl<'log> Analyzer for Qadim<'log> { } fn outcome(&self) -> Option<Outcome> { + check_reward!(self.log); Outcome::from_bool(helpers::players_exit_after_boss(self.log)) } } diff --git a/src/analyzers/raids/w7.rs b/src/analyzers/raids/w7.rs index bdfadd6..fd36d77 100644 --- a/src/analyzers/raids/w7.rs +++ b/src/analyzers/raids/w7.rs @@ -36,6 +36,7 @@ impl<'log> Analyzer for CardinalAdina<'log> { } fn outcome(&self) -> Option<Outcome> { + check_reward!(self.log); Outcome::from_bool(helpers::boss_is_dead(self.log)) } } @@ -72,6 +73,7 @@ impl<'log> Analyzer for CardinalSabir<'log> { } fn outcome(&self) -> Option<Outcome> { + check_reward!(self.log); Outcome::from_bool(helpers::boss_is_dead(self.log)) } } @@ -106,6 +108,7 @@ impl<'log> Analyzer for QadimThePeerless<'log> { } fn outcome(&self) -> Option<Outcome> { + check_reward!(self.log); Outcome::from_bool(helpers::boss_is_dead(self.log)) } } |