wowlab_engine_combat/context/channel.rs
1use super::HookCtx;
2
3impl HookCtx<'_> {
4 /// Number of scheduled ticks still belonging to the active channel.
5 #[must_use]
6 pub const fn active_channel_ticks_remaining(&self) -> u8 {
7 self.state.runtime.casting.active_channel_ticks_remaining
8 }
9
10 /// Whether the channel tick being processed is the channel's final one, as `SimC`'s `last_tick()`.
11 ///
12 /// The signal is the channel's own remaining-tick count rather than a timestamp comparison.
13 #[must_use]
14 pub const fn is_last_channel_tick(&self) -> bool {
15 self.state.runtime.casting.active_channel_on_last_tick
16 }
17
18 /// Multiply damage dealt by every tick of the channel currently being started.
19 ///
20 /// Cast hooks can snapshot cast-start mechanics without projecting them into a temporary aura.
21 /// Returns `false` outside an active channel or for an invalid multiplier.
22 pub fn multiply_active_channel_damage(&mut self, multiplier: f64) -> bool {
23 if self.state.runtime.casting.active_channel_target.is_none()
24 || !multiplier.is_finite()
25 || multiplier < 0.0
26 {
27 return false;
28 }
29
30 self.state.runtime.casting.active_channel_damage_mult *= multiplier;
31
32 true
33 }
34}