wowlab_engine_combat/state/defs/
periodic.rs1use 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 AddAuraStack {
59 target_aura_local: LocalAuraIdx,
60 },
61 ResidualDamage,
62 RemoveStack,
63 Hook,
64}
65
66#[derive(Clone, Copy, Debug)]
67#[must_use]
68#[expect(
69 clippy::struct_excessive_bools,
70 reason = "periodic scheduling and damage policies are independent flags"
71)]
72pub struct PeriodicData {
73 pub tick_interval_ms: u32,
74 pub damage_spell_id: u32,
75 pub effect_ref: Option<DamageEffectRef>,
76 pub hasted_ticks: bool,
77 pub partial_tick: bool,
78 pub may_crit: bool,
79 pub damage_is_periodic: bool,
80 pub tick_on_application: bool,
81 pub effect: PeriodicKind,
82 pub resource_gain: f64,
83 pub crit_resource_gain: f64,
84 pub crit_resource_chance: f64,
85}
86
87impl PeriodicData {
88 #[must_use]
89 pub const fn damage_spell_id_or(self, aura_id: u32) -> u32 {
90 if self.damage_spell_id == 0 {
91 aura_id
92 } else {
93 self.damage_spell_id
94 }
95 }
96}