First of all, you could implement
this system.
It will do most of the work for you, detecting the incoming damage.
Then you should just create another trigger (with the event Game - GDD_Event becomes 0.00).
Check whether the hero has the spell you wish.
Check whether the incoming damage is greater than 110 - (spell level * 10)
-> Create AoE damage actions
For it to happen every 2 seconds, you could create a hashtable.
Save a boolean as "false" under the unit ID.
Create and start a timer, save the unit ID in the hashtable under the timer ID (further explanation below)
When the timer finishes, set the variable back to "true" and pause/destroy the timer.
The timer-part may be unclear, so:
-
Actions
-
Custom script: local timer time = CreateTimer()
-
Hashtable - Save False as (Key Damaged Unit) of 0 in HashTable
-
Custom script: set udg_HandleID = GetHandleId(time)
-
Hashtable - Save (Key Damaged Unit) as HandleID of 0 in HashTable
-
Custom script: call TimerStart(time, 2., false, function timerEnds)
-
Custom script: set time = null
As you can see:
1) You create a timer
2) You save "false" for the damaged unit (I suppose you know how hashtables work?)
3) You set an integer variable called "HandleID" to the ID of the timer.
4) You save the ID of the damaged unit inside the ID of the timer.
5) You run the timer (will end in 2. seconds, you can change that).
Then you need this (just copy it in the map's header):
JASS:
function timerEnds takes nothing returns nothing
local integer h = GetHandleId(GetExpiredTimer())
call SaveBoolean(udg_HashTable, 0, LoadInteger(udg_HashTable, 0, h), true)
call PauseTimer(GetExpiredTimer())
call DestroyTimer(GetExpiredTimer())
call FlushChildHashtable(udg_HashTable, h)
endfunction
Change "udg_HashTable" with your hashtable's name ( + udg_ in front) and you're done.
Note: I don't know whether this is the most efficient method, it's the first one I can come up with... didn't really think about that.