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