Skip to main content

wowlab_engine_content/hooks/affliction_warlock/
handler.rs

1use wowlab_engine_combat::{CombatHandler, ResourceGainProc};
2use wowlab_engine_ports::{EngineError, HandlerParams};
3
4
5use crate::generated::specs::affliction_warlock::TALENT;
6
7use super::{
8    config::{AfflictionRuntime, affliction_config},
9    hooks::succulent_soul_proc,
10};
11
12const SUCCULENT_SOUL_RATE: f64 = 0.225;
13/// Affliction handler that installs gain-driven Soul Harvester mechanics.
14#[derive(Debug)]
15pub(crate) struct AfflictionHandler {
16    inner: CombatHandler,
17}
18
19impl AfflictionHandler {
20    /// Finishes the specialization handler from the shared-content composition stage.
21    pub(crate) fn try_new(
22        parts: crate::composition::ContentHandlerParts,
23        params: &HandlerParams<'_>,
24    ) -> Result<Self, EngineError> {
25        let mut built = parts.into_built();
26
27        if params.talent_picked(TALENT::DEMONIC_SOUL) {
28            built.register_resource_gain_proc(
29                ResourceGainProc::prd(SUCCULENT_SOUL_RATE, succulent_soul_proc).per_whole_unit(),
30            );
31        }
32
33        if params.talent_picked(TALENT::SHADOW_OF_NATHREZA_3) {
34            let _ = built.register_system_rppm_from_data(TALENT::SHADOW_OF_NATHREZA_3)?;
35        }
36
37        built.state.set_spec_config(affliction_config(params));
38        built.state.set_spec_runtime(AfflictionRuntime::default());
39
40        Ok(Self {
41            inner: CombatHandler::from_built(built),
42        })
43    }
44}
45
46crate::hooks::define_spec_handler! {
47impl AfflictionHandler(self, inner) {
48    fn on_sim_start(&mut self, ctx: &mut wowlab_engine_ports::SimContext) {
49        self.inner.on_sim_start(ctx);
50    }
51}
52}