Function fast_equip_abilities

Source
pub fn fast_equip_abilities(ctx: &AbilityIdsCtx<'_>) -> Result<Vec<Uuid>>
Expand description

Native port of the live fast_equip_abilities_script:

Mirrored exactly:

  • The comparator is floor(dmg_b - dmg_a) cast to an integer ordering, the Less, 0 => Equal, > 0 => Greater). Differences in the open interval (-1, 1) floor to 0 and are treated as equal — this is a quirk of the live script and is preserved deliberately. abilities keep their input order.
  • The slice is min(len, Slots); signed(Slots) is slots as i64, but the clamp to len makes it safe to compute as min over usize.

A failed balance::ability_damage lookup surfaces here as Err