Function fast_equip_abilities

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

Ranks the player’s non-class abilities by rarity first, then damage, and returns the template_ids of the top min(len, Slots).

Rarity leads for the same reason it does in fast_equip_pets: it is the axis the player pulled for and the one that sets the ability’s ceiling, so a heavily-levelled Common briefly out-damaging a fresh Legendary should not make quick-equip bench the Legendary. Damage (crate::mechanics::balance::ability_damage_from_id) orders abilities inside one rarity band.

Within a band the damage comparator is the floor(dmg_b - dmg_a) ordering inherited from the live fast_equip_abilities_script: differences in the open interval (-1, 1) floor to 0 and count as equal, and the sort is stable, so genuinely-tied abilities keep their input order. That quirk is preserved deliberately.

A failed balance::ability_damage lookup surfaces here as Err.