Skip to main content

wowlab_engine_combat/systems/
periodic.rs

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