It's easy
You'll need a dummy spell that shows your aoe (like silence) to place, then a condition check upon starts casting an ability (here you'll stop the unit if impossible and show error message) you conditions.
Another trigger that fires when 'unit starts effect of an ability' which creates you mine dummy unit and uses the action - event - "a unit matching (your condition) comes within (your aoe) of last created unit" to another trigger.
That last trigger only has action code: pick every unit of unit type (your mine) in (your aoe) around triggering unit
-kill picked unit
-damage triggering unit for (whatever damage)
(just an explanation above, no acutal coding, no leak removal)
If you want to use hashtables instead, you could create a mine group and check like every 0.1 seconds:
pick every unit in minegroup
-set currentmine =picked unit
if(a unit matching (your condition) is within (your aoe) of current mine
-damage all units matching (your condition) within (your oae) of currentmine for damage xyz
remove currentmine from minegroup
-kill currentmine
The latter deals damage to all units to all units matching your condition, the earlier only to the triggering unit - depends on what you want to achieve with your mine, though i believe that the 2nd version is a) better and b) if you want effect a) youcan achieve it too.