wowlab_engine_combat/systems/
ground_effects.rs1use wowlab_types::sim::EnemyIdx;
2
3use super::{damage_pipeline::ProfiledDamageDef, deal_profiled_damage_def_at};
4use crate::{context::CombatCtx, state::PendingGroundPulse};
5
6pub(crate) fn ground_pulse_anchor(state: &crate::state::CombatInstance) -> Option<EnemyIdx> {
7 state
8 .runtime
9 .current_target
10 .filter(|target| state.is_valid_target(*target))
11 .or_else(|| {
12 state
13 .enemies()
14 .find(|enemy| enemy.is_active() && enemy.is_alive())
15 .map(wowlab_engine_domain::encounter::EnemyState::id)
16 })
17}
18
19pub(crate) fn process_ground_pulse(ctx: &mut CombatCtx<'_>, pulse: PendingGroundPulse) {
20 deal_profiled_damage_def_at(
21 ctx,
22 &ProfiledDamageDef {
23 binding: pulse.binding,
24 effect: pulse.damage_effect,
25 geometry_effect: pulse.geometry_effect,
26 profile_spell_id: pulse.profile_spell_id,
27 base_points: None,
28 def: pulse.damage,
29 flags: pulse.flags,
30 source_position: None,
31 destination: Some(pulse.destination),
32 },
33 );
34}