Skip to main content

wowlab_engine_combat/builder/def/
periodic.rs

1use crate::state::LocalAuraIdx;
2
3#[derive(Clone, Debug)]
4#[expect(
5    clippy::struct_excessive_bools,
6    reason = "periodic scheduling and damage policies are independent flags"
7)]
8pub(crate) struct PeriodicDef {
9    pub(crate) tick_ms: u32,
10    pub(crate) damage_spell_id: Option<u32>,
11    pub(crate) effect_ref: Option<crate::state::DamageEffectRef>,
12    pub(crate) hasted: bool,
13    pub(crate) partial_tick: bool,
14    pub(crate) may_crit: bool,
15    pub(crate) damage_is_periodic: bool,
16    pub(crate) tick_on_application: bool,
17    pub(crate) effect: PeriodicEffectDef,
18    pub(crate) resource_gain: f64,
19    pub(crate) crit_resource_gain: f64,
20    pub(crate) crit_resource_chance: f64,
21}
22
23impl PeriodicDef {
24    pub(crate) fn new(tick_ms: u32, hasted: bool, effect: PeriodicEffectDef) -> Self {
25        Self {
26            tick_ms,
27            damage_spell_id: None,
28            effect_ref: None,
29            hasted,
30            partial_tick: false,
31            may_crit: true,
32            damage_is_periodic: true,
33            tick_on_application: false,
34            effect,
35            resource_gain: 0.0,
36            crit_resource_gain: 0.0,
37            crit_resource_chance: 0.0,
38        }
39    }
40}
41
42#[derive(Clone, Debug)]
43#[non_exhaustive]
44pub(crate) enum PeriodicEffectDef {
45    FlatDamage {
46        amount: f64,
47        is_physical: bool,
48    },
49    RollingFlatDamage {
50        amount: f64,
51        is_physical: bool,
52    },
53    Damage {
54        ap_coef: f64,
55        is_physical: bool,
56    },
57    RollingDamage {
58        ap_coef: f64,
59        is_physical: bool,
60    },
61    SpDamage {
62        sp_coef: f64,
63        is_physical: bool,
64    },
65    RollingSpDamage {
66        sp_coef: f64,
67        is_physical: bool,
68    },
69    MaxHealthDamage {
70        percent: f64,
71        is_physical: bool,
72    },
73    Heal {
74        base: f64,
75        ap_coef: f64,
76        sp_coef: f64,
77        percent_of_max: f64,
78    },
79    Leech {
80        base: f64,
81        ap_coef: f64,
82        sp_coef: f64,
83        is_physical: bool,
84        heal_multiplier: f64,
85    },
86    ResourceGain {
87        amount: f64,
88        resource_type: Option<wowlab_types::combat::ResourceType>,
89    },
90    ResourceDrain {
91        amount: f64,
92    },
93    ApplyAura {
94        target_aura_local: LocalAuraIdx,
95    },
96    ResidualDamage,
97    RemoveStack,
98    Hook,
99}