Skip to main content

wowlab_engine_combat/state/defs/
periodic.rs

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