Skip to main content

wowlab_engine_domain/rotation/lower/ops/
unit.rs

1use super::super::super::backend::RotationBackend;
2use crate::rotation::buffer::UnitSlot;
3
4const MAX_HEALTH_OFFSET: usize = UnitSlot::OFF_MAX_HEALTH - UnitSlot::OFF_HEALTH;
5
6pub(crate) fn unit_health_pct<B>(b: &mut B, offset: usize) -> B::Float
7where
8    B: RotationBackend,
9{
10    let health = b.load_f64(offset);
11    let max_health = b.load_f64(offset + MAX_HEALTH_OFFSET);
12
13    super::eval_unit_health_pct(b, health, max_health)
14}
15
16pub(crate) fn unit_health_deficit<B>(b: &mut B, offset: usize) -> B::Float
17where
18    B: RotationBackend,
19{
20    let health = b.load_f64(offset);
21    let max_health = b.load_f64(offset + MAX_HEALTH_OFFSET);
22
23    super::eval_unit_health_deficit(b, health, max_health)
24}