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