Untested theroy:
- Add mana shield ability to unit, order unit to cast mana shield, remove ability. The buff may remain without the skill intact.
If that doesn't work, you can trigger it to modify a unit's hp based on the mana of the priest, if you want close to the same functionality as mana shield.
- Setup a unit variable for the target mana shielded unit
- Setup a real variable for a tracker of the hp of the mana shielded unit
- Setup a dummy spell (such as inner fire, etc.) with a custom buff for mana shield
- Setup a trigger that fires off every 0.25/.5/1s or whatever interval you want (alternative you could base it off a unit is attacked event) that monitors the hp of the unit and records it to the real variable. If it is different from the last time it was checked, make the trigger modify the HP of the unit, increasing it by the magnitude (for example, if you want a 50% mana shield, make it give 50% of the hp disparity) and modifying negatively the mana of the priest. Make sure before you do that that the priest has sufficient mana to shield the other unit.
Only weaknesses in this is the fact that the unit will take the full damage from the blow before adjustment. You could, alternately, put a buff or ability on the unit that offers damage resistance (such as crypt lord passive) then remove it when the priests mana is 0 (make sure that all damage incurred its double that to the priest's mana pool, as the unit will already be taking 50% less damage). If the unit or priest dies, or if the priest's mana runs out, make sure you remove the 50% damage resist ability.