Skip to main content

wowlab_engine_combat/systems/
buffs.rs

1//! Aggregation of active aura buff effects and haste/GCD derivations.
2
3use wowlab_engine_domain::dbc::ModifierOperation;
4use wowlab_types::{
5    constants::{DEFAULT_GCD_MS, GCD_FLOOR_MS, HUNDRED},
6    sim::{ActorId, EnemyIdx, SimTime},
7};
8
9use crate::{
10    context::{ActorView, CombatView},
11    state::{
12        BuffEffect, BuffTotals, CombatInstance, EffectFamily, ResourcePool,
13        buff_effect::PlayerScalingBuffs,
14    },
15};
16
17const DEFAULT_PERIODIC_INTERVAL_MS: u32 = 1_000;
18const MIN_TIME_RATE_DELTA: f64 = -0.99;
19
20#[derive(Clone, Copy, Debug, Eq, PartialEq)]
21pub(crate) enum IncomingSpellDefense {
22    None,
23    Reflected,
24    Deflected,
25}
26
27mod costs;
28mod haste;
29mod modifiers;
30mod planned;
31mod timing;
32mod totals;
33
34pub(crate) use costs::{
35    base_optional_primary_spell_cost, base_primary_spell_cost, current_resource_gain_mult,
36    effective_optional_spell_cost, effective_spell_cost, initialize_all_spell_costs,
37    refresh_spell_costs_for, sync_player_health_from_stamina,
38};
39pub(crate) use haste::{
40    aura_time_rate_multiplier, current_attack_haste_mult, current_auto_attack_mult_for,
41    current_haste_mult, current_haste_mult_for, current_mastery_points, current_rppm_scaling,
42    current_stat_haste_mult,
43};
44#[cfg(test)]
45pub(crate) use haste::{current_auto_attack_mult, time_rate_factor};
46pub(crate) use modifiers::{
47    active_auto_attack_replacement, active_effect_amplitude, active_effect_points,
48    active_form_combat_round_time_ms, active_spell_modifier_value, active_spell_school_override,
49    active_targeting_value, resolve_incoming_spell_defense, spell_modifier_owner,
50    target_aura_mechanic_mask,
51};
52#[cfg(not(feature = "rotation-optimizations"))]
53pub(crate) use planned::for_each_active_damage_modifier_for_action;
54#[cfg(feature = "rotation-optimizations")]
55pub(crate) use planned::for_each_active_damage_modifier_for_actions;
56pub(crate) use planned::{
57    dbc_effect_points, for_each_active_cost_modifier_for_action,
58    for_each_active_scoped_spell_modifier_for_action, for_each_active_spell_modifier_for_action,
59    for_each_planned_actor_aura_effect, for_each_planned_actor_aura_effect_binding,
60    for_each_planned_actor_effect, for_each_planned_actor_effect_damage_binding,
61    for_each_planned_player_effect, for_each_planned_target_effect,
62};
63pub(crate) use timing::{
64    data_driven_actor_timing_modifiers, effective_aura_duration_ms, effective_cast_time_ms,
65    effective_gcd_ms, effective_periodic_interval_for_action, effective_periodic_interval_ms,
66    effective_periodic_tick_ms,
67};
68pub use totals::buff_totals;
69#[cfg(test)]
70pub(crate) use totals::reference_uncached_actor_buff_totals;
71pub(crate) use totals::{
72    actor_buff_totals, actor_dynamic_damage_mult, actor_only_buff_totals, actor_static_buff_totals,
73    player_scaling_buffs,
74};
75
76#[cfg(test)]
77#[path = "buffs/tests.rs"]
78mod tests;