diff options
author | Daniel Schadt <kingdread@gmx.de> | 2020-09-23 16:17:06 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2020-09-23 16:17:06 +0200 |
commit | 43be7f946c71d54e6ca4c8c517560590ad1f5b8a (patch) | |
tree | 66aea4d9e2cffcf0074c6f02a6a337270512980f /src/gamedata.rs | |
parent | 14b6a38e61b2e7b6d3d21a350283b3ec60a757ea (diff) | |
download | evtclib-43be7f946c71d54e6ca4c8c517560590ad1f5b8a.tar.gz evtclib-43be7f946c71d54e6ca4c8c517560590ad1f5b8a.tar.bz2 evtclib-43be7f946c71d54e6ca4c8c517560590ad1f5b8a.zip |
add Encounter::bosses and Boss::encounter
Those functions can be used to simplify the special case handling that
was done in lib.rs on encounters that have multiple bosses.
Diffstat (limited to 'src/gamedata.rs')
-rw-r--r-- | src/gamedata.rs | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/src/gamedata.rs b/src/gamedata.rs index 1f38b0e..fa7998f 100644 --- a/src/gamedata.rs +++ b/src/gamedata.rs @@ -72,6 +72,51 @@ pub enum Encounter { WhisperOfJormag = Boss::WhisperOfJormag as u16, } +impl Encounter { + /// Return all possible bosses that can appear in this encounter. + /// + /// This returns the possible boss IDs, not actual agents. For a similar function check + /// [`Log::boss_agents`][crate::Log::boss_agents]. + /// + /// Note that not all of them have to be present in a log, for example if the encounter stopped + /// before all of them spawned. + pub fn bosses(self) -> &'static [Boss] { + match self { + Encounter::ValeGuardian => &[Boss::ValeGuardian], + Encounter::Gorseval => &[Boss::Gorseval], + Encounter::Sabetha => &[Boss::Sabetha], + Encounter::Slothasor => &[Boss::Slothasor], + Encounter::Matthias => &[Boss::Matthias], + Encounter::KeepConstruct => &[Boss::KeepConstruct], + Encounter::Xera => &[Boss::Xera, Boss::Xera2], + Encounter::Cairn => &[Boss::Cairn], + Encounter::MursaatOverseer => &[Boss::MursaatOverseer], + Encounter::Samarog => &[Boss::Samarog], + Encounter::Deimos => &[Boss::Deimos], + Encounter::SoullessHorror => &[Boss::SoullessHorror], + Encounter::VoiceInTheVoid => &[Boss::Dhuum], + Encounter::ConjuredAmalgamate => &[Boss::ConjuredAmalgamate], + Encounter::TwinLargos => &[Boss::Nikare, Boss::Kenut], + Encounter::Qadim => &[Boss::Qadim], + Encounter::CardinalAdina => &[Boss::CardinalAdina], + Encounter::CardinalSabir => &[Boss::CardinalSabir], + Encounter::QadimThePeerless => &[Boss::QadimThePeerless], + Encounter::Ai => &[Boss::Ai], + Encounter::Skorvald => &[Boss::Skorvald], + Encounter::Artsariiv => &[Boss::Artsariiv], + Encounter::Arkk => &[Boss::Arkk], + Encounter::MAMA => &[Boss::MAMA], + Encounter::Siax => &[Boss::Siax], + Encounter::Ensolyss => &[Boss::Ensolyss], + Encounter::IcebroodConstruct => &[Boss::IcebroodConstruct], + Encounter::SuperKodanBrothers => &[Boss::VoiceOfTheFallen, Boss::ClawOfTheFallen], + Encounter::FraenirOfJormag => &[Boss::FraenirOfJormag], + Encounter::Boneskinner => &[Boss::Boneskinner], + Encounter::WhisperOfJormag => &[Boss::WhisperOfJormag], + } + } +} + /// Error for when converting a string to an encounter fails. #[derive(Debug, Clone, Hash, PartialEq, Eq, Error)] #[error("Invalid encounter identifier: {0}")] @@ -243,6 +288,50 @@ pub enum Boss { WhisperOfJormag = 0x58B7, } +impl Boss { + /// Get the encounter ID in which this boss can appear. + /// + /// This is the counterpart to [`Encounter::bosses`]. + pub fn encounter(self) -> Encounter { + match self { + Boss::ValeGuardian => Encounter::ValeGuardian, + Boss::Gorseval => Encounter::Gorseval, + Boss::Sabetha => Encounter::Sabetha, + Boss::Slothasor => Encounter::Slothasor, + Boss::Matthias => Encounter::Matthias, + Boss::KeepConstruct => Encounter::KeepConstruct, + Boss::Xera => Encounter::Xera, + Boss::Xera2 => Encounter::Xera, + Boss::Cairn => Encounter::Cairn, + Boss::MursaatOverseer => Encounter::MursaatOverseer, + Boss::Samarog => Encounter::Samarog, + Boss::Deimos => Encounter::Deimos, + Boss::SoullessHorror => Encounter::SoullessHorror, + Boss::Dhuum => Encounter::VoiceInTheVoid, + Boss::ConjuredAmalgamate => Encounter::ConjuredAmalgamate, + Boss::Nikare => Encounter::TwinLargos, + Boss::Kenut => Encounter::TwinLargos, + Boss::Qadim => Encounter::Qadim, + Boss::CardinalAdina => Encounter::CardinalAdina, + Boss::CardinalSabir => Encounter::CardinalSabir, + Boss::QadimThePeerless => Encounter::QadimThePeerless, + Boss::Ai => Encounter::Ai, + Boss::Skorvald => Encounter::Skorvald, + Boss::Artsariiv => Encounter::Artsariiv, + Boss::Arkk => Encounter::Arkk, + Boss::MAMA => Encounter::MAMA, + Boss::Siax => Encounter::Siax, + Boss::Ensolyss => Encounter::Ensolyss, + Boss::IcebroodConstruct => Encounter::IcebroodConstruct, + Boss::VoiceOfTheFallen => Encounter::SuperKodanBrothers, + Boss::ClawOfTheFallen => Encounter::SuperKodanBrothers, + Boss::FraenirOfJormag => Encounter::FraenirOfJormag, + Boss::Boneskinner => Encounter::Boneskinner, + Boss::WhisperOfJormag => Encounter::WhisperOfJormag, + } + } +} + /// Error for when converting a string to a profession fails. #[derive(Debug, Clone, PartialEq, Eq, Hash, Error)] #[error("Invalid profession identifier: {0}")] |