Skip to main content

wowlab_engine_content/hooks/feral_druid/
config.rs

1use wowlab_engine_combat::{AccumulatingImpactProc, ImpactActorFilter, ImpactProc};
2use wowlab_engine_domain::dbc::ResolvedGameDataEffectExt as _;
3use wowlab_types::{
4    constants::{HUNDRED, THOUSAND},
5};
6
7use crate::generated::specs::feral_druid::{EFFECT, SET_BONUS, TALENT};
8
9use super::hooks::{
10    apex_predator_fire, bloodseeker_vines_fire, builder_filter, primal_fury_fire, rip_filter,
11    rip_or_rake_filter, thriving_growth_contribution,
12};
13
14#[derive(Clone, Copy, Debug)]
15pub(super) enum ConvokeCast {
16    Exceptional,
17    Main,
18    Offspec,
19    Spec,
20}
21
22#[derive(Debug, Default)]
23pub(super) struct FeralRuntime {
24    pub(super) convoke_casts: Vec<ConvokeCast>,
25    pub(super) convoke_exceptional_deck: Vec<bool>,
26    pub(super) halazzis_fury_duration_ms: u32,
27}
28
29crate::hooks::define_spec_config! {
30    pub(super) struct FeralConfig {
31        ashamanes_guidance: bool { provenance: "Ashamane's Guidance 391548 selection; learned passive 391538 is folded generically into Convoke's action count, channel duration, and cooldown.", gate: params.talent_picked(TALENT::ASHAMANES_GUIDANCE), source: true, transform: |value| value, },
32        soul_of_the_forest: bool { provenance: "Soul of the Forest (158476): finishers refund 2 energy per CP (e1).", gate: params.talent_picked(TALENT::SOUL_OF_THE_FOREST), source: true, transform: |value| value, },
33        panthers_guile: bool { provenance: "Panther's Guile (1280316): Shred/LI can fill combo points.", gate: params.talent_picked(TALENT::PANTHERS_GUILE), source: true, transform: |value| value, },
34        tigers_tenacity: bool { provenance: "Tiger's Tenacity (391872): Tiger's Fury readies combo refunds.", gate: params.talent_picked(TALENT::TIGERS_TENACITY), source: true, transform: |value| value, },
35        sabertooth: bool { provenance: "Sabertooth (202031): Ferocious Bite applies 391722.", gate: params.talent_picked(TALENT::SABERTOOTH), source: true, transform: |value| value, },
36        halazzis_fury_ms_per_cp: u32 { provenance: "MID2 Feral 2pc 1296605 e1 milliseconds banked per combo point.", gate: params.set_bonus_auras.contains(&SET_BONUS::MID2_FERAL_2PC), source: params.game_data.effect_base_points(EFFECT::HALAZZIS_FURY_MS_PER_CP), transform: wowlab_types::numeric::f64_to_u32_saturating_trunc, },
37        halazzis_fury_guided_ms_per_cp: u32 { provenance: "MID2 Feral 2pc 1296605 e2 milliseconds banked during Incarnation with Ashamane's Guidance.", gate: params.set_bonus_auras.contains(&SET_BONUS::MID2_FERAL_2PC) && params.talent_picked(TALENT::ASHAMANES_GUIDANCE), source: params.game_data.effect_base_points(EFFECT::HALAZZIS_FURY_GUIDED_MS_PER_CP), transform: wowlab_types::numeric::f64_to_u32_saturating_trunc, },
38        omen_of_clarity: bool { provenance: "Omen of Clarity 16864 selection gates its white-melee proc.", gate: params.talent_picked(TALENT::OMEN_OF_CLARITY), source: true, transform: |value| value, },
39        moment_of_clarity_proc_bonus: f64 { provenance: "Moment of Clarity 236068 e2 increases Omen frequency.", gate: params.talent_picked(TALENT::MOMENT_OF_CLARITY), source: params.game_data.effect_base_points(EFFECT::MOMENT_OF_CLARITY_PROC_BONUS), transform: |value| value / HUNDRED, },
40        lycaras_teachings: bool { provenance: "Lycara's Teachings 378988 makes Cat Form carry critical-strike variant 378990.", gate: params.talent_picked(TALENT::LYCARAS_TEACHINGS), source: true, transform: |value| value, },
41        strategic_infusion: bool { provenance: "Strategic Infusion 439890 makes Tiger's Fury ready 439891.", gate: params.talent_picked(TALENT::STRATEGIC_INFUSION), source: true, transform: |value| value, },
42        sudden_ambush_chance: f64 { provenance: "Sudden Ambush 384667 e1 is the per-combo-point chance in percent points.", gate: params.talent_picked(TALENT::SUDDEN_AMBUSH), source: params.game_data.effect_base_points(EFFECT::SUDDEN_AMBUSH_CHANCE), transform: |value| value / HUNDRED, },
43        apex_proc_chance: f64 { provenance: "Apex Predator's Craving 391881 e1 stores chance in tenths of a percent.", gate: params.talent_picked(TALENT::APEX_PREDATORS_CRAVING), source: params.game_data.effect_base_points(EFFECT::APEX_PREDATOR_CHANCE), transform: |value| value / THOUSAND, },
44        thriving_rake_contribution: f64 { provenance: "Thriving Growth 439528 e2 contributes a randomized amount on each Rake tick.", gate: params.talent_picked(TALENT::THRIVING_GROWTH), source: params.game_data.effect_base_points(EFFECT::THRIVING_GROWTH_RAKE), transform: |value| value, },
45        thriving_rip_contribution: f64 { provenance: "Thriving Growth 439528 e1 contributes a randomized amount on each Rip tick.", gate: params.talent_picked(TALENT::THRIVING_GROWTH), source: params.game_data.effect_base_points(EFFECT::THRIVING_GROWTH_RIP), transform: |value| value, },
46    }
47    accessor pub(super) fn feral_config(ctx);
48    register pub(super) fn register_feral(built, params) -> ();
49    prepare {}
50    auras {}
51    wiring {
52        { provenance: "Primal Fury critical builder proc.", gate: params.talent_picked(TALENT::PRIMAL_FURY), apply: {
53            built.register_impact_proc(ImpactProc::new(primal_fury_fire).with_spell_filter(builder_filter).skip_periodic().crit_only());
54        } },
55        { provenance: "Apex Predator's Craving procs from Rip periodic damage in the single-target repair lens.", gate: cfg.apex_proc_chance > 0.0, apply: {
56            built.register_impact_proc(ImpactProc::new(apex_predator_fire).with_chance(cfg.apex_proc_chance).with_spell_filter(rip_filter).periodic_only());
57        } },
58        { provenance: "Thriving Growth accumulates randomized Rip/Rake tick contributions until Bloodseeker Vines triggers.", gate: cfg.thriving_rip_contribution > 0.0 || cfg.thriving_rake_contribution > 0.0, apply: {
59            built.register_accumulating_impact_proc(AccumulatingImpactProc { driver: wowlab_engine_combat::ProcDriver::default(), actor_filter: ImpactActorFilter::Player, threshold: 1000.0, accumulator: f64::NAN, contribution: thriving_growth_contribution, fire: bloodseeker_vines_fire, spell_filter: Some(rip_or_rake_filter), periodic_only: true, skip_periodic: false, crit_only: false });
60        } },
61    }
62    finish |cfg| {
63        built.set_spec_config(cfg);
64        built.set_spec_runtime(FeralRuntime::default());
65    }
66}