pub struct StatusEffect {
pub kind: StatusKind,
pub duration: f32,
pub age: f32,
pub strength: f32,
pub stacks: u32,
pub max_stacks: u32,
pub source_id: Option<u32>,
}Expand description
A timed status effect applied to a combatant.
Fields§
§kind: StatusKind§duration: f32Total duration in seconds.
age: f32Elapsed time since application.
strength: f32Strength of the effect (damage per second, slow factor, etc.).
stacks: u32How many times this effect has been applied (stacking).
max_stacks: u32Maximum stacks allowed.
source_id: Option<u32>Source entity that applied this effect.
Implementations§
Source§impl StatusEffect
impl StatusEffect
pub fn new(kind: StatusKind, duration: f32, strength: f32) -> Self
Sourcepub fn regen(hp_per_sec: f32, duration: f32) -> Self
pub fn regen(hp_per_sec: f32, duration: f32) -> Self
Regenerating: x hp/sec for duration seconds.
Sourcepub fn entropied(entropy: f32, duration: f32) -> Self
pub fn entropied(entropy: f32, duration: f32) -> Self
Entropied: increases entropy by strength, lasts duration.
pub fn is_expired(&self) -> bool
pub fn remaining(&self) -> f32
pub fn progress(&self) -> f32
Sourcepub fn effective_strength(&self) -> f32
pub fn effective_strength(&self) -> f32
Effective strength, accounting for stacking.
Sourcepub fn tick(&mut self, dt: f32) -> f32
pub fn tick(&mut self, dt: f32) -> f32
Advance the effect by dt seconds.
Returns the damage dealt this tick (for DoT effects).
Sourcepub fn movement_slow(&self) -> f32
pub fn movement_slow(&self) -> f32
Slow factor this effect applies to movement (1.0 = normal, 0.0 = stopped).
Sourcepub fn attack_speed_mult(&self) -> f32
pub fn attack_speed_mult(&self) -> f32
Attack speed multiplier this effect applies (1.0 = normal).
Trait Implementations§
Source§impl Clone for StatusEffect
impl Clone for StatusEffect
Source§fn clone(&self) -> StatusEffect
fn clone(&self) -> StatusEffect
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for StatusEffect
impl RefUnwindSafe for StatusEffect
impl Send for StatusEffect
impl Sync for StatusEffect
impl Unpin for StatusEffect
impl UnsafeUnpin for StatusEffect
impl UnwindSafe for StatusEffect
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.