Damage Engine and Magic Resist skills

Level 6
Joined
Jul 3, 2006
Messages
102
I am using Damage Engine 3.8.0.0 in my map. I have a spell that I want to reduce enemy magic resistance, so I created a spell based on Spell Damage Reduction and give it to this unit. I am aware that the engine also uses a version of this skill to detect spell damage.

The issue I am observing is that, when I give a unit the magic resist ability, it messes the engine's spell damage detection.
While this ability is active on a unit, the engine thinks all damage coming to it is physical.
If I remove it, it goes back to detecting it correctly.

Does anyone know why that is and if I can do something about it?
 
Does anyone know why that is and if I can do something about it?
In classic 1.26 there is no function to determine the type of damage dealt/received.
So a brilliant crutch was devised: Give all units an ability, based on 'AIsr' with a "Damage Reduction" of 2.0.
Thus, magical damage, instead of dealing damage, will heal units.
This means that in the "unit takes damage" event, if the unit's HP doesn't decrease, and even increases, we know it's magical damage.

For this reason, if you use this system, you're better off avoiding 'AIsr' based abilities.
Better yet, avoid using default abilities with magic resistance altogether.
I described one of the options for using custom magic resistance in one of the demo maps in the editor: YDWE PK
Because it has a built-in gui version of the Damage Engine.
You're probably like most people and use the Reforged editor, so 1.26-based editors aren't of interest to you, but opening this demo map might be useful for you anyway.
 
In classic 1.26 there is no function to determine the type of damage dealt/received.
So a brilliant crutch was devised: Give all units an ability, based on 'AIsr' with a "Damage Reduction" of 2.0.
Thus, magical damage, instead of dealing damage, will heal units.
This means that in the "unit takes damage" event, if the unit's HP doesn't decrease, and even increases, we know it's magical damage.
Thanks for the explanation, this was actually a question of mine.
If you are using a DDS and that system already detects magic damage, why not use the system to reduce magic done?
The reason is that magic resistance reduction does not equal the same amount of magic damage increase. To calculate the increase in magic damage which is due to reduced magic resistance, the unit's magic resistance needs to go into the calculation.

So without knowing the unit's magic resistance, I can only increase magic damage dealt but this will only give the same result for units that have 0 magic resistance.
 
I don't understand, tbh. From what I gather, you use Spell Damage Reduction already to reduce/increase magic damage done to the unit, but have issues with it due to DDS using it as well. My assumption is that in your custom version of the ability you already set the "spell damage taken" modifier.
With that in mind, what would be the difference between unit having, let's say, 30% damage reduction from the Spell Damage Reduction skill, and doing it via triggers as set damageEventAmount = damageEventAmount * (1.00 - 0.30)? Assuming here that "damageEventAmount" is the name of the variable that DDS uses for modifying damage.
 
Let's give an example: unit with 25% magic resistance gets hit by a spell doing 100 damage.

1) Magic resistance decrease of 15%: the spell does 100 * (1 - (0.25-0.15)) = 100 * 0.9 = 90 damage.
2) Magic damage increase of 15%: the spell does 100 * (1 + 0.15) * (1 - 0.25) = 100 * 1.15 * 0.75 = 86.25 damage

The greater the initial magic resistance on the unit, the greater the disparity will be.
Which is why we cannot simply multiply the damage and get the same effect as would be by reducing the resistance.
 
How do those calculations correlate to an issue with DDS?
You have damage source and target.
  • In first equation the target's resistance was decreased - that takes effect when unit receives damage and the game calculates how much will be resisted. So you can sum up all sources of resistance without any issues (if you are using some system for it).
  • In second equation the source's spell damage was increased. This takes place before source shoots the spell. So there's no way to sum the bonus up with spell damage reduction, because the increment happens way before the projectile hits the target.
The above behavior will be the same even if you did not have any issues with DDS or did not use DDS in your map at all and so you could rely on your Spell Damage Reduction ability. You can test it yourself in a new map with a "<Specific unit> takes damage" event.

Also, where does the base 25% resist even come from? Spell Damage Reduction ability does not stack, so you cannot apply multiple of them on a single unit and hope it sums up those resistances.
Armor-type reduction also does not sum up with Spell damage reduction. It actually multiplies.
 
I see, some of my assumptions may be wrong. When I speak of resistance, it is mostly based on armor type (i.e. Heroes default 25% resistance to spells). I noticed that if I add -15% Spell Reduction ability to a unit with normal armor, it increases magic damage by 15%, but if I add it on a Hero, it stacks multiplicatively indeed, therefore having the same effect as if I increased the damage dealt by 15%.

So, Spell damage reduction does stack multiplicatively, but it also messes up spell damage detection therefore if there is no workaround I will have to avoid it completely.
 
Back
Top