Expand description
Bounded attribute modifiers and timed status effects, with explicit stacking. Periodic pulses report work to the host; the host applies authoritative damage.
Inspection copies the current simulation state without advancing time or
consuming pulses. Feed EffectSet::advance from fixed simulation ticks.
use ferravex_play::attributes::{EffectSet, EffectSpec, Periodic, Stacking};
let mut effects = EffectSet::<4>::new().unwrap();
assert!(effects.is_empty());
let mut burn = EffectSpec::modifier(7, 0, 1.0, 2.0);
burn.stacking = Stacking::Stack(3);
burn.periodic = Some(Periodic { interval: 0.5, amount: 2.0 });
effects.apply(burn, 0).unwrap();
effects.apply(burn, 0).unwrap();
effects.advance(0.125).unwrap();
let status = effects.status(7).unwrap();
assert_eq!(effects.len(), 1);
assert_eq!(status.spec.seconds, 2.0);
assert_eq!(status.remaining_seconds, 1.875);
assert_eq!(status.stacks, 2);
assert_eq!(status.periodic_elapsed_seconds, Some(0.125));
assert_eq!(status.periodic_progress(), Some(0.25));
assert_eq!(status.seconds_until_pulse(), Some(0.375));
assert_eq!(effects.iter().next(), Some(status));Structs§
- Damage
- Effect
Set - Effect
Spec - Effect
Status - A copied view of one active effect; editing it cannot change the set.
- Periodic
- Pulse
- Vitals