Magic immunity

Magic Immunity is a temporary Buff that prevents a unit under it from taking any magical damage or being directly targeted by most non-Ultimate spells. Magic Immunity can be granted by Black King Bar's Avatar ability temporarily. Certain summoned units, such as Weaver's swarm beetles, also possess inherent Magic Immunity.

Note that Magic Immunity will not prevent a hero from being targeted or affected by most Ultimate abilities, but will prevent them from taking any magical damage from the spell. Notably, a Stun from an ultimate will still affect the hero. Any ultimate that does non-magical damage (for example, Juggernaut's Omnislash will still affect the hero as normal.

Bash from ranged attacks counts as a magical ability, and therefore will not affect a unit under Magic Immunity, but the damage is physical and will affect them as normal. On the other hand, Bashes from melee heroes does magical damage (which will not affect the hero) but counts as a physical stun, and therefore can still Stun a hero under Magic Immunity.