Ramza said:
I think u can only do that with JASS, cuz there are no unit damage variables, only damage type etc
Actually, you can make something like this all it requires to check for getting damaged is a GLOBAL VARAIBLE. Now the extent to which i can help is based on how manyn units need this spell. If this ability is limited to a reasonable amount of units (i'm speaking more in terms of up to 12 heroes if required, not more) then you don't need JASS, but otherwise you can't make it multi-instanceable the way you want without JASS.
The reason why you want very few untis is because globals don't work for large groups, and are best used for single units on a map, like heroes, for instance. Normally you can check if the unit already exists but this isn't always the case so instead the unit you create needs to be stored as a global unit variable.
Now with this in mind,the way you could work it out is you'll need a unit group to determine who's attacking you as well as 2 triggers. Any unit who attacks you and is an enemy (and any other conditions) is put in this group. That's the first trigger, very simple.
Now the second is what makes the doging doable. When you take damage, you check if the source came from that unit group. If it did and you were set to dodge, then store that damage taken as a real varaible as well as compensate for the damage taken (set ur hero's health to [his health + damage taken]). That's it for storing damage.
Now to damage you need two triggers for this to work. The firsdt detecs when you attack a unit. Then you store the attacked unit as a global Also you have to add the event to the second trigger that that unit (as the global variable) takes damage.
The second trigger detects when they get damaged and (if dmaaged by you) you ghet a dummy to deal the extra counter damage and turn off this damaging trigger.
Another thing is with each attack you should disable the dmaage trigger first then reenable it and disbale it after delaing dmaage to make sure that it refrshes and works, even when you miss.
From this point what you should get is an ability that will take all the dmaage you've dodged before the last time you attacked and deal it to the unit you attack, that is, if you don't miss. If you want to counter as they attack, there's no real good way to do it as you can't just get ur hero to attack and damage as they do and as such you won't deal the damage they'd normally deal. If you want her to counter exactly the same time, then you'll need set damage amount. The best you could do is check their dice and die values as well as their main attribute and base attack and deal that, but of course that doesn't account for any items they might have. There's no 100% working way but mine will do everything, just only on the next attack. So there's not way to detect what damage you'd do from 1 single attack so the best i can do is have your guy deal the damage on his next attack.
That's the best i could do for you.