use crate::{
event::{impl_common, CommonEvent},
extract::Extract,
Event, TryExtract,
};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct BuffInitialEvent {
#[cfg_attr(feature = "serde", serde(flatten))]
pub common: CommonEvent,
pub duration: i32,
pub original_duration: i32,
pub stack_active: u8,
pub stack_id: u32,
}
impl_common!(BuffInitialEvent);
impl Extract for BuffInitialEvent {
#[inline]
unsafe fn extract(event: &Event) -> Self {
Self {
common: event.into(),
duration: event.value,
original_duration: event.buff_dmg,
stack_active: event.is_shields,
stack_id: event.get_pad_id(),
}
}
}
impl TryExtract for BuffInitialEvent {
#[inline]
fn can_extract(event: &Event) -> bool {
event.is_buffinitial()
}
}