Skip to main content

wowlab_engine_domain/dbc/semantics/
modifier_properties.rs

1use super::SemanticSupport;
2
3/// Typed spell-modifier property identities used by shared engine code.
4#[derive(Clone, Copy, Debug, Eq, PartialEq)]
5#[repr(i32)]
6#[non_exhaustive]
7pub enum ModifierPropertyKind {
8    GenericDamage = 0,
9    Duration = 1,
10    Threat = 2,
11    Effect1 = 3,
12    ProcCharges = 4,
13    Range = 5,
14    Radius = 6,
15    CritChance = 7,
16    Points = 8,
17    ResistPushback = 9,
18    CastTime = 10,
19    Cooldown = 11,
20    Effect2 = 12,
21    TargetResistance = 13,
22    ResourceCost1 = 14,
23    CritDamage = 15,
24    HitChance = 16,
25    ChainTargets = 17,
26    ProcChance = 18,
27    TickTime = 19,
28    ChainMultiplier = 20,
29    GlobalCooldown = 21,
30    PeriodicAmount = 22,
31    Effect3 = 23,
32    Coefficient = 24,
33    ProcFrequency = 26,
34    Amplitude = 27,
35    DispelResistance = 28,
36    Doses = 31,
37    Effect4 = 32,
38    Effect5 = 33,
39    ResourceCost2 = 34,
40    ChainTargetRange = 35,
41    MaxStacks = 37,
42    ProcCooldown = 38,
43    ResourceCost3 = 39,
44    MaxTargets = 40,
45}
46
47/// Property selecting one exact one-based effect coordinate.
48#[must_use]
49pub const fn modifier_property_for_effect(effect_index: u8) -> Option<ModifierPropertyKind> {
50    match effect_index {
51        1 => Some(ModifierPropertyKind::Effect1),
52        2 => Some(ModifierPropertyKind::Effect2),
53        3 => Some(ModifierPropertyKind::Effect3),
54        4 => Some(ModifierPropertyKind::Effect4),
55        5 => Some(ModifierPropertyKind::Effect5),
56        _ => None,
57    }
58}
59
60/// One registered spell-modifier property from `misc_value_0`.
61#[derive(Clone, Copy, Debug, Eq, PartialEq)]
62pub struct ModifierPropertySemantic {
63    pub kind: ModifierPropertyKind,
64    pub name: &'static str,
65    pub operations: ModifierOperations,
66    pub support: SemanticSupport,
67    pub handler: &'static str,
68}
69
70bitflags::bitflags! {
71    /// Modifier operations implemented for one property.
72    #[derive(Copy, Clone, Debug, Eq, PartialEq)]
73    pub struct ModifierOperations: u8 {
74        const FLAT = 1 << 0;
75        const PERCENT = 1 << 1;
76    }
77}
78
79/// Canonical registry of modifier properties implemented by shared resolution.
80#[rustfmt::skip]
81pub const MODIFIER_PROPERTY_SEMANTICS: &[ModifierPropertySemantic] = &[
82    property(ModifierPropertyKind::GenericDamage, "Spell Direct Amount", ModifierOperations::all(), SemanticSupport::Generic, "flat-before-percent direct damage resolution"),
83    property(ModifierPropertyKind::Duration, "Duration", ModifierOperations::all(), SemanticSupport::Generic, "passive and active affect-list duration resolution"),
84    property(ModifierPropertyKind::Threat, "Generated Threat", ModifierOperations::all(), SemanticSupport::Unsupported, "threat generation is not modelled"),
85    property(ModifierPropertyKind::Effect1, "Effect 1", ModifierOperations::all(), SemanticSupport::Generic, "effect-value resolution"),
86    property(ModifierPropertyKind::ProcCharges, "Proc Charges", ModifierOperations::all(), SemanticSupport::Generic, "active and passive affected-proc maximum charge resolution"),
87    property(ModifierPropertyKind::Range, "Range", ModifierOperations::all(), SemanticSupport::Generic, "passive and active hostile cast-range resolution"),
88    property(ModifierPropertyKind::Radius, "Radius", ModifierOperations::all(), SemanticSupport::Generic, "passive and active target-radius resolution"),
89    property(ModifierPropertyKind::CritChance, "Critical Chance", ModifierOperations::all(), SemanticSupport::Generic, "passive critical-chance resolution"),
90    property(ModifierPropertyKind::Points, "All Effect Points", ModifierOperations::all(), SemanticSupport::Generic, "all-effect point resolution"),
91    property(ModifierPropertyKind::ResistPushback, "Resist Pushback", ModifierOperations::all(), SemanticSupport::Generic, "active affected-spell cast pushback resistance"),
92    property(ModifierPropertyKind::CastTime, "Cast Time", ModifierOperations::all(), SemanticSupport::Generic, "passive and active affect-list cast-time resolution"),
93    property(ModifierPropertyKind::Cooldown, "Cooldown", ModifierOperations::all(), SemanticSupport::Generic, "passive and active cooldown resolution"),
94    property(ModifierPropertyKind::Effect2, "Effect 2", ModifierOperations::all(), SemanticSupport::Generic, "effect-value resolution"),
95    property(ModifierPropertyKind::TargetResistance, "Target Resistance", ModifierOperations::all(), SemanticSupport::Generic, "affected-spell target armor and resistance resolution"),
96    property(ModifierPropertyKind::ResourceCost1, "Resource Cost 1", ModifierOperations::all(), SemanticSupport::Generic, "passive resource-cost resolution"),
97    property(ModifierPropertyKind::CritDamage, "Critical Damage", ModifierOperations::all(), SemanticSupport::Generic, "passive critical-damage resolution"),
98    property(ModifierPropertyKind::HitChance, "Hit Chance", ModifierOperations::all(), SemanticSupport::Generic, "affected-spell attack-table hit resolution"),
99    property(ModifierPropertyKind::ChainTargets, "Chain Targets", ModifierOperations::all(), SemanticSupport::Generic, "passive chain-target count resolution"),
100    property(ModifierPropertyKind::ProcChance, "Proc Chance", ModifierOperations::all(), SemanticSupport::Generic, "passive proc-chance resolution"),
101    property(ModifierPropertyKind::TickTime, "Tick Time", ModifierOperations::all(), SemanticSupport::Generic, "passive and active affect-list periodic interval resolution"),
102    property(ModifierPropertyKind::ChainMultiplier, "Chain Multiplier", ModifierOperations::all(), SemanticSupport::Generic, "passive chain-falloff resolution"),
103    property(ModifierPropertyKind::GlobalCooldown, "Global Cooldown", ModifierOperations::all(), SemanticSupport::Generic, "passive and active affect-list global-cooldown resolution"),
104    property(ModifierPropertyKind::PeriodicAmount, "Spell Periodic Amount", ModifierOperations::PERCENT, SemanticSupport::Generic, "passive periodic damage multiplier"),
105    property(ModifierPropertyKind::Effect3, "Effect 3", ModifierOperations::all(), SemanticSupport::Generic, "effect-value resolution"),
106    property(ModifierPropertyKind::Coefficient, "Spell Coefficient", ModifierOperations::all(), SemanticSupport::Generic, "spell-power/attack-power coefficient resolution"),
107    property(ModifierPropertyKind::ProcFrequency, "Proc Frequency", ModifierOperations::all(), SemanticSupport::Generic, "affected-proc RPPM rate resolution"),
108    property(ModifierPropertyKind::Amplitude, "Effect Value Multiplier", ModifierOperations::all(), SemanticSupport::Generic, "passive and active effect-value multiplier resolution"),
109    property(ModifierPropertyKind::DispelResistance, "Dispel Resistance", ModifierOperations::all(), SemanticSupport::Generic, "affected-aura dispel resistance resolution"),
110    property(ModifierPropertyKind::Doses, "Doses", ModifierOperations::all(), SemanticSupport::Generic, "passive Doses-property resolution; nonpositive sentinels apply one stack"),
111    property(ModifierPropertyKind::Effect4, "Effect 4", ModifierOperations::all(), SemanticSupport::Generic, "effect-value resolution"),
112    property(ModifierPropertyKind::Effect5, "Effect 5", ModifierOperations::all(), SemanticSupport::Generic, "effect-value resolution"),
113    property(ModifierPropertyKind::ResourceCost2, "Resource Cost 2", ModifierOperations::all(), SemanticSupport::Generic, "passive resource-cost resolution"),
114    property(ModifierPropertyKind::ChainTargetRange, "Chain Target Range", ModifierOperations::all(), SemanticSupport::Generic, "passive and active chain-jump-distance resolution"),
115    property(ModifierPropertyKind::MaxStacks, "Maximum Stacks", ModifierOperations::all(), SemanticSupport::Generic, "passive aura-stack resolution"),
116    property(ModifierPropertyKind::ProcCooldown, "Proc Cooldown", ModifierOperations::all(), SemanticSupport::Generic, "affected-proc internal-cooldown resolution"),
117    property(ModifierPropertyKind::ResourceCost3, "Resource Cost 3", ModifierOperations::all(), SemanticSupport::Generic, "passive resource-cost resolution"),
118    property(ModifierPropertyKind::MaxTargets, "Maximum Targets", ModifierOperations::all(), SemanticSupport::Generic, "passive and active spell-level target-cap resolution"),
119];
120
121const fn property(
122    kind: ModifierPropertyKind,
123    name: &'static str,
124    operations: ModifierOperations,
125    support: SemanticSupport,
126    handler: &'static str,
127) -> ModifierPropertySemantic {
128    ModifierPropertySemantic {
129        kind,
130        name,
131        operations,
132        support,
133        handler,
134    }
135}