I do have a particular spell in mind here, but I have (a) much more general question(s). How, through triggers or JASS, can effects that detect or manipulate the amount of damage a unit takes be made? For example: The DOTA hero Lord of Avernus' Aphotic Shield and Borrowed Time abilities.
Aphotic Shield is a castable buff that places a shield on a unit that absorbs a set amount of damage. (Once that damage is exceeded, it explodes, dealing that amount to enemies in an AOE.)
Borrowed Time is a passive ability, that activates whenever Lord of Avernus' hit points drop below 400. It puts on him the Unsummon Building effect, and nullifies any and all damage, for 5 seconds or so. The effect, once activated, will not activate for another minute or so, giving it a cooldown of sorts.
If Lord of Avernus has Aphotic Shield on himself while Borrowed Time is in effect, then any damage he would take instead heals him (as if he were taking negative damage).
How is this accomplished? How is damage dealt with - I have no idea how the "a unit takes damage" events and "damage taken" event variables are to be used. The specific spell I had in mind is a castable Mana Shield buff. I could just make a spell that adds Mana Shield to the target unit and activates it via triggers, but that would be in my opinion less than authentic, and potentially messy.
What I want to do is place a visible buff on a unit. Whenever a unit with this buff takes damage from any source (aside from itself, presumably) that damage is reduced by a percentage, say 20%, and that damage is instead done to the unit's mana pool, possibly multiplied by some factor. If the unit takes damage and has no mana, or less than 20 mana or so, the buff is instantly removed. So basically the effect of mana shield, coming from triggers activated by a unit with the buff taking damage.
Sorry if this question is obnoxious or difficult. Thanks in advance for any help or advice!
Aphotic Shield is a castable buff that places a shield on a unit that absorbs a set amount of damage. (Once that damage is exceeded, it explodes, dealing that amount to enemies in an AOE.)
Borrowed Time is a passive ability, that activates whenever Lord of Avernus' hit points drop below 400. It puts on him the Unsummon Building effect, and nullifies any and all damage, for 5 seconds or so. The effect, once activated, will not activate for another minute or so, giving it a cooldown of sorts.
If Lord of Avernus has Aphotic Shield on himself while Borrowed Time is in effect, then any damage he would take instead heals him (as if he were taking negative damage).
How is this accomplished? How is damage dealt with - I have no idea how the "a unit takes damage" events and "damage taken" event variables are to be used. The specific spell I had in mind is a castable Mana Shield buff. I could just make a spell that adds Mana Shield to the target unit and activates it via triggers, but that would be in my opinion less than authentic, and potentially messy.
What I want to do is place a visible buff on a unit. Whenever a unit with this buff takes damage from any source (aside from itself, presumably) that damage is reduced by a percentage, say 20%, and that damage is instead done to the unit's mana pool, possibly multiplied by some factor. If the unit takes damage and has no mana, or less than 20 mana or so, the buff is instantly removed. So basically the effect of mana shield, coming from triggers activated by a unit with the buff taking damage.
Sorry if this question is obnoxious or difficult. Thanks in advance for any help or advice!