From 39972d54be41bfc7b8b7f38b1f5a4d60e2453da5 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Wed, 23 Sep 2020 15:22:55 +0200 Subject: rename Boss to Encounter This is the first step in differentiating between Encounters and Bosses. It sounds a bit weird at first, but there are some events without any bosses (like the River of Souls), and some events which have multiple bosses (like Twin Largos or the kodan strike mission). If we want to support this better, without relying on extra IDs, special casing and constants (like NIKARE_ID), we should differentiate between Encounters and Bosses. --- src/analyzers/mod.rs | 56 ++++++++++++++++++++++++---------------------- src/analyzers/raids/mod.rs | 2 +- src/analyzers/raids/w6.rs | 10 ++++----- 3 files changed, 35 insertions(+), 33 deletions(-) (limited to 'src/analyzers') diff --git a/src/analyzers/mod.rs b/src/analyzers/mod.rs index 28724a2..ff04728 100644 --- a/src/analyzers/mod.rs +++ b/src/analyzers/mod.rs @@ -24,7 +24,7 @@ //! [`Log::analyzer`][Log::analyzer] (or [`for_log`][for_log]) and the methods defined in //! [`Analyzer`][Analyzer]. -use crate::{Boss, Log}; +use crate::{Encounter, Log}; pub mod fractals; pub mod helpers; @@ -82,41 +82,43 @@ pub fn for_log<'l>(log: &'l Log) -> Option> { let boss = log.encounter()?; match boss { - Boss::ValeGuardian | Boss::Gorseval | Boss::Sabetha => { + Encounter::ValeGuardian | Encounter::Gorseval | Encounter::Sabetha => { Some(Box::new(raids::GenericRaid::new(log))) } - Boss::Slothasor | Boss::Matthias => Some(Box::new(raids::GenericRaid::new(log))), + Encounter::Slothasor | Encounter::Matthias => Some(Box::new(raids::GenericRaid::new(log))), - Boss::KeepConstruct => Some(Box::new(raids::GenericRaid::new(log))), - Boss::Xera => Some(Box::new(raids::Xera::new(log))), + Encounter::KeepConstruct => Some(Box::new(raids::GenericRaid::new(log))), + Encounter::Xera => Some(Box::new(raids::Xera::new(log))), - Boss::Cairn => Some(Box::new(raids::Cairn::new(log))), - Boss::MursaatOverseer => Some(Box::new(raids::MursaatOverseer::new(log))), - Boss::Samarog => Some(Box::new(raids::Samarog::new(log))), - Boss::Deimos => Some(Box::new(raids::Deimos::new(log))), + Encounter::Cairn => Some(Box::new(raids::Cairn::new(log))), + Encounter::MursaatOverseer => Some(Box::new(raids::MursaatOverseer::new(log))), + Encounter::Samarog => Some(Box::new(raids::Samarog::new(log))), + Encounter::Deimos => Some(Box::new(raids::Deimos::new(log))), - Boss::SoullessHorror => Some(Box::new(raids::SoullessHorror::new(log))), - Boss::Dhuum => Some(Box::new(raids::Dhuum::new(log))), + Encounter::SoullessHorror => Some(Box::new(raids::SoullessHorror::new(log))), + Encounter::VoiceInTheVoid => Some(Box::new(raids::Dhuum::new(log))), - Boss::ConjuredAmalgamate => Some(Box::new(raids::ConjuredAmalgamate::new(log))), - Boss::LargosTwins => Some(Box::new(raids::LargosTwins::new(log))), - Boss::Qadim => Some(Box::new(raids::Qadim::new(log))), + Encounter::ConjuredAmalgamate => Some(Box::new(raids::ConjuredAmalgamate::new(log))), + Encounter::TwinLargos => Some(Box::new(raids::TwinLargos::new(log))), + Encounter::Qadim => Some(Box::new(raids::Qadim::new(log))), - Boss::CardinalAdina => Some(Box::new(raids::CardinalAdina::new(log))), - Boss::CardinalSabir => Some(Box::new(raids::CardinalSabir::new(log))), - Boss::QadimThePeerless => Some(Box::new(raids::QadimThePeerless::new(log))), + Encounter::CardinalAdina => Some(Box::new(raids::CardinalAdina::new(log))), + Encounter::CardinalSabir => Some(Box::new(raids::CardinalSabir::new(log))), + Encounter::QadimThePeerless => Some(Box::new(raids::QadimThePeerless::new(log))), - Boss::Ai => Some(Box::new(fractals::Ai::new(log))), - Boss::Skorvald => Some(Box::new(fractals::Skorvald::new(log))), - Boss::Artsariiv | Boss::Arkk | Boss::MAMA | Boss::Siax | Boss::Ensolyss => { - Some(Box::new(fractals::GenericFractal::new(log))) - } + Encounter::Ai => Some(Box::new(fractals::Ai::new(log))), + Encounter::Skorvald => Some(Box::new(fractals::Skorvald::new(log))), + Encounter::Artsariiv + | Encounter::Arkk + | Encounter::MAMA + | Encounter::Siax + | Encounter::Ensolyss => Some(Box::new(fractals::GenericFractal::new(log))), - Boss::IcebroodConstruct - | Boss::VoiceOfTheFallen - | Boss::FraenirOfJormag - | Boss::Boneskinner - | Boss::WhisperOfJormag => Some(Box::new(strikes::GenericStrike::new(log))), + Encounter::IcebroodConstruct + | Encounter::SuperKodanBrothers + | Encounter::FraenirOfJormag + | Encounter::Boneskinner + | Encounter::WhisperOfJormag => Some(Box::new(strikes::GenericStrike::new(log))), } } diff --git a/src/analyzers/raids/mod.rs b/src/analyzers/raids/mod.rs index bb3824b..a0602b0 100644 --- a/src/analyzers/raids/mod.rs +++ b/src/analyzers/raids/mod.rs @@ -19,7 +19,7 @@ mod w5; pub use w5::{Dhuum, SoullessHorror}; mod w6; -pub use w6::{ConjuredAmalgamate, LargosTwins, Qadim}; +pub use w6::{ConjuredAmalgamate, TwinLargos, Qadim}; mod w7; pub use w7::{CardinalAdina, CardinalSabir, QadimThePeerless}; diff --git a/src/analyzers/raids/w6.rs b/src/analyzers/raids/w6.rs index 8701a63..11fd02e 100644 --- a/src/analyzers/raids/w6.rs +++ b/src/analyzers/raids/w6.rs @@ -59,21 +59,21 @@ pub const LARGOS_CM_HEALTH: u64 = 19_200_000; /// /// The CM is detected by the boss's health, which is higher in the challenge mote. #[derive(Debug, Clone, Copy)] -pub struct LargosTwins<'log> { +pub struct TwinLargos<'log> { log: &'log Log, } -impl<'log> LargosTwins<'log> { - /// Create a new [`LargosTwins`] analyzer for the given log. +impl<'log> TwinLargos<'log> { + /// Create a new [`TwinLargos`] analyzer for the given log. /// /// **Do not** use this method unless you know what you are doing. Instead, rely on /// [`Log::analyzer`]! pub fn new(log: &'log Log) -> Self { - LargosTwins { log } + TwinLargos { log } } } -impl<'log> Analyzer for LargosTwins<'log> { +impl<'log> Analyzer for TwinLargos<'log> { fn log(&self) -> &Log { self.log } -- cgit v1.2.3 From 14b6a38e61b2e7b6d3d21a350283b3ec60a757ea Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Wed, 23 Sep 2020 15:40:52 +0200 Subject: re-introduce Boss This is now the enum that contains the IDs of the single bosses, like Nikare and Kenut. This means we can do away with the NIKARE_ID and such. The enum is not publicly re-exported, as we re-export Encounter (which is more of a replacement of the old Boss). Special casing still remains (mostly in lib.rs), but we should be able to do away with this now with a more general Encounter::bosses and Boss::encounter methods. --- src/analyzers/raids/w6.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/analyzers') diff --git a/src/analyzers/raids/w6.rs b/src/analyzers/raids/w6.rs index 11fd02e..97a2094 100644 --- a/src/analyzers/raids/w6.rs +++ b/src/analyzers/raids/w6.rs @@ -1,7 +1,7 @@ //! Boss fight analyzers for Wing 6 (Mythwright Gambit) use crate::{ analyzers::{helpers, Analyzer, Outcome}, - gamedata::{KENUT_ID, NIKARE_ID}, + gamedata::Boss, EventKind, Log, }; @@ -100,9 +100,9 @@ impl<'log> Analyzer for TwinLargos<'log> { continue; }; - if agent.id() == NIKARE_ID { + if agent.id() == Boss::Nikare as u16 { nikare_dead = true; - } else if agent.id() == KENUT_ID { + } else if agent.id() == Boss::Kenut as u16 { kenut_dead = true; } } -- cgit v1.2.3 From 4be9a3bac6fda057e5c95f605c320bec2a278e68 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Mon, 28 Sep 2020 13:19:50 +0200 Subject: fix formatting --- src/analyzers/raids/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/analyzers') diff --git a/src/analyzers/raids/mod.rs b/src/analyzers/raids/mod.rs index a0602b0..7b636a7 100644 --- a/src/analyzers/raids/mod.rs +++ b/src/analyzers/raids/mod.rs @@ -19,7 +19,7 @@ mod w5; pub use w5::{Dhuum, SoullessHorror}; mod w6; -pub use w6::{ConjuredAmalgamate, TwinLargos, Qadim}; +pub use w6::{ConjuredAmalgamate, Qadim, TwinLargos}; mod w7; pub use w7::{CardinalAdina, CardinalSabir, QadimThePeerless}; -- cgit v1.2.3