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 built = parts.into_built();
18
19 if params.talent_picked(TALENT::FROSTREAPER) {
20 let _ = built.register_system_rppm_from_data(TALENT::FROSTREAPER)?;
21 }
22
23 built
24 .state
25 .set_spec_config(super::config::frost_dk_config(params));
26
27 Ok(Self {
28 inner: CombatHandler::from_built(built),
29 })
30 }
31}
32
33crate::hooks::define_spec_handler! {
34impl FrostDkHandler(self, inner) {
35 fn on_sim_start(&mut self, ctx: &mut SimContext) {
36 self.inner.on_sim_start(ctx);
37 }
38
39 fn on_player_ready(&mut self, ctx: &mut SimContext) -> Option<SpecAction> {
40 self.inner.on_player_ready(ctx)
41 }
42
43 fn on_cast_complete(&mut self, event: wowlab_engine_ports::Event, ctx: &mut SimContext) {
44 self.inner.on_cast_complete(event, ctx);
45 }
46
47 fn on_spell_impact(&mut self, impact_id: u32, ctx: &mut SimContext) {
48 self.inner.on_spell_impact(impact_id, ctx);
49 }
50
51}
52delegate {
53 fn on_aura_tick(&mut self, event: wowlab_engine_ports::AuraEventRef, ctx: &mut SimContext);
54 fn on_aura_expire(&mut self, event: wowlab_engine_ports::AuraEventRef, ctx: &mut SimContext);
55 fn on_auto_attack(&mut self, source: wowlab_types::sim::ActorId, target: wowlab_types::sim::EnemyIdx, ctx: &mut SimContext);
56 fn on_cooldown_ready(&mut self, cooldown_key: wowlab_types::sim::SpellIdx, ctx: &mut SimContext);
57 fn flush_scheduled(&mut self, push: &mut dyn FnMut(wowlab_engine_ports::Event));
58 fn reset(&mut self);
59 fn total_damage(&self) -> f64;
60 fn cast_time_ms(&self, spell_id: wowlab_types::sim::SpellIdx, empower_rank: u8) -> u32;
61 fn introspect(&self) -> wowlab_types::game::SpecIntrospection;
62 fn paperdoll(&self) -> Option<wowlab_engine_ports::Paperdoll>;
63 fn attach_decision_trace(
64 &mut self,
65 sink: std::sync::Arc<dyn wowlab_engine_ports::DecisionTraceSink>,
66 );
67}
68}