AOE = Area of EFFECT, magic immunity normaly only pretect a unit against spells that specifically trget the unit. you can change that with cusotm script (which i dont know
or you could make the ability magic imunity a dummy spell (one that does nothing) so bassicall the unit/hero only has an icon, and you have a trigger that is
(sorry i stink at the strigger funtion on here) this would be fore a hero or if you want the unit to gain the ability
event - unit gains ability
conditions - ability equal to magic immunity -( ability gaining unit equal to hero( equal to [whatever you want the hell you it to be])
actions - turn on trigger use magic immunity
here the other trigger, if the unit starts with the ability you can jsut have this one
event - and or mltiple conditions === units issue order attacks unit / or / unit issue order cast spell
condition - attacked unit contains magic immunity ability, attaking unit is not ( put here all the stuff you want to be able to hit the magic immune person IE. magic type damage, certian spells)
actions - prevent all damage to attacked unit - (And make it instantly debuff all effects the unit has that are not equal to the ones that can effect the unit i.e remove all debuffs not equal to slow and web [remeber to use the "and / or" actions for here and conditions"
thats isnt exact but somthing lie that should work