Skip to main content

wowlab_types/types/game/
attribute.rs

1use serde::{Deserialize, Serialize};
2
3use super::super::combat::DamageSchool;
4
5#[derive(
6    Clone,
7    Copy,
8    Debug,
9    Eq,
10    Hash,
11    PartialEq,
12    num_enum::IntoPrimitive,
13    num_enum::TryFromPrimitive,
14    serde::Deserialize,
15    serde::Serialize,
16    strum::Display,
17    strum::EnumCount,
18    strum::EnumIter,
19    strum::EnumString,
20)]
21#[cfg_attr(feature = "wasm", derive(tsify::Tsify))]
22#[cfg_attr(feature = "wasm", tsify(into_wasm_abi, from_wasm_abi))]
23#[repr(u8)]
24// #t(rust_non_exhaustive_on_public) WoW primary attributes are game-defined
25pub enum Attribute {
26    Strength = 0,
27    Agility = 1,
28    Intellect = 2,
29    Stamina = 3,
30}
31
32#[derive(
33    Clone,
34    Copy,
35    Debug,
36    Eq,
37    Hash,
38    PartialEq,
39    num_enum::IntoPrimitive,
40    num_enum::TryFromPrimitive,
41    serde::Deserialize,
42    serde::Serialize,
43    strum::Display,
44    strum::EnumCount,
45    strum::EnumIter,
46    strum::EnumString,
47)]
48#[cfg_attr(feature = "wasm", derive(tsify::Tsify))]
49#[cfg_attr(feature = "wasm", tsify(into_wasm_abi, from_wasm_abi))]
50#[repr(u8)]
51// #t(rust_non_exhaustive_on_public) WoW rating types are game-defined
52pub enum RatingType {
53    Crit = 0,
54    Haste = 1,
55    Mastery = 2,
56    Versatility = 3,
57    Leech = 4,
58    Avoidance = 5,
59    Speed = 6,
60}
61
62impl RatingType {
63    pub const COMBAT_COUNT: usize = 4;
64}
65
66/// Percentage values after rating conversion.
67#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
68#[cfg_attr(feature = "wasm", derive(tsify::Tsify))]
69#[cfg_attr(feature = "wasm", tsify(into_wasm_abi, from_wasm_abi))]
70// #t(rust_non_exhaustive_on_public) WoW derived stats are game-defined
71pub enum DerivedStat {
72    CritChance,
73    Haste,
74    VersatilityDamage,
75    VersatilityDr,
76    Mastery,
77}
78
79#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
80#[cfg_attr(feature = "wasm", derive(tsify::Tsify))]
81#[cfg_attr(feature = "wasm", tsify(into_wasm_abi, from_wasm_abi))]
82#[non_exhaustive]
83pub enum MasteryEffect {
84    AllDamage,
85    PhysicalDamage,
86    MagicDamage,
87    PetDamage,
88    PetAndOwnerDamage { owner_pct: f32 },
89    DotDamage,
90    ExecuteDamage { threshold: f32 },
91    SchoolDamage(DamageSchool),
92    Custom,
93}