which leads us to the conclusion that ur best bet would be to use a DDS...
Only if you attend to check each and every order if it was an attack order or a spell casting. Which is gonna be totaly buggy , laggy, confusing, and hard to make.
I don't want this methode, its totaly hard.
I think about new method:
Each second:
set ug = global map heroes, includes illusions.
pick every unit in ug:
set int =0; // counter set for each unit is reset
if (unit has "better item") {set int = int + 20}
else if(unit has "item") {set int = int + 15}
if (unit has buff "better buff" ){ set int = int +10 }
else if (unit has buff " buff "){ set int = int + 5 }
...
set level of "spell damage reducion" for picked unit to int
} //end picked
call remove group //end trigger
Problams:
1) in order to detect "better buff" the buff will be detected by ability with each level giving different buff; in order to 2 auras to stack correctly it must be "if better buff was found dont give normal buff increase"; cause normal aura can give 2 buffs at the same second, once it is leveled.
2) Each hero should have normal unit ability called "damage reducion" and the items or abilities cant give also, since they stack, and if i give some player MINUS reducion, it gonna be totaly problam if the item dominant over the trigger.
3) Mirror images get the same damage reducion as the hero -> fixedable by adding the check "also illusions", but im not sure if passive ability is changedable for illusions.
4) if a player hero cast a spell, it will only be colculated the following second, so it wont be done after 0.01 seconds unless the trigger will go wild
5) if a player hero has an aura, or it effect units, it will be harder to immidiatly update everything, plus u gonna give each and any unittype you are using on the map an ability "spell item reducion" which can be done by "trigger: unit enter map" so its not THAT hard: damage reducion is inviable anyways so u dont need to make spellbook
6) dont forget that units that has spell resistance dont need this ability, but having it anyways wont do any harm; towers , however, do need to be out of this trigger since they need to take blizzard damge and the such.
Concluding:
making 2 triggers: 1) bring damage reducion to global units, and entered units, but not towers.
2) trigger that works any 1 second, updating everything.
3) dunno if illusions can be changed.
4) create spell damage reducion have 41 levels: level 1 is the one given to all entering units and must be equall to zero, then u have to make some colculation that can give both + defense and MINUS defense; - use each level for 5% extra defense and never make abilities that go away from that count of x5 (overwize u pass the 100 levels of world editor defults) , use some formula that gives - spell defense if needed (PLEASE HELP ME WITH THAT).
5) the update done to living units every 1 second: it will not have immidiate update: can be imba bug for spells that give 99% spell reducion for 3 seconds.
6) most important : YOU CAN MAKE MINUS SPELL REDUCION!!! (attached map proves it).
Please tell me your opinion about how to make that formula.
Damage reducion level 1 = 0%.
Damage reducion level 2 = 5%.
...
Damage reducion level 22 = -5%
Damage reducion level 41 = -100%
so i think about this: "if integer less than 0"{
and then some colculate that make it fit that damage reducion level. so if he need to do -100% i will send him to int =41 and if its -5% i will send him to level 22.
}