Skip to main content

wowlab_engine_gamedata/game_data/
passive_access.rs

1//! Passive-modifier access to resolved game data.
2
3use wowlab_types::sim::SpellIdx;
4
5use super::{PassiveSpellModifiers, ResolvedGameData};
6
7impl ResolvedGameData {
8    /// All static passive modifiers for a spell, with neutral values when none were resolved.
9    #[must_use]
10    pub fn passive_spell_modifiers(&self, spell_id: SpellIdx) -> PassiveSpellModifiers {
11        wowlab_types::bench_metrics::record_game_data_hot_read();
12
13        self.inner
14            .passives
15            .spell_modifiers
16            .get(&spell_id)
17            .copied()
18            .unwrap_or_default()
19    }
20
21    /// Player-wide crit-damage terms scaled by the caster's own crit chance, as `(DBC school mask, percent points)`.
22    #[must_use]
23    pub fn crit_damage_per_crit_chance(&self) -> &[(i32, f64)] {
24        wowlab_types::bench_metrics::record_game_data_hot_read();
25
26        &self.inner.passives.crit_damage_per_crit_chance
27    }
28
29    /// Static auto-attack damage multiplier from passive spec/class auras.
30    #[must_use]
31    pub fn auto_attack_damage_mult(&self) -> f64 {
32        wowlab_types::bench_metrics::record_game_data_hot_read();
33
34        self.inner.passives.auto_attack_damage_mult
35    }
36
37    /// Static pet damage multiplier from passive spec/class auras.
38    #[must_use]
39    pub fn pet_damage_mult(&self) -> f64 {
40        wowlab_types::bench_metrics::record_game_data_hot_read();
41
42        self.inner.passives.pet_damage_mult
43    }
44
45    /// Static guardian damage multiplier from passive spec/class auras.
46    #[must_use]
47    pub fn guardian_damage_mult(&self) -> f64 {
48        wowlab_types::bench_metrics::record_game_data_hot_read();
49
50        self.inner.passives.guardian_damage_mult
51    }
52
53    /// Aura-382 multiplier for attack power inherited by `npc_id`.
54    #[must_use]
55    pub fn pet_attack_power_inheritance_mult(&self, npc_id: u32) -> f64 {
56        wowlab_types::bench_metrics::record_game_data_hot_read();
57
58        self.inner
59            .passives
60            .pet_attack_power_inheritance
61            .get(&npc_id)
62            .copied()
63            .unwrap_or(1.0)
64    }
65
66    /// Aura-382 multiplier for spell power inherited by `npc_id`.
67    #[must_use]
68    pub fn pet_spell_power_inheritance_mult(&self, npc_id: u32) -> f64 {
69        wowlab_types::bench_metrics::record_game_data_hot_read();
70
71        self.inner
72            .passives
73            .pet_spell_power_inheritance
74            .get(&npc_id)
75            .copied()
76            .unwrap_or(1.0)
77    }
78
79    /// Whether `spell_id` is a baseline spec-granted spell (known without being talented).
80    #[must_use]
81    pub fn is_specialization_spell(&self, spell_id: SpellIdx) -> bool {
82        wowlab_types::bench_metrics::record_game_data_hot_read();
83
84        self.inner.spells.specialization.contains(&spell_id)
85    }
86
87    /// Whether `spell_id` was folded into its static passive-modifier record (live aura resolution must skip these to avoid double-applying).
88    #[must_use]
89    pub fn is_folded_passive(&self, spell_id: SpellIdx) -> bool {
90        wowlab_types::bench_metrics::record_game_data_hot_read();
91
92        self.inner.passives.folded_spells.contains(&spell_id)
93    }
94
95    /// Passive spell ids whose modifier effects were folded into static spell values.
96    #[must_use]
97    pub fn folded_passive_spells(&self) -> &[SpellIdx] {
98        wowlab_types::bench_metrics::record_game_data_hot_read();
99
100        &self.inner.passives.folded_spells
101    }
102
103    /// Damage-taken debuffs the class applies to its own target for the whole encounter.
104    ///
105    /// They are derived from the baseline class passives that describe them (Mystic Touch, Chaos Brand).
106    #[must_use]
107    pub fn class_target_debuffs(&self) -> &[SpellIdx] {
108        wowlab_types::bench_metrics::record_game_data_hot_read();
109
110        &self.inner.passives.class_target_debuffs
111    }
112}