Unique Attack Modifiers function on a system of priority, because Unique Attack Modifiers do not stack. For each attack only one Unique Attack Modifier will be applied.
Conditional Modifiers are applied first: these are Unique Attack Modifiers that only occur on some attacks and are not controlled by the player, such as the chance based Mjollnir. If a Conditional Modifier fails to occur then an Item or Ability Modifier will be present on the attack if applicable.
Ability Modifiers are applied second: these are Unique Attack Modifiers that are applied by hero abilities. Note that Conditional Modifiers will only override an Ability Modifier if the Ability Modifier is casted using autocast. If casted manually, the Ability Modifier will always take effect.
Item Modifiers are applied last. The oldest item in the hero's inventory will have priority, though priority can be changed by dropping the item out of the inventory and then picking it up again.