Skip to main content

wowlab_engine_content/hooks/havoc_demon_hunter/
handler.rs

1use wowlab_engine_combat::CombatHandler;
2use wowlab_engine_ports::{HandlerParams, SimContext, SpecAction};
3
4
5use super::config::register_havoc;
6
7/// Havoc Demon Hunter combat handler.
8#[derive(Debug)]
9pub(crate) struct HavocHandler {
10    inner: CombatHandler,
11}
12
13impl HavocHandler {
14    /// Finishes the specialization handler from the shared-content composition stage.
15    pub(crate) fn new(
16        parts: crate::composition::ContentHandlerParts,
17        params: &HandlerParams<'_>,
18    ) -> Result<Self, wowlab_engine_ports::EngineError> {
19        let mut parts = parts;
20        let built = parts.draft_mut();
21
22        register_havoc(built, params);
23
24        let built = parts.finalize()?;
25
26        Ok(Self {
27            inner: CombatHandler::from_built(built),
28        })
29    }
30}
31
32crate::hooks::define_spec_handler! {
33impl HavocHandler(self, inner) {
34    fn on_sim_start(&mut self, ctx: &mut SimContext) {
35        self.inner.on_sim_start(ctx);
36    }
37
38    fn on_player_ready(&mut self, ctx: &mut SimContext) -> Option<SpecAction> {
39        self.inner.on_player_ready(ctx)
40    }
41
42    fn reset(&mut self) {
43        self.inner.reset();
44    }
45
46}
47delegate {
48            fn on_cast_complete(&mut self, event: wowlab_engine_ports::Event, ctx: &mut SimContext);
49            fn on_spell_impact(&mut self, impact_id: wowlab_engine_ports::PendingImpactBinding, ctx: &mut SimContext);
50            fn on_aura_tick(&mut self, event: wowlab_engine_ports::AuraEventRef, ctx: &mut SimContext);
51            fn on_aura_expire(&mut self, event: wowlab_engine_ports::AuraEventRef, ctx: &mut SimContext);
52            fn on_auto_attack(&mut self, source: wowlab_types::sim::ActorId, target: wowlab_types::sim::EnemyIdx, ctx: &mut SimContext);
53            fn on_cooldown_ready(&mut self, spell: wowlab_engine_ports::ScheduledSpellBinding, ctx: &mut SimContext);
54            fn flush_scheduled(&mut self, push: &mut dyn FnMut(wowlab_engine_ports::Event));
55            fn total_damage(&self) -> f64;
56            fn cast_time_ms(&self, spell: wowlab_engine_ports::ScheduledSpellBinding, empower_rank: u8) -> u32;
57            fn introspect(&self) -> wowlab_types::game::SpecIntrospection;
58            fn paperdoll(&self) -> Option<wowlab_engine_ports::Paperdoll>;
59            fn attach_decision_trace(
60                &mut self,
61                sink: std::sync::Arc<dyn wowlab_engine_ports::DecisionTraceSink>,
62            );
63}
64}