If you don't need the Autocast functionality then you could try to use two abilities, the first being the ability that your unit casts and the second being a "dummy" ability which is cast through triggers.
The first ability would be based on something like Siphon Mana which already has hardcoded requirements for mana. The second ability would be what you want the actual effect/buff to be, so Inner Fire for example.
Then you trigger it so when your unit casts Siphon Mana:
-
Events:
-
Unit - A unit Starts the effect of an ability
-
Conditions:
-
(Ability being cast) Equal to Siphon Mana
You create a Dummy unit, Add Inner Fire to it, and order it to cast Inner Fire on the target:
-
Actions:
-
Unit - Create 1 Dummy for Triggering Player at Position of Triggering unit
-
Unit - Add a 0.50 second Generic Expiration Timer to Last created unit
-
Unit - Add Inner Fire to Last created unit
-
Unit - Order Last created unit to Human Priest - Inner Fire Target unit of ability being cast
Obviously you'd want to modify the Siphon Mana ability so that it doesn't actually do anything. It's just there to mimic the effects of a real ability -> go on cooldown, cost mana, run the trigger, etc. You may have to mess around with it's values to get it to work properly, I assume something like a 0.001 second Duration and a Mana Drain value of 0.
Otherwise, you can do something like this:
-
Events:
-
Unit - A unit Begins casting an ability
-
Conditions:
-
(Ability being cast) Equal to Your Ability
-
(Max Mana of (Target unit of ability being cast)) Equal to 0
-
Actions:
-
Unit - Order Triggering unit to Stop
This will interrupt the cast of the ability if the target has 0 max mana.
Keep in mind that if you were to use something like Inner Fire as your ability and it had Autocast toggled on, nothing would really stop your unit from trying again and again to target a mana-less unit. The AI doesn't know any better since we can't modify that.