Skip to main content

wowlab_engine_combat/systems/
periodic.rs

1//! Periodic (DoT/HoT/resource) aura tick processing and rescheduling.
2
3use wowlab_engine_domain::rotation::DenseBuffer;
4use wowlab_engine_ports::Event;
5use wowlab_engine_rng::proc_chance;
6use wowlab_engine_telemetry::{ResourceEventKind, TelemetrySink};
7use wowlab_types::{
8    constants::{HUNDRED, MS_PER_SECOND},
9    sim::{ActorId, AuraKey, AuraOn, EnemyIdx, SimTime},
10};
11
12use super::{
13    auras::{
14        apply_aura, apply_aura as apply_aura_system, capture_snapshot_for, drain_deferred_work,
15        expire_aura,
16    },
17    buffs::{effective_periodic_interval_ms, effective_periodic_tick_ms},
18    damage_pipeline::{
19        DamagePayload, DamageSnapshot, SnapshotPower, deal_damage_ap, deal_damage_base,
20        deal_damage_sp, deal_damage_with_snapshot, deal_effect_damage_ap, deal_effect_damage_base,
21        deal_effect_damage_sp, read_aura_snapshot,
22    },
23    effects::{EffectExecution, execute_effect_range},
24    procs::{ResourceTelemetry, emit_resource},
25    resources::spend_resource,
26};
27use crate::{
28    DamageFlags,
29    context::{CombatCtx, HookCtx},
30    state::{
31        AuraData, AuraTickBehavior, CombatState, DynamicTickAction, LocalAuraIdx, PeriodicKind,
32        ResourceGain, ResourceGainSource,
33    },
34};
35
36const MIN_TICK_INTERVAL_S: f64 = 0.001;
37
38mod schedule;
39mod snapshot;
40pub(crate) mod tick;
41
42use schedule::aura_tick_due;
43#[cfg(test)]
44pub(crate) use schedule::fire_partial_tick_on_expiry_fixture;
45pub(crate) use schedule::{
46    fire_partial_tick_on_expiry_for, fire_partial_tick_on_expiry_without_target, reapply_if_flagged,
47};
48use snapshot::periodic_damage_snapshot;
49#[cfg(test)]
50pub(crate) use tick::process_single_aura_tick_fixture;
51pub(crate) use tick::{periodic_tick_target, process_single_aura_tick_for};
52
53#[cfg(test)]
54#[path = "periodic/tests.rs"]
55mod tests;