Skip to main content

wowlab_engine_domain/dbc/semantics/
stat_masks.rs

1//! Attribute and rating-family masks carried by stat-modifier aura effects.
2
3bitflags::bitflags! {
4    #[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
5    pub struct AttributeMask: i32 {
6        const STRENGTH = 1 << 0;
7        const AGILITY = 1 << 1;
8        const STAMINA = 1 << 2;
9        const INTELLECT = 1 << 3;
10
11        const ALL = Self::STRENGTH.bits()
12            | Self::AGILITY.bits()
13            | Self::STAMINA.bits()
14            | Self::INTELLECT.bits();
15    }
16}
17
18impl AttributeMask {
19    #[must_use]
20    pub const fn from_dbc(raw: i32) -> Self {
21        if raw < 0 {
22            Self::ALL
23        } else {
24            Self::from_bits_retain(raw)
25        }
26    }
27}
28
29bitflags::bitflags! {
30    #[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
31    pub struct RatingMultiplierMask: i32 {
32        const CRIT_MELEE = 1 << 8;
33        const CRIT_RANGED = 1 << 9;
34        const CRIT_SPELL = 1 << 10;
35        const HASTE_MELEE = 1 << 17;
36        const HASTE_RANGED = 1 << 18;
37        const HASTE_SPELL = 1 << 19;
38        const MASTERY = 1 << 25;
39        const VERSATILITY_DAMAGE_DONE = 1 << 28;
40        const VERSATILITY_HEALING_DONE = 1 << 29;
41        const VERSATILITY_DAMAGE_TAKEN = 1 << 30;
42
43        const CRIT = Self::CRIT_MELEE.bits()
44            | Self::CRIT_RANGED.bits()
45            | Self::CRIT_SPELL.bits();
46        const HASTE = Self::HASTE_MELEE.bits()
47            | Self::HASTE_RANGED.bits()
48            | Self::HASTE_SPELL.bits();
49        const VERSATILITY = Self::VERSATILITY_DAMAGE_DONE.bits()
50            | Self::VERSATILITY_HEALING_DONE.bits()
51            | Self::VERSATILITY_DAMAGE_TAKEN.bits();
52    }
53}
54
55impl RatingMultiplierMask {
56    #[must_use]
57    pub const fn from_dbc(raw: i32) -> Self {
58        Self::from_bits_retain(raw)
59    }
60}